Compare commits
147 Commits
master
...
patch/5.6.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63cfdc42e6 | ||
|
|
2032376f19 | ||
|
|
a8cb3e3d8b | ||
|
|
0eb1a2c7c4 | ||
|
|
1e70e83d6c | ||
|
|
0b56bc83bc | ||
|
|
cc3d31c485 | ||
|
|
cc4f6dbe2a | ||
|
|
b48614901b | ||
|
|
751f1797a8 | ||
|
|
91723e3e3b | ||
|
|
88ea8c0d35 | ||
|
|
d69591b1c4 | ||
|
|
f4b2e4a961 | ||
|
|
6fce0bf810 | ||
|
|
cc72a08f73 | ||
|
|
9e55460726 | ||
|
|
2270d6b884 | ||
|
|
a1c6cf217d | ||
|
|
84ec465fe7 | ||
|
|
2651e07e2c | ||
|
|
05982475b4 | ||
|
|
70080e2897 | ||
|
|
29f7ccdb20 | ||
|
|
e74f6212ef | ||
|
|
045b05cdcb | ||
|
|
40e4782d91 | ||
|
|
dd31eff3ef | ||
|
|
189aa4391f | ||
|
|
8b7ff0ef10 | ||
|
|
2e378750f5 | ||
|
|
a97896078d | ||
|
|
762a616388 | ||
|
|
d00f13a4f6 | ||
|
|
bcea76fd7d | ||
|
|
0e4592d24f | ||
|
|
568c234fd1 | ||
|
|
cc6db192a8 | ||
|
|
4e7e1f7fb1 | ||
|
|
1a6879abbd | ||
|
|
6185aceb1f | ||
|
|
b7607091c7 | ||
|
|
d8c0cedff4 | ||
|
|
0cb81d2ef0 | ||
|
|
5b77b07402 | ||
|
|
a376b56bd5 | ||
|
|
b32ebabf50 | ||
|
|
3b4c4246f7 | ||
|
|
e2e374ba68 | ||
|
|
1aa2cd76e7 | ||
|
|
7b9bd9128b | ||
|
|
058a84513a | ||
|
|
1e01d4d568 | ||
|
|
fab9aa46c2 | ||
|
|
59aa8d256f | ||
|
|
b2bdcd5fd0 | ||
|
|
3d07cf391c | ||
|
|
17b068d21c | ||
|
|
7bb88fee20 | ||
|
|
b7bebaba7c | ||
|
|
29c00d2489 | ||
|
|
34f8dd8d1d | ||
|
|
941ff55143 | ||
|
|
397dd1d955 | ||
|
|
e0c04223f4 | ||
|
|
d1dd090b33 | ||
|
|
52e0760e73 | ||
|
|
dd54af237b | ||
|
|
791b35f663 | ||
|
|
cfbd1f44e4 | ||
|
|
2877da8123 | ||
|
|
7a312a42c3 | ||
|
|
a064ab73f9 | ||
|
|
8c6393250c | ||
|
|
b9ed000511 | ||
|
|
143115a8fd | ||
|
|
99f1ee03a1 | ||
|
|
bf39ddd570 | ||
|
|
4366d1a8f3 | ||
|
|
2c8c4d8719 | ||
|
|
db9ad40dca | ||
|
|
ff93d61119 | ||
|
|
176146f91b | ||
|
|
cfaccd6dfb | ||
|
|
a5de645037 | ||
|
|
78e957fc0d | ||
|
|
8fa66fec43 | ||
|
|
b6b135110b | ||
|
|
019750ab52 | ||
|
|
9d84478866 | ||
|
|
6580500330 | ||
|
|
bc29c5c419 | ||
|
|
5f01b94bbc | ||
|
|
d580207102 | ||
|
|
2e709ae941 | ||
|
|
efca42296b | ||
|
|
06737945a1 | ||
|
|
a7d74c37be | ||
|
|
bf93d1f4ee | ||
|
|
f76f1f891c | ||
|
|
05a078c78b | ||
|
|
92bbb3d92b | ||
|
|
907dce15b1 | ||
|
|
203841e299 | ||
|
|
64223affda | ||
|
|
3e440a1a48 | ||
|
|
d791226489 | ||
|
|
02d1842a48 | ||
|
|
7a7bdd1304 | ||
|
|
49640dc098 | ||
|
|
499d771a09 | ||
|
|
7aa17338e8 | ||
|
|
f63cb69983 | ||
|
|
e44f70719f | ||
|
|
bb632c8427 | ||
|
|
f298a5e768 | ||
|
|
8397fa3f0a | ||
|
|
6a6624b346 | ||
|
|
041af5ca86 | ||
|
|
ea2bc4ded1 | ||
|
|
ee93748000 | ||
|
|
1fc3b9b827 | ||
|
|
4b0a447523 | ||
|
|
6ecc4602c6 | ||
|
|
02c4087da8 | ||
|
|
50b7a5411f | ||
|
|
06ea71267b | ||
|
|
e851d208cc | ||
|
|
6dccd92692 | ||
|
|
606af0695d | ||
|
|
4706f2b826 | ||
|
|
e73cdc9d1f | ||
|
|
d762b9e163 | ||
|
|
863080eb9b | ||
|
|
039ca47173 | ||
|
|
9c93731ffb | ||
|
|
2f53fd6dca | ||
|
|
730d75f774 | ||
|
|
ddf3af5098 | ||
|
|
ccb76fc453 | ||
|
|
8733a729a5 | ||
|
|
39dc446c3f | ||
|
|
506f96c24a | ||
|
|
abe4f85633 | ||
|
|
b551521943 | ||
|
|
56432bf9fc | ||
|
|
8b446480a2 |
BIN
main/plugins/org.talend.common.ui.runtime/icons1/map.gif
Normal file
BIN
main/plugins/org.talend.common.ui.runtime/icons1/map.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
main/plugins/org.talend.common.ui.runtime/icons1/reduce.gif
Normal file
BIN
main/plugins/org.talend.common.ui.runtime/icons1/reduce.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -19,6 +19,7 @@ import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.CommonUIPlugin;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
|
||||
/**
|
||||
@@ -42,22 +43,24 @@ public final class MessageBoxExceptionHandler {
|
||||
*
|
||||
* @param ex - exception to log
|
||||
*/
|
||||
public static void process(final Throwable ex) {
|
||||
final Display display = Display.getCurrent() == null ? Display
|
||||
.getDefault() : Display.getCurrent();
|
||||
if(display != null){
|
||||
display.syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = display.getActiveShell() == null ? new Shell()
|
||||
: display.getActiveShell();
|
||||
process(ex, shell);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
public static void process(final Throwable ex) {
|
||||
if (CommonUIPlugin.isFullyHeadless()) {
|
||||
CommonExceptionHandler.process(ex);
|
||||
return;
|
||||
}
|
||||
final Display display = Display.getCurrent() == null ? Display.getDefault() : Display.getCurrent();
|
||||
if (display != null) {
|
||||
display.syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = display.getActiveShell() == null ? new Shell() : display.getActiveShell();
|
||||
process(ex, shell);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, Shell shell) {
|
||||
CommonExceptionHandler.process(ex);
|
||||
|
||||
@@ -176,6 +176,8 @@ public enum ECoreImage implements IImage {
|
||||
EXCHNAGEIMAGEMISSING("/icons/component_missing.gif"), //$NON-NLS-1$
|
||||
STATUS_OK("/icons/ok.png"), //$NON-NLS-1$
|
||||
MRGREEBAR("/icons1/mrGreeBar.gif"), //$NON-NLS-1$
|
||||
MRMAP("/icons1/map.gif"), //$NON-NLS-1$
|
||||
MRREDUCE("/icons1/reduce.gif"), //$NON-NLS-1$
|
||||
MRREDBAR("/icons1/mrRedBar.gif"), //$NON-NLS-1$
|
||||
MRGRAYBAR("/icons1/mrGrayBar.gif"), //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.Control;
|
||||
import org.talend.commons.ui.expressionbuilder.ICellEditorDialog;
|
||||
import org.talend.commons.ui.expressionbuilder.IExtendedCellEditorBehavior;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.ws.WindowSystem;
|
||||
|
||||
/**
|
||||
* yzhang class global comment. Detailled comment <br/>
|
||||
@@ -69,6 +70,7 @@ public class CellEditorDialogBehavior implements IExtendedCellEditorBehavior {
|
||||
* org.talend.designer.rowgenerator.ui.tabs.IExtendedCellEditorBehavior#createBehaviorControls(org.eclipse.swt.widgets
|
||||
* .Composite)
|
||||
*/
|
||||
@Override
|
||||
public Control createBehaviorControls(Composite parent) {
|
||||
|
||||
panel = new Composite(parent, SWT.NONE);
|
||||
@@ -86,7 +88,10 @@ public class CellEditorDialogBehavior implements IExtendedCellEditorBehavior {
|
||||
panel.setLayoutData(gd);
|
||||
|
||||
GridData controlGD = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
|
||||
|
||||
// Set a default height for the text control on OS X
|
||||
if (WindowSystem.isOSX()) {
|
||||
controlGD.heightHint = 14;
|
||||
}
|
||||
Control text = extendedTextCellEditor.createText(panel);
|
||||
text.setLayoutData(controlGD);
|
||||
|
||||
|
||||
@@ -95,35 +95,48 @@ public class FileCopyUtils {
|
||||
|
||||
public static void copyFolder(File resFolder, File destFolder) {
|
||||
try {
|
||||
if (!resFolder.exists()) {
|
||||
return;
|
||||
}
|
||||
destFolder.mkdirs();
|
||||
String[] file = resFolder.list();
|
||||
File temp = null;
|
||||
for (String element : file) {
|
||||
temp = new File(resFolder, element);
|
||||
|
||||
if (temp.isFile()) {
|
||||
FileInputStream input = new FileInputStream(temp);
|
||||
FileOutputStream output = new FileOutputStream(new File(destFolder, temp.getName()));
|
||||
byte[] b = new byte[1024 * 5];
|
||||
int len;
|
||||
while ((len = input.read(b)) != -1) {
|
||||
output.write(b, 0, len);
|
||||
}
|
||||
output.flush();
|
||||
output.close();
|
||||
input.close();
|
||||
}
|
||||
if (temp.isDirectory()) {
|
||||
copyFolder(new File(resFolder, element), new File(destFolder, element));
|
||||
}
|
||||
}
|
||||
copyFolder(resFolder, destFolder, false);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void copyFolder(File resFolder, File destFolder, boolean interruptable) throws Exception {
|
||||
Thread currentThread = Thread.currentThread();
|
||||
if (interruptable && currentThread.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
if (!resFolder.exists()) {
|
||||
return;
|
||||
}
|
||||
destFolder.mkdirs();
|
||||
String[] file = resFolder.list();
|
||||
File temp = null;
|
||||
for (String element : file) {
|
||||
if (interruptable && currentThread.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
temp = new File(resFolder, element);
|
||||
|
||||
if (temp.isFile()) {
|
||||
FileInputStream input = new FileInputStream(temp);
|
||||
FileOutputStream output = new FileOutputStream(new File(destFolder, temp.getName()));
|
||||
byte[] b = new byte[1024 * 5];
|
||||
int len;
|
||||
while ((len = input.read(b)) != -1) {
|
||||
if (interruptable && currentThread.isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
output.write(b, 0, len);
|
||||
}
|
||||
output.flush();
|
||||
output.close();
|
||||
input.close();
|
||||
}
|
||||
if (temp.isDirectory()) {
|
||||
copyFolder(new File(resFolder, element), new File(destFolder, element), interruptable);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public class NetworkUtil {
|
||||
private static final Pattern macPattern = Pattern
|
||||
.compile(".*((:?[0-9a-f]{2}[-:]){5}[0-9a-f]{2}).*", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
|
||||
|
||||
private static final String TALEND_DISABLE_INTERNET = "talend.disable.internet";//$NON-NLS-1$
|
||||
|
||||
private final static Set<String> getMacAddressList() throws IOException {
|
||||
final Set<String> macAddressList = new HashSet<String>();
|
||||
|
||||
@@ -100,7 +102,10 @@ public class NetworkUtil {
|
||||
}
|
||||
|
||||
public static boolean isNetworkValid() {
|
||||
|
||||
String disableInternet = System.getProperty(TALEND_DISABLE_INTERNET);
|
||||
if ("true".equals(disableInternet)) { //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
URL url = new URL("http://www.talend.com"); //$NON-NLS-1$
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
|
||||
@@ -15,7 +15,9 @@ package org.talend.commons.utils.threading;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* created by wchen on 2014-6-6 Detailled comment
|
||||
@@ -36,6 +38,11 @@ public class CustomMapThreadPoolExecutor extends TalendCustomThreadPoolExecutor
|
||||
super(queueCapacity, handler);
|
||||
}
|
||||
|
||||
public CustomMapThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
|
||||
BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
|
||||
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -1 +1 @@
|
||||
talend.version=5.6.1
|
||||
talend.version=5.6.2
|
||||
@@ -13,7 +13,6 @@
|
||||
package org.talend.commons.ui.swt.advanced.dataeditor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -33,55 +32,51 @@ import org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn;
|
||||
import org.talend.commons.utils.data.bean.IBeanPropertyAccessors;
|
||||
import org.talend.commons.utils.data.list.ListenableListEvent;
|
||||
|
||||
public class HadoopPropertiesTableView extends AbstractDataTableEditorView<HashMap<String, Object>> {
|
||||
public class HadoopPropertiesTableView extends AbstractDataTableEditorView<Map<String, Object>> {
|
||||
|
||||
private static final String VALUE = "VALUE";
|
||||
private static final String VALUE = "VALUE"; //$NON-NLS-1$
|
||||
|
||||
private static final String PROPERTY = "PROPERTY";
|
||||
private static final String PROPERTY = "PROPERTY"; //$NON-NLS-1$
|
||||
|
||||
public HadoopPropertiesTableView(HadoopPropertiesFieldModel model, Composite parent, int styleChild) {
|
||||
this(model, parent, styleChild, false);
|
||||
public HadoopPropertiesTableView(Composite parent, HadoopPropertiesFieldModel model) {
|
||||
super(parent, SWT.NONE, model, false, true, false);
|
||||
}
|
||||
|
||||
public HadoopPropertiesTableView(HadoopPropertiesFieldModel model, Composite parent, int styleChild, boolean showDbTypeColumn) {
|
||||
super(parent, styleChild, model);
|
||||
}
|
||||
|
||||
public HadoopPropertiesTableView(HadoopPropertiesFieldModel model, Composite parent) {
|
||||
this(model, parent, SWT.NONE, false);
|
||||
public HadoopPropertiesTableView(Composite parent, HadoopPropertiesFieldModel model, boolean labelVisible) {
|
||||
super(parent, SWT.NONE, model, false, true, labelVisible);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleBeforeListenableListOperationEvent(ListenableListEvent<HashMap<String, Object>> event) {
|
||||
protected void handleBeforeListenableListOperationEvent(ListenableListEvent<Map<String, Object>> event) {
|
||||
super.handleBeforeListenableListOperationEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleAfterListenableListOperationEvent(ListenableListEvent<HashMap<String, Object>> event) {
|
||||
protected void handleAfterListenableListOperationEvent(ListenableListEvent<Map<String, Object>> event) {
|
||||
super.handleAfterListenableListOperationEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setTableViewerCreatorOptions(TableViewerCreator<HashMap<String, Object>> newTableViewerCreator) {
|
||||
protected void setTableViewerCreatorOptions(TableViewerCreator<Map<String, Object>> newTableViewerCreator) {
|
||||
super.setTableViewerCreatorOptions(newTableViewerCreator);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createColumns(TableViewerCreator<HashMap<String, Object>> tableViewerCreator, Table table) {
|
||||
protected void createColumns(TableViewerCreator<Map<String, Object>> tableViewerCreator, Table table) {
|
||||
createKeyColumn(tableViewerCreator);
|
||||
createValueColumn(tableViewerCreator);
|
||||
}
|
||||
|
||||
private TableViewerCreatorColumn createValueColumn(TableViewerCreator<HashMap<String, Object>> tableViewerCreator) {
|
||||
private TableViewerCreatorColumn createValueColumn(TableViewerCreator<Map<String, Object>> tableViewerCreator) {
|
||||
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
|
||||
column.setTitle("Value"); //$NON-NLS-1$
|
||||
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<HashMap<String, Object>, String>() {
|
||||
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Map<String, Object>, String>() {
|
||||
|
||||
public String get(HashMap<String, Object> bean) {
|
||||
public String get(Map<String, Object> bean) {
|
||||
return (String) bean.get(VALUE);
|
||||
}
|
||||
|
||||
public void set(HashMap<String, Object> bean, String value) {
|
||||
public void set(Map<String, Object> bean, String value) {
|
||||
bean.put(VALUE, value);
|
||||
}
|
||||
|
||||
@@ -95,17 +90,17 @@ public class HadoopPropertiesTableView extends AbstractDataTableEditorView<HashM
|
||||
return column;
|
||||
}
|
||||
|
||||
private TableViewerCreatorColumn createKeyColumn(TableViewerCreator<HashMap<String, Object>> tableViewerCreator) {
|
||||
private TableViewerCreatorColumn createKeyColumn(TableViewerCreator<Map<String, Object>> tableViewerCreator) {
|
||||
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
|
||||
column.setTitle("Property"); //$NON-NLS-1$
|
||||
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<HashMap<String, Object>, String>() {
|
||||
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Map<String, Object>, String>() {
|
||||
|
||||
public String get(HashMap<String, Object> bean) {
|
||||
public String get(Map<String, Object> bean) {
|
||||
return (String) bean.get(PROPERTY);
|
||||
|
||||
}
|
||||
|
||||
public void set(HashMap<String, Object> bean, String value) {
|
||||
public void set(Map<String, Object> bean, String value) {
|
||||
bean.put(PROPERTY, value);
|
||||
}
|
||||
|
||||
@@ -133,7 +128,7 @@ public class HadoopPropertiesTableView extends AbstractDataTableEditorView<HashM
|
||||
|
||||
@Override
|
||||
protected Object getObjectToAdd() {
|
||||
HashMap<String, Object> hpt = getModel().createHadoopPropertiesType();
|
||||
Map<String, Object> hpt = getModel().createHadoopPropertiesType();
|
||||
hpt.put(PROPERTY, "new line");
|
||||
hpt.put(VALUE, "");
|
||||
return hpt;
|
||||
@@ -151,13 +146,13 @@ public class HadoopPropertiesTableView extends AbstractDataTableEditorView<HashM
|
||||
return new ExtendedTablePasteCommand(extendedTableModel, indexWhereInsert) {
|
||||
|
||||
@Override
|
||||
public List<HashMap<String, Object>> createPastableBeansList(ExtendedTableModel extendedTableModel,
|
||||
public List<Map<String, Object>> createPastableBeansList(ExtendedTableModel extendedTableModel,
|
||||
List copiedObjectsList) {
|
||||
List list = new ArrayList();
|
||||
HadoopPropertiesFieldModel fieldsModel = (HadoopPropertiesFieldModel) extendedTableModel;
|
||||
for (Object current : copiedObjectsList) {
|
||||
if (current instanceof HashMap) {
|
||||
Map<String, Object> original = (HashMap<String, Object>) current;
|
||||
if (current instanceof Map) {
|
||||
Map<String, Object> original = (Map<String, Object>) current;
|
||||
Map<String, Object> copy = fieldsModel.createHadoopPropertiesType();
|
||||
copy.putAll(original);
|
||||
list.add(copy);
|
||||
|
||||
@@ -15,26 +15,25 @@ package org.talend.commons.ui.swt.extended.table;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
|
||||
public class HadoopPropertiesFieldModel extends ExtendedTableModel<HashMap<String, Object>> {
|
||||
public class HadoopPropertiesFieldModel extends ExtendedTableModel<Map<String, Object>> {
|
||||
|
||||
public HadoopPropertiesFieldModel(String name) {
|
||||
super(name);
|
||||
setProperties(new ArrayList<HashMap<String, Object>>());
|
||||
setProperties(new ArrayList<Map<String, Object>>());
|
||||
}
|
||||
|
||||
public HadoopPropertiesFieldModel(List<HashMap<String, Object>> conditionTypeList, String name) {
|
||||
public HadoopPropertiesFieldModel(List<Map<String, Object>> propertiesTypeList, String name) {
|
||||
super(name);
|
||||
setProperties(conditionTypeList);
|
||||
setProperties(propertiesTypeList);
|
||||
}
|
||||
|
||||
public void setProperties(List<HashMap<String, Object>> properties) {
|
||||
registerDataList((List<HashMap<String, Object>>) properties);
|
||||
public void setProperties(List<Map<String, Object>> properties) {
|
||||
registerDataList(properties);
|
||||
}
|
||||
|
||||
public HashMap<String, Object> createHadoopPropertiesType() {
|
||||
public Map<String, Object> createHadoopPropertiesType() {
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<extension-point id="repositorySeeker" name="Repository Seeker" schema="schema/repositorySeeker.exsd"/>
|
||||
<extension-point id="extended_repositorynode_handler" name="Extended Repository Node Handler" schema="schema/extended_repositorynode_handler.exsd"/>
|
||||
<extension-point id="repository_review_filter" name="repository_review_filter" schema="schema/repository_review_filter.exsd"/>
|
||||
<extension-point id="repository_context" name="Repository_context" schema="schema/repository_context.exsd"/>
|
||||
|
||||
<extension
|
||||
point="org.talend.core.runtime.service">
|
||||
@@ -462,6 +463,11 @@
|
||||
clazz="org.talend.core.model.properties.SalesforceSchemaConnectionItem">
|
||||
</Item>
|
||||
</RepositoryComponent>
|
||||
<DragAndDropFilter
|
||||
clazz="org.talend.core.repository.model.dnd.SalesforceComponentDndFilter"
|
||||
id="org.talend.core.repository.SalesforceComponentDndFilter"
|
||||
name="Salesforce DnD Filter">
|
||||
</DragAndDropFilter>
|
||||
<RepositoryComponent
|
||||
name="SAS"
|
||||
withSchema="true"
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.talend.core.repository" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.talend.core.repository" id="repository_context" name="repository_context"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="RepositoryContext" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</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="RepositoryContext">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.talend.repository.ui.utils.IRepositoryContextHandler"/>
|
||||
</appinfo>
|
||||
</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>
|
||||
@@ -0,0 +1,106 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2015 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.repository.model.dnd;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.SalesforceSchemaConnectionItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.DefaultRepositoryComponentDndFilter;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
|
||||
/**
|
||||
* created by cmeng on Apr 21, 2015 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class SalesforceComponentDndFilter extends DefaultRepositoryComponentDndFilter {
|
||||
|
||||
public static final String COMPONENT_T_SALSEFORCE_CONNECTION = "tSalesforceConnection"; //$NON-NLS-1$
|
||||
|
||||
public static final String COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC = "tSalesforceWaveBulkExec"; //$NON-NLS-1$
|
||||
|
||||
public static final String COMPONENT_T_SALSEFORCE_WAVE_OUTPUT_BULK_EXEC = "tSalesforceWaveOutputBulkExec"; //$NON-NLS-1$
|
||||
|
||||
public static final String COMPONENT_T_SALSEFORCE_INPUT = "tSalesforceInput"; //$NON-NLS-1$
|
||||
|
||||
public static final String COMPONENT_T_SALSEFORCE_OUTPUT = "tSalesforceOutput"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public boolean except(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component,
|
||||
String repositoryType) {
|
||||
if (!(item instanceof SalesforceSchemaConnectionItem)) {
|
||||
return false;
|
||||
}
|
||||
if (ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA == type) {
|
||||
String componentName = component.getName();
|
||||
if (COMPONENT_T_SALSEFORCE_INPUT.equals(componentName) || COMPONENT_T_SALSEFORCE_OUTPUT.equals(componentName)) {
|
||||
return true;
|
||||
}
|
||||
} else if (ERepositoryObjectType.METADATA_SALESFORCE_MODULE == type || ERepositoryObjectType.METADATA_CON_TABLE == type
|
||||
|| ERepositoryObjectType.METADATA_CON_COLUMN == type) {
|
||||
String componentName = component.getName();
|
||||
if (COMPONENT_T_SALSEFORCE_CONNECTION.equals(componentName)
|
||||
|| COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC.equals(componentName)
|
||||
|| COMPONENT_T_SALSEFORCE_WAVE_OUTPUT_BULK_EXEC.equals(componentName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component,
|
||||
String repositoryType) {
|
||||
if (!(item instanceof SalesforceSchemaConnectionItem)) {
|
||||
return false;
|
||||
}
|
||||
if (ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA == type) {
|
||||
String componentName = component.getName();
|
||||
if (COMPONENT_T_SALSEFORCE_CONNECTION.equals(componentName)
|
||||
|| COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC.equals(componentName)
|
||||
|| COMPONENT_T_SALSEFORCE_WAVE_OUTPUT_BULK_EXEC.equals(componentName)) {
|
||||
return true;
|
||||
}
|
||||
} else if (ERepositoryObjectType.METADATA_SALESFORCE_MODULE == type || ERepositoryObjectType.METADATA_CON_TABLE == type
|
||||
|| ERepositoryObjectType.METADATA_CON_COLUMN == type) {
|
||||
String componentName = component.getName();
|
||||
if (COMPONENT_T_SALSEFORCE_INPUT.equals(componentName) || COMPONENT_T_SALSEFORCE_OUTPUT.equals(componentName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IComponent> sort(List<IComponent> components, Item item, ERepositoryObjectType type, RepositoryNode seletetedNode) {
|
||||
if (item instanceof SalesforceSchemaConnectionItem) {
|
||||
if (ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA == type && components != null) {
|
||||
Iterator<IComponent> iter = components.iterator();
|
||||
while (iter.hasNext()) {
|
||||
IComponent component = iter.next();
|
||||
if (COMPONENT_T_SALSEFORCE_CONNECTION.equals(component.getName())) {
|
||||
iter.remove();
|
||||
components.add(0, component);
|
||||
return components;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return components;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -91,6 +91,8 @@ import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.designer.business.diagram.custom.IDiagramModelService;
|
||||
import org.talend.designer.core.ICamelDesignerCoreService;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.expressionbuilder.ExpressionPersistance;
|
||||
@@ -178,8 +180,10 @@ public class DeleteAction extends AContextualAction {
|
||||
}
|
||||
final List<ItemReferenceBean> unDeleteItems = RepositoryNodeDeleteManager.getInstance().getUnDeleteItems(
|
||||
selectNodes, deleteActionCache);
|
||||
List<RepositoryNode> accessNodes = new ArrayList<RepositoryNode>();
|
||||
for (RepositoryNode node : selectNodes) {
|
||||
try {
|
||||
accessNodes.add(node);
|
||||
// ADD xqliu 2012-05-24 TDQ-4831
|
||||
if (sourceFileOpening(node)) {
|
||||
continue;
|
||||
@@ -242,7 +246,12 @@ public class DeleteAction extends AContextualAction {
|
||||
needToUpdataPalette = true;
|
||||
}
|
||||
if (needReturn) {
|
||||
return;
|
||||
// TDI-31623: Access the rest nodes in select nodes if current node's delete has pb
|
||||
if (accessNodes.containsAll(selectNodes)) {
|
||||
return;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
types.add(node.getObjectType());
|
||||
|
||||
@@ -831,7 +840,8 @@ public class DeleteAction extends AContextualAction {
|
||||
if (item == item2) {
|
||||
continue;
|
||||
}
|
||||
List<IContext> contextList = null;
|
||||
List<IContextParameter> openedContextParameterList = null;
|
||||
List<ContextParameterType> closedContextParameterList = null;
|
||||
String contextID = null;
|
||||
// if (!isOpenedItem(item2, deleteActionCache.getOpenProcessMap())) {
|
||||
// The following logic is added by Marvin Wang on Sep. 14, 2012 for bug TDI-21878.
|
||||
@@ -844,7 +854,10 @@ public class DeleteAction extends AContextualAction {
|
||||
for (IProcess2 tempPro : openedProcesses) {
|
||||
if (process.getId().equals(tempPro.getId())) {
|
||||
isOpenedProcess = true;
|
||||
contextList = tempPro.getContextManager().getListContext();
|
||||
List<IContext> contextList = tempPro.getContextManager().getListContext();
|
||||
if(contextList != null && !contextList.isEmpty()) {
|
||||
openedContextParameterList = contextList.get(0).getContextParameterList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -857,42 +870,60 @@ public class DeleteAction extends AContextualAction {
|
||||
// loading file. That is why it can not use the method to get IProcess directly without
|
||||
// checking if "process" is opened.
|
||||
if (!isOpenedProcess) {
|
||||
if (item2 instanceof ProcessItem) {
|
||||
contextList = service.getProcessFromProcessItem((ProcessItem) item2).getContextManager()
|
||||
.getListContext();
|
||||
if (item2 instanceof ConnectionItem) {
|
||||
contextID = ((ConnectionItem) item2).getConnection().getContextId();
|
||||
} else {
|
||||
List<?> contextList = null;
|
||||
if (item2 instanceof ProcessItem) {
|
||||
// contextList = service.getProcessFromProcessItem((ProcessItem) item2).getContextManager().getListContext();
|
||||
contextList = ((ProcessItem) item2).getProcess().getContext();
|
||||
} else if (item2 instanceof JobletProcessItem) {
|
||||
// contextList = service.getProcessFromJobletProcessItem((JobletProcessItem)item2).getContextManager().getListContext();
|
||||
contextList = ((JobletProcessItem) item2).getJobletProcess().getContext();
|
||||
}
|
||||
if (contextList != null && !contextList.isEmpty()) {
|
||||
Object obj = contextList.get(0);
|
||||
if (obj instanceof ContextType) {
|
||||
closedContextParameterList = ((ContextType) obj).getContextParameter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (item2 instanceof JobletProcessItem) {
|
||||
contextList = service.getProcessFromJobletProcessItem((JobletProcessItem) item2)
|
||||
.getContextManager().getListContext();
|
||||
} else if (item2 instanceof ConnectionItem) {
|
||||
contextID = ((ConnectionItem) item2).getConnection().getContextId();
|
||||
|
||||
List<?> contextParameterList = null;
|
||||
if (openedContextParameterList != null) {
|
||||
contextParameterList = openedContextParameterList;
|
||||
} else if (closedContextParameterList != null) {
|
||||
contextParameterList = closedContextParameterList;
|
||||
}
|
||||
if (contextList != null) {
|
||||
if (contextParameterList != null && contextParameterList.size() > 0) {
|
||||
// Added by Marvin Wang on Sep.14, 2012 for bug TDI-21878. It just needs to check the
|
||||
// first IContext, normally it is named "default". In order to add the different version
|
||||
// jobs to ContextReferenceBean, below uses
|
||||
// "RepositoryReferenceBeanUtils.hasReferenceBean" to filter the repeat object.
|
||||
List<IContextParameter> contextParams = contextList.get(0).getContextParameterList();
|
||||
if (contextParams != null && contextParams.size() > 0) {
|
||||
for (IContextParameter contextParameter : contextParams) {
|
||||
if (contextParameter.isBuiltIn()) {
|
||||
continue;
|
||||
}
|
||||
String contextId = item.getProperty().getId();
|
||||
String sourceId = contextParameter.getSource();
|
||||
if (contextId != null && contextId.equals(sourceId)) {
|
||||
String processName = process.getLabel();
|
||||
String processVersion = process.getVersion();
|
||||
if (!RepositoryReferenceBeanUtils.hasReferenceBean(list, processName, processVersion)) {
|
||||
String path = item2.getState().getPath();
|
||||
String type = process.getRepositoryObjectType().getType();
|
||||
ContextReferenceBean bean = new ContextReferenceBean(property2.getLabel(), type,
|
||||
property2.getVersion(), path, refP.getLabel());
|
||||
bean.setJobFlag(isJob, isDelete);
|
||||
list.add(bean);
|
||||
}
|
||||
|
||||
// List<IContextParameter> contextParams = contextList.get(0).getContextParameterList();
|
||||
for (int i = 0; i < contextParameterList.size(); i++) {
|
||||
String sourceId = null;
|
||||
Object objContextParameter = contextParameterList.get(i);
|
||||
if (objContextParameter instanceof IContextParameter) {
|
||||
IContextParameter contextParameter = (IContextParameter) objContextParameter;
|
||||
sourceId = contextParameter.getSource();
|
||||
} else if (objContextParameter instanceof ContextParameterType) {
|
||||
ContextParameterType contextParameter = (ContextParameterType) objContextParameter;
|
||||
sourceId = contextParameter.getRepositoryContextId();
|
||||
}
|
||||
String contextId = item.getProperty().getId();
|
||||
if (contextId != null && contextId.equals(sourceId)) {
|
||||
String processName = process.getLabel();
|
||||
String processVersion = process.getVersion();
|
||||
if (!RepositoryReferenceBeanUtils.hasReferenceBean(list, processName, processVersion)) {
|
||||
String path = item2.getState().getPath();
|
||||
String type = process.getRepositoryObjectType().getType();
|
||||
ContextReferenceBean bean = new ContextReferenceBean(property2.getLabel(), type,
|
||||
property2.getVersion(), path, refP.getLabel());
|
||||
bean.setJobFlag(isJob, isDelete);
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,6 +417,10 @@ public class DuplicateAction extends AContextualAction {
|
||||
item = PropertiesFactory.eINSTANCE.createValidationRulesConnectionItem();
|
||||
} else if (repositoryType == ERepositoryObjectType.METADATA_HEADER_FOOTER) {
|
||||
item = PropertiesFactory.eINSTANCE.createHeaderFooterConnectionItem();
|
||||
} else if (repositoryType == ERepositoryObjectType.METADATA_FILE_BRMS) {
|
||||
item = PropertiesFactory.eINSTANCE.createBRMSConnectionItem();
|
||||
} else if (repositoryType == ERepositoryObjectType.METADATA_FILE_FTP) {
|
||||
item = PropertiesFactory.eINSTANCE.createFTPConnectionItem();
|
||||
}
|
||||
if (item == null) {
|
||||
for (IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
|
||||
|
||||
@@ -170,6 +170,14 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
}
|
||||
return label;
|
||||
}
|
||||
if (repositoryObjectType == ERepositoryObjectType.JOB_DOC || repositoryObjectType == ERepositoryObjectType.JOBLET_DOC
|
||||
|| repositoryObjectType == ERepositoryObjectType.valueOf(ERepositoryObjectType.class, "ROUTE_DOC")) {
|
||||
// TDI-31655:documention node need to update property for its structure to get the correct text
|
||||
object.getProperty();
|
||||
if (object.isModified()) {
|
||||
label = "> "; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
label = label + getText(object);
|
||||
if (!mainProject.getLabel().equals(projectLabel) && PluginChecker.isRefProjectLoaded()) {
|
||||
IReferencedProjectService service = (IReferencedProjectService) GlobalServiceRegister.getDefault().getService(
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<dbType type="SMALLINT" ignorePre="true" />
|
||||
<dbType type="SMALLINT UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="SET" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TEXT" ignorePre="true" />
|
||||
<dbType type="TEXT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIME" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TINYBLOB" ignoreLen="true" ignorePre="true" />
|
||||
@@ -124,6 +124,7 @@
|
||||
<dbType type="MEDIUMTEXT" />
|
||||
<dbType type="MULTILINESTRING" />
|
||||
<dbType type="TEXT" />
|
||||
<dbType type="TINYTEXT" />
|
||||
</talendType>
|
||||
</talendToDbTypes>
|
||||
<dbToTalendTypes>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<dbType type="TIME" ignorePre="true" />
|
||||
<dbType type="TINTERVAL" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIMESTAMPTZ" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIMESTAMP" ignorePre="true" />
|
||||
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIMETZ" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="VARBIT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="VARCHAR" defaultLength="200" ignorePre="true" />
|
||||
@@ -125,12 +125,12 @@
|
||||
<dbType type="TEXT" />
|
||||
</talendType>
|
||||
<talendType type="id_Date">
|
||||
<dbType type="DATE" default="true" />
|
||||
<dbType type="DATE" />
|
||||
<dbType type="ABSTIME" />
|
||||
<dbType type="TIMETZ" />
|
||||
<dbType type="TIME" />
|
||||
<dbType type="TIMESTAMPTZ" />
|
||||
<dbType type="TIMESTAMP" />
|
||||
<dbType type="TIMESTAMP" default="true"/>
|
||||
<dbType type="INTERVAL" />
|
||||
<dbType type="TINTERVAL" />
|
||||
<dbType type="RELTIME" />
|
||||
|
||||
@@ -58,13 +58,13 @@
|
||||
|
||||
</talendType>
|
||||
<talendType type="id_Byte">
|
||||
<dbType type="BF" default="true"/>
|
||||
<dbType type="BYTEINT" />
|
||||
<dbType type="BYTE" />
|
||||
<dbType type="BF"/>
|
||||
<dbType type="BYTEINT" default="true"/>
|
||||
<dbType type="BYTE"/>
|
||||
</talendType>
|
||||
<talendType type="id_byte[]">
|
||||
<dbType type="BF" default="true"/>
|
||||
<dbType type="VARBYTE"/>
|
||||
<dbType type="BF"/>
|
||||
<dbType type="VARBYTE" default="true"/>
|
||||
</talendType>
|
||||
<talendType type="id_Character">
|
||||
<dbType type="BYTE" />
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"NAMENODE_PRINCIPAL": "nn/_HOST@EXAMPLE.COM",
|
||||
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
|
||||
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
|
||||
"JOBHISTORY_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
|
||||
"HIVE": {
|
||||
"EMBEDDED": {
|
||||
"PORT": 9083
|
||||
@@ -27,6 +28,7 @@
|
||||
"NAMENODE_PRINCIPAL": "hdfs/_HOST@EXAMPLE.COM",
|
||||
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
|
||||
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
|
||||
"JOBHISTORY_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
|
||||
"HIVE": {
|
||||
"EMBEDDED": {
|
||||
"PORT": 9083
|
||||
@@ -122,6 +124,7 @@
|
||||
"NAMENODE_PRINCIPAL": "nn/_HOST@EXAMPLE.COM",
|
||||
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
|
||||
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
|
||||
"JOBHISTORY_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
|
||||
"HIVE": {
|
||||
"EMBEDDED": {
|
||||
"PORT": 9083
|
||||
|
||||
@@ -66,6 +66,16 @@
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="parent" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
The parent classloader index of the classloader.
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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;
|
||||
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
|
||||
/**
|
||||
* created by ldong on Mar 5, 2015 Detailled comment
|
||||
*
|
||||
*/
|
||||
public interface IRepositoryContextUpdateService extends IService {
|
||||
|
||||
public void updateRelatedContextVariableName(Connection con, String oldName, String newName);
|
||||
}
|
||||
@@ -15,11 +15,11 @@ package org.talend.core.classloader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
@@ -57,6 +57,8 @@ public class ClassLoaderFactory {
|
||||
|
||||
private final static String LIB_ATTR = "libraries"; //$NON-NLS-1$
|
||||
|
||||
private final static String PARENT_ATTR = "parent"; //$NON-NLS-1$
|
||||
|
||||
static {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
|
||||
@@ -149,17 +151,27 @@ public class ClassLoaderFactory {
|
||||
if (tmpFolder.exists()) {
|
||||
FilesUtils.removeFolder(tmpFolder, true);
|
||||
}
|
||||
classLoadersMap = new HashMap<String, DynamicClassLoader>();
|
||||
classLoadersMap = new ConcurrentHashMap<String, DynamicClassLoader>();
|
||||
}
|
||||
|
||||
private static DynamicClassLoader findLoader(String index, boolean showDownloadIfNotExist) {
|
||||
private static synchronized DynamicClassLoader findLoader(String index, boolean showDownloadIfNotExist) {
|
||||
if (index != null && configurationElements != null) {
|
||||
for (IConfigurationElement current : configurationElements) {
|
||||
String key = current.getAttribute(INDEX_ATTR);
|
||||
if (index.equals(key)) {
|
||||
String libraries = current.getAttribute(LIB_ATTR);
|
||||
if (StringUtils.isNotEmpty(index)) {
|
||||
DynamicClassLoader classLoader = new DynamicClassLoader();
|
||||
DynamicClassLoader classLoader = null;
|
||||
DynamicClassLoader parentClassLoader = null;
|
||||
String parentKey = current.getAttribute(PARENT_ATTR);
|
||||
if (StringUtils.isNotEmpty(parentKey)) {
|
||||
parentClassLoader = getClassLoader(parentKey, showDownloadIfNotExist);
|
||||
}
|
||||
if (parentClassLoader == null) {
|
||||
classLoader = new DynamicClassLoader();
|
||||
} else {
|
||||
classLoader = new DynamicClassLoader(parentClassLoader);
|
||||
}
|
||||
boolean putInCache = true;
|
||||
if (StringUtils.isNotEmpty(libraries)) {
|
||||
String[] librariesArray = libraries.split(SEPARATOR);
|
||||
@@ -247,7 +259,7 @@ public class ClassLoaderFactory {
|
||||
String hiveModel = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
|
||||
if (HiveConnUtils.isCustomDistro(distroKey)) {
|
||||
String jarsStr = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
|
||||
moduleList = jarsStr.split(";");
|
||||
moduleList = jarsStr.split(";"); //$NON-NLS-1$
|
||||
} else {
|
||||
String index = "HIVE" + ":" + distroKey + ":" + distroVersion + ":" + hiveModel; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
moduleList = getDriverModuleList(index);
|
||||
|
||||
@@ -48,6 +48,14 @@ public class DynamicClassLoader extends URLClassLoader {
|
||||
super(urls);
|
||||
}
|
||||
|
||||
public DynamicClassLoader(ClassLoader parent) {
|
||||
this(new URL[0], parent);
|
||||
}
|
||||
|
||||
public DynamicClassLoader(URL[] urls, ClassLoader parent) {
|
||||
super(urls, parent);
|
||||
}
|
||||
|
||||
public void addLibrary(String lib) {
|
||||
if (lib != null) {
|
||||
File libFile = new File(lib);
|
||||
|
||||
@@ -50,10 +50,18 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_USE_KRB = "CONN_PARA_KEY_USE_KRB"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_USEKEYTAB = "CONN_PARA_KEY_USEKEYTAB";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_KEYTAB_PRINCIPAL = "CONN_PARA_KEY_KEYTAB_PRINCIPLA";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_KEYTAB = "CONN_PARA_KEY_KEYTAB";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_NAME_NODE_PRINCIPAL = "CONN_PARA_KEY_NAME_NODE_PRINCIPAL"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_JOB_TRACKER_PRINCIPAL = "CONN_PARA_KEY_JOB_TRACKER_PRINCIPAL"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_JOB_HISTORY_PRINCIPAL = "CONN_PARA_KEY_JOB_HISTORY_PRINCIPAL"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_USERNAME = "CONN_PARA_KEY_USERNAME"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
@@ -81,6 +89,8 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_PROPERTIES = "CONN_PARA_KEY_HIVE_PROPERTIES"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_JDBC_PROPERTIES = "CONN_PARA_KEY_HIVE_JDBC_PROPERTIES"; //$NON-NLS-1$
|
||||
|
||||
public static final String HIVE_AUTHENTICATION_HIVEPRINCIPLA = "HIVE_AUTHENTICATION_HIVEPRINCIPLA";//$NON-NLS-1$
|
||||
|
||||
public static final String HIVE_AUTHENTICATION_METASTOREURL = "HIVE_AUTHENTICATION_METASTOREURL";//$NON-NLS-1$
|
||||
@@ -93,12 +103,6 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String HIVE_AUTHENTICATION_PASSWORD = "HIVE_AUTHENTICATION_PASSWORD";//$NON-NLS-1$
|
||||
|
||||
public static final String HIVE_AUTHENTICATION_USEKEYTAB = "HIVE_AUTHENTICATION_USEKEYTAB";//$NON-NLS-1$
|
||||
|
||||
public static final String HIVE_AUTHENTICATION_PRINCIPLA = "HIVE_AUTHENTICATION_PRINCIPLA";//$NON-NLS-1$
|
||||
|
||||
public static final String HIVE_AUTHENTICATION_KEYTAB = "HIVE_AUTHENTICATION_KEYTAB";//$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The key is for metastore server.
|
||||
*/
|
||||
@@ -143,6 +147,10 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_HBASE_PROPERTIES = "CONN_PARA_KEY_HBASE_PROPERTIES"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HBASE_AUTHENTICATION_MASTERPRINCIPAL = "CONN_PARA_KEY_HBASE_AUTHENTICATION_MASTERPRINCIPAL";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HBASE_AUTHENTICATION_REGIONSERVERPRINCIPAL = "CONN_PARA_KEY_HBASE_AUTHENTICATION_REGIONSERVERPRINCIPAL";//$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Impala keys.
|
||||
*/
|
||||
|
||||
@@ -152,6 +152,12 @@ public enum EDatabaseVersion4Drivers {
|
||||
"slf4j-log4j12-1.6.1.jar", "hive-exec-0.12.0-cdh5.0.4.jar", "httpcore-4.2.5.jar", "httpclient-4.2.5.jar",
|
||||
"hadoop-core-1.0.0.jar" })),
|
||||
|
||||
IMPALA_CDH5_4(new DbVersion4Drivers(EDatabaseTypeName.IMPALA, "Cloudera 5.4", "Cloudera_CDH5_4", new String[] {
|
||||
"hive-metastore-1.1.0-cdh5.4.0.jar", "hive-jdbc-1.1.0-cdh5.4.0.jar", "hive-service-1.1.0-cdh5.4.0.jar",
|
||||
"hive-common-1.1.0-cdh5.4.0.jar", "libthrift-0.9.2.jar", "libfb303-0.9.2.jar", "hadoop-common-2.6.0-cdh5.4.0.jar",
|
||||
"httpcore-4.2.5.jar", "httpclient-4.2.5.jar", "commons-logging-1.1.3.jar", "slf4j-api-1.7.5.jar",
|
||||
"slf4j-log4j12-1.7.5.jar", "log4j-1.2.17.jar", "guava-11.0.2.jar" })),
|
||||
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "paraccel-jdbc.jar")); //$NON-NLS-1$
|
||||
|
||||
private DbVersion4Drivers dbVersionBean;
|
||||
|
||||
@@ -17,6 +17,8 @@ import java.util.List;
|
||||
|
||||
public enum EImpalaDistribution4Versions {
|
||||
|
||||
CLOUDERA_CDH5_4(EImpalaDistributions.CLOUDERA, "Cloudera CDH5.4", EDatabaseVersion4Drivers.IMPALA_CDH5_4.getVersionValue()),
|
||||
|
||||
CLOUDERA_CDH5_1(EImpalaDistributions.CLOUDERA, "Cloudera CDH5.1", EDatabaseVersion4Drivers.IMPALA_CDH5.getVersionValue()),
|
||||
|
||||
CUSTOM(EImpalaDistributions.CUSTOM, "", "");
|
||||
|
||||
@@ -21,6 +21,9 @@ import org.talend.core.hadoop.version.EHadoopVersion4Drivers;
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public enum EHBaseDistribution4Versions {
|
||||
HDP_2_2(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_2_2.getVersionDisplay(), EHadoopVersion4Drivers.HDP_2_2
|
||||
.getVersionValue()),
|
||||
|
||||
HDP_2_1(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_2_1.getVersionDisplay(), EHadoopVersion4Drivers.HDP_2_1
|
||||
.getVersionValue()),
|
||||
|
||||
@@ -56,6 +59,11 @@ public enum EHBaseDistribution4Versions {
|
||||
EHadoopVersion4Drivers.APACHE_1_0_0.getVersionDisplay(),
|
||||
EHadoopVersion4Drivers.APACHE_1_0_0.getVersionValue()),
|
||||
|
||||
CLOUDERA_CDH5_4(
|
||||
EHBaseDistributions.CLOUDERA,
|
||||
EHadoopVersion4Drivers.CLOUDERA_CDH5_4.getVersionDisplay(),
|
||||
EHadoopVersion4Drivers.CLOUDERA_CDH5_4.getVersionValue()),
|
||||
|
||||
CLOUDERA_CDH5_1(
|
||||
EHBaseDistributions.CLOUDERA,
|
||||
EHadoopVersion4Drivers.CLOUDERA_CDH5_1.getVersionDisplay(),
|
||||
|
||||
@@ -26,6 +26,8 @@ public enum EHadoopConfigurationJars {
|
||||
|
||||
HIVE(new String[] { "hadoop-conf.jar" }, new String[] { "hadoop-conf-kerberos.jar" }), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
HBASE(new String[] { "hadoop-conf.jar" }, new String[] { "hadoop-conf-kerberos.jar" }), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
;
|
||||
|
||||
private String[] disableSecurityJars;
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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.hadoop;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.classloader.ClassLoaderFactory;
|
||||
import org.talend.core.classloader.DynamicClassLoader;
|
||||
|
||||
/**
|
||||
*
|
||||
* created by ycbai on Aug 11, 2014 Detailled comment
|
||||
*
|
||||
* <p>
|
||||
* TODO: Need to improve it and replace {@link HadoopClassLoaderFactory} with it after.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public class HadoopClassLoaderFactory2 {
|
||||
|
||||
public static ClassLoader getHDFSClassLoader(String distribution, String version, boolean useKrb) {
|
||||
return getClassLoader(EHadoopCategory.HDFS, distribution, version, useKrb);
|
||||
}
|
||||
|
||||
public static ClassLoader getMRClassLoader(String distribution, String version, boolean useKrb) {
|
||||
return getClassLoader(EHadoopCategory.MAP_REDUCE, distribution, version, useKrb);
|
||||
}
|
||||
|
||||
public static ClassLoader getHiveEmbeddedClassLoader(String distribution, String version, boolean useKrb) {
|
||||
return getClassLoader(EHadoopCategory.HIVE, distribution, version, useKrb, IHadoopArgs.HIVE_ARG_EMBEDDED);
|
||||
}
|
||||
|
||||
public static ClassLoader getHiveStandaloneClassLoader(String distribution, String version, boolean useKrb) {
|
||||
return getClassLoader(EHadoopCategory.HIVE, distribution, version, useKrb, IHadoopArgs.HIVE_ARG_STANDALONE);
|
||||
}
|
||||
|
||||
public static ClassLoader getHBaseClassLoader(String distribution, String version, boolean useKrb) {
|
||||
return getClassLoader(EHadoopCategory.HBASE, distribution, version, useKrb);
|
||||
}
|
||||
|
||||
public static ClassLoader getHadoopCustomClassLoader(String uid, Object customJars) {
|
||||
return HadoopClassLoaderFactory2.builder().withTypePrefix(EHadoopCategory.CUSTOM.getName()).withUid(uid)
|
||||
.build(customJars, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "builder".
|
||||
*
|
||||
* <p>
|
||||
* Build the classloader with some options.
|
||||
* <p>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static HadoopClassLoaderFactory2.Builder builder() {
|
||||
return new HadoopClassLoaderFactory2.Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* created by ycbai on Aug 11, 2014 Detailled comment
|
||||
*
|
||||
*/
|
||||
public static class Builder {
|
||||
|
||||
private static final String INDEX_SEP = ":"; //$NON-NLS-1$
|
||||
|
||||
private StringBuffer indexBuffer = new StringBuffer();
|
||||
|
||||
public Builder withTypePrefix(String typePrefix) {
|
||||
withArg(typePrefix);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withDistribution(String distribution) {
|
||||
withArg(distribution);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withVersion(String version) {
|
||||
withArg(version);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withUid(String uid) {
|
||||
withArg(uid);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withArg(String arg) {
|
||||
indexBuffer.append(INDEX_SEP).append(arg);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClassLoader build() {
|
||||
return build(null, true);
|
||||
}
|
||||
|
||||
public ClassLoader build(boolean showDownloadIfNotExist) {
|
||||
return build(null, showDownloadIfNotExist);
|
||||
}
|
||||
|
||||
public ClassLoader build(Object extraArg, boolean showDownloadIfNotExist) {
|
||||
if (indexBuffer.length() > 0) { // Remove the first colon.
|
||||
indexBuffer.deleteCharAt(0);
|
||||
}
|
||||
return getClassLoader(indexBuffer.toString(), extraArg, showDownloadIfNotExist);
|
||||
}
|
||||
}
|
||||
|
||||
public static ClassLoader getClassLoader(EHadoopCategory category, String distribution, String version, boolean useKrb,
|
||||
String... extraArgs) {
|
||||
Builder builder = HadoopClassLoaderFactory2.builder().withTypePrefix(category.getName()).withDistribution(distribution)
|
||||
.withVersion(version);
|
||||
if (extraArgs != null && extraArgs.length > 0) {
|
||||
for (String arg : extraArgs) {
|
||||
builder.withArg(arg);
|
||||
}
|
||||
}
|
||||
ClassLoader classLoader = builder.build();
|
||||
if (classLoader instanceof DynamicClassLoader && useKrb) {
|
||||
classLoader = createSecurityLoader(category, (DynamicClassLoader) classLoader);
|
||||
}
|
||||
|
||||
return classLoader;
|
||||
}
|
||||
|
||||
private static ClassLoader getClassLoader(String index, Object extraJars, boolean showDownloadIfNotExist) {
|
||||
ClassLoader loader = null;
|
||||
if (index.startsWith(EHadoopCategory.CUSTOM.getName())) {
|
||||
loader = getCustomClassLoader(index, extraJars, showDownloadIfNotExist);
|
||||
} else {
|
||||
loader = ClassLoaderFactory.getClassLoader(index, showDownloadIfNotExist);
|
||||
}
|
||||
if (loader == null) {
|
||||
loader = HadoopClassLoaderFactory2.class.getClassLoader();
|
||||
}
|
||||
|
||||
return loader;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static ClassLoader getCustomClassLoader(String index, Object customJars, boolean showDownloadIfNotExist) {
|
||||
if (customJars instanceof Set) {
|
||||
return ClassLoaderFactory.getCustomClassLoader(index, (Set<String>) customJars);
|
||||
}
|
||||
|
||||
return ClassLoaderFactory.getCustomClassLoader(index, String.valueOf(customJars));
|
||||
}
|
||||
|
||||
private static DynamicClassLoader createSecurityLoader(EHadoopCategory category, DynamicClassLoader loader) {
|
||||
String[] securityJars;
|
||||
switch (category) {
|
||||
case HDFS:
|
||||
securityJars = EHadoopConfigurationJars.HDFS.getEnableSecurityJars();
|
||||
break;
|
||||
case MAP_REDUCE:
|
||||
securityJars = EHadoopConfigurationJars.MAP_REDUCE.getEnableSecurityJars();
|
||||
break;
|
||||
case HCATALOG:
|
||||
securityJars = EHadoopConfigurationJars.HCATALOG.getEnableSecurityJars();
|
||||
break;
|
||||
case HIVE:
|
||||
securityJars = EHadoopConfigurationJars.HIVE.getEnableSecurityJars();
|
||||
break;
|
||||
case HBASE:
|
||||
securityJars = EHadoopConfigurationJars.HBASE.getEnableSecurityJars();
|
||||
break;
|
||||
|
||||
default:
|
||||
securityJars = new String[0];
|
||||
break;
|
||||
}
|
||||
|
||||
DynamicClassLoader securityClassLoader = null;
|
||||
try {
|
||||
securityClassLoader = DynamicClassLoader.createNewOneBaseLoader(loader, securityJars, null);
|
||||
} catch (MalformedURLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
return securityClassLoader;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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.hadoop;
|
||||
|
||||
/**
|
||||
* created by ycbai on Aug 15, 2014 Detailled comment
|
||||
*
|
||||
*/
|
||||
public interface IHadoopArgs {
|
||||
|
||||
public static final String HIVE_ARG_EMBEDDED = "EMBEDDED"; //$NON-NLS-1$
|
||||
|
||||
public static final String HIVE_ARG_STANDALONE = "STANDALONE"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
@@ -192,4 +192,6 @@ public interface IHadoopClusterService extends IService {
|
||||
*/
|
||||
public boolean hasDiffsFromClusterToProcess(Item item, IProcess process);
|
||||
|
||||
public String getHadoopClusterProperties(Connection hadoopSubConnection);
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ public enum EHadoopProperties {
|
||||
|
||||
RESOURCE_MANAGER_PRINCIPAL,
|
||||
|
||||
JOBHISTORY_PRINCIPAL,
|
||||
|
||||
HIVE_PRINCIPAL,
|
||||
|
||||
DATABASE,
|
||||
|
||||
@@ -16,8 +16,13 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.utils.json.JSONArray;
|
||||
import org.talend.utils.json.JSONException;
|
||||
@@ -40,24 +45,29 @@ public class HadoopRepositoryUtil {
|
||||
* @return
|
||||
* @throws JSONException
|
||||
*/
|
||||
public static String getHadoopPropertiesJsonStr(List<HashMap<String, Object>> properties) throws JSONException {
|
||||
JSONArray jsonArr = new JSONArray();
|
||||
if (properties != null && properties.size() > 0) {
|
||||
for (HashMap<String, Object> map : properties) {
|
||||
JSONObject object = new JSONObject();
|
||||
Iterator<String> it = map.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
object.put(key, map.get(key));
|
||||
public static String getHadoopPropertiesJsonStr(List<Map<String, Object>> properties) {
|
||||
JSONArray jsonArr = null;
|
||||
try {
|
||||
jsonArr = new JSONArray();
|
||||
if (properties != null && properties.size() > 0) {
|
||||
for (Map<String, Object> map : properties) {
|
||||
JSONObject object = new JSONObject();
|
||||
Iterator<String> it = map.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
object.put(key, map.get(key));
|
||||
}
|
||||
jsonArr.put(object);
|
||||
}
|
||||
jsonArr.put(object);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
return jsonArr.toString();
|
||||
}
|
||||
|
||||
public static List<HashMap<String, Object>> getHadoopPropertiesList(String propertiesJsonStr) throws JSONException {
|
||||
public static List<Map<String, Object>> getHadoopPropertiesList(String propertiesJsonStr) {
|
||||
return getHadoopPropertiesList(propertiesJsonStr, false);
|
||||
}
|
||||
|
||||
@@ -73,26 +83,72 @@ public class HadoopRepositoryUtil {
|
||||
* @return
|
||||
* @throws JSONException
|
||||
*/
|
||||
public static List<HashMap<String, Object>> getHadoopPropertiesList(String propertiesJsonStr, boolean includeQuotes)
|
||||
throws JSONException {
|
||||
List<HashMap<String, Object>> properties = new ArrayList<HashMap<String, Object>>();
|
||||
if (StringUtils.isNotEmpty(propertiesJsonStr)) {
|
||||
JSONArray jsonArr = new JSONArray(propertiesJsonStr);
|
||||
for (int i = 0; i < jsonArr.length(); i++) {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
JSONObject object = jsonArr.getJSONObject(i);
|
||||
Iterator<String> it = object.keys();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
String value = String.valueOf(object.get(key));
|
||||
if (includeQuotes) {
|
||||
value = TalendQuoteUtils.addQuotesIfNotExist(value);
|
||||
} else {
|
||||
value = TalendQuoteUtils.removeQuotesIfExist(value);
|
||||
public static List<Map<String, Object>> getHadoopPropertiesList(String propertiesJsonStr, boolean includeQuotes) {
|
||||
List<Map<String, Object>> properties = new ArrayList<Map<String, Object>>();
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(propertiesJsonStr)) {
|
||||
JSONArray jsonArr = new JSONArray(propertiesJsonStr);
|
||||
for (int i = 0; i < jsonArr.length(); i++) {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
JSONObject object = jsonArr.getJSONObject(i);
|
||||
Iterator<String> it = object.keys();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
String value = String.valueOf(object.get(key));
|
||||
if (includeQuotes) {
|
||||
value = TalendQuoteUtils.addQuotesIfNotExist(value);
|
||||
} else {
|
||||
value = TalendQuoteUtils.removeQuotesIfExist(value);
|
||||
}
|
||||
map.put(key, value);
|
||||
}
|
||||
map.put(key, value);
|
||||
properties.add(map);
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getHadoopPropertiesFullList".
|
||||
*
|
||||
* <p>
|
||||
* Get the full list type of hadoop properties (with the parent properties of the hadoop cluster it belongs) from
|
||||
* json string.
|
||||
* </p>
|
||||
*
|
||||
* @param connection
|
||||
* @param propertiesJsonStr
|
||||
* @param includeQuotes
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> getHadoopPropertiesFullList(Connection connection, String propertiesJsonStr,
|
||||
boolean includeQuotes) {
|
||||
IHadoopClusterService hadoopClusterService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
|
||||
hadoopClusterService = (IHadoopClusterService) GlobalServiceRegister.getDefault().getService(
|
||||
IHadoopClusterService.class);
|
||||
}
|
||||
List<Map<String, Object>> parentProperties = null;
|
||||
if (hadoopClusterService != null) {
|
||||
parentProperties = getHadoopPropertiesList(hadoopClusterService.getHadoopClusterProperties(connection), true);
|
||||
}
|
||||
List<Map<String, Object>> properties = getHadoopPropertiesList(propertiesJsonStr, true);
|
||||
Map<String, Map<String, Object>> propertiesMap = new HashMap<String, Map<String, Object>>();
|
||||
for (Map<String, Object> proMap : properties) {
|
||||
String property = String.valueOf(proMap.get("PROPERTY")); //$NON-NLS-1$
|
||||
propertiesMap.put(property, proMap);
|
||||
}
|
||||
if (parentProperties != null) {
|
||||
for (Map<String, Object> parentProMap : parentProperties) {
|
||||
String property = String.valueOf(parentProMap.get("PROPERTY")); //$NON-NLS-1$
|
||||
if (!propertiesMap.containsKey(property)) {
|
||||
propertiesMap.put(property, parentProMap);
|
||||
properties.add(parentProMap);
|
||||
}
|
||||
properties.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,12 @@ import org.apache.commons.lang.ArrayUtils;
|
||||
*/
|
||||
public enum EHadoopVersion4Drivers {
|
||||
|
||||
HDP_2_2(EHadoopDistributions.HORTONWORKS, "Hortonworks Data Platform V2.2.0", //$NON-NLS-1$
|
||||
"HDP_2_2", //$NON-NLS-1$
|
||||
true,
|
||||
false,
|
||||
new EMRVersion[] { EMRVersion.YARN }),
|
||||
|
||||
HDP_2_1(EHadoopDistributions.HORTONWORKS, "Hortonworks Data Platform V2.1.0(Baikal)", //$NON-NLS-1$
|
||||
"HDP_2_1", //$NON-NLS-1$
|
||||
true,
|
||||
@@ -48,6 +54,12 @@ public enum EHadoopVersion4Drivers {
|
||||
|
||||
APACHE_0_20_2(EHadoopDistributions.APACHE, "Apache 0.20.2", "APACHE_0_20_2", false, true), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
CLOUDERA_CDH5_4(EHadoopDistributions.CLOUDERA, "Cloudera CDH5.4(YARN mode)", //$NON-NLS-1$
|
||||
"Cloudera_CDH5_4", //$NON-NLS-1$
|
||||
true,
|
||||
false,
|
||||
new EMRVersion[] { EMRVersion.YARN }),
|
||||
|
||||
CLOUDERA_CDH5_1(EHadoopDistributions.CLOUDERA, "Cloudera CDH5.1(YARN mode)", //$NON-NLS-1$
|
||||
"Cloudera_CDH5_1", //$NON-NLS-1$
|
||||
true,
|
||||
|
||||
@@ -148,6 +148,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
|
||||
super(parentShell);
|
||||
this.currentLibMap = currentLibMap;
|
||||
customLibUtil = new HadoopCustomLibrariesUtil();
|
||||
initLibMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -441,6 +442,22 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
|
||||
|
||||
private void init() {
|
||||
libsManager = CustomVersionLibsManager.getInstance();
|
||||
|
||||
// initLibMap();// move it to constructor
|
||||
ECustomVersionGroup selectedType = getSelectedType();
|
||||
if (selectedType != null) {
|
||||
selectLibFileSet = libMap.get(selectedType.getName());
|
||||
viewer.setInput(selectLibFileSet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the libMap.<br>
|
||||
* <b>NOTE:</b><br>
|
||||
* 1. Can call this method when currentLibMap is changed;<br>
|
||||
* 2. This method will be called automatically in the constructor.
|
||||
*/
|
||||
public void initLibMap() {
|
||||
if (currentLibMap != null) {
|
||||
ECustomVersionGroup[] groups = ECustomVersionGroup.values();
|
||||
for (ECustomVersionGroup group : groups) {
|
||||
@@ -451,11 +468,6 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
|
||||
libMap.put(group.getName(), customLibUtil.convertToLibraryFile(set));
|
||||
}
|
||||
}
|
||||
ECustomVersionGroup selectedType = getSelectedType();
|
||||
if (selectedType != null) {
|
||||
selectLibFileSet = libMap.get(selectedType.getName());
|
||||
viewer.setInput(selectLibFileSet);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSupportHadoop() {
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
*/
|
||||
public class ContextUtils {
|
||||
|
||||
|
||||
private static final Set<String> JAVA_KEYWORDS = new HashSet<String>(Arrays.asList("abstract", "continue", "for", "new", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"switch", "assert", "default", "goto", "package", "synchronized", "boolean", "do", "if", "private", "this", "break", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
|
||||
"double", "implements", "protected", "throw", "byte", "else", "import", "public", "throws", "case", "enum", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
|
||||
@@ -144,9 +144,10 @@ public class ContextUtils {
|
||||
ContextType defaultContextType = null;
|
||||
for (ContextType type : contextTypeList) {
|
||||
// Modified by Marvin Wang on Jun. 21, 2012 for bug TDI-21009. To avoid case sensitive.
|
||||
if (contextName != null && type.getName().toLowerCase().equals(contextName.toLowerCase())) {
|
||||
if (contextName != null && type.getName() != null && type.getName().toLowerCase().equals(contextName.toLowerCase())) {
|
||||
contextType = type;
|
||||
} else if (defaultContextName != null && type.getName().toLowerCase().equals(defaultContextName.toLowerCase())) {
|
||||
} else if (defaultContextName != null && type.getName() != null
|
||||
&& type.getName().toLowerCase().equals(defaultContextName.toLowerCase())) {
|
||||
defaultContextType = type;
|
||||
}
|
||||
}
|
||||
@@ -497,6 +498,12 @@ public class ContextUtils {
|
||||
// if (!sourceParam.getName().equals(targetParamType.getName())) {
|
||||
// return false;
|
||||
// }
|
||||
if (sourceParam.getComment() == null) {
|
||||
sourceParam.setComment("");
|
||||
}
|
||||
if (targetParamType.getComment() == null) {
|
||||
targetParamType.setComment("");
|
||||
}
|
||||
if (!sourceParam.getComment().equals(targetParamType.getComment())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ public class Project {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public Project(org.talend.core.model.properties.Project project, boolean isMainProject) {
|
||||
this.project = project;
|
||||
mainProject = isMainProject;
|
||||
}
|
||||
|
||||
public Project(String label) {
|
||||
this.project = PropertiesFactory.eINSTANCE.createProject();
|
||||
project.setLabel(label);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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;
|
||||
|
||||
/**
|
||||
* created by ldong on Jan 13, 2015 Detailled comment
|
||||
*
|
||||
*/
|
||||
public interface IDatabaseConstant {
|
||||
|
||||
public static final String REDSHIFT = "DATABASE:REDSHIFT";
|
||||
}
|
||||
@@ -1037,6 +1037,7 @@ public final class MetadataToolHelper {
|
||||
if (param.getValue() instanceof IMetadataTable) {
|
||||
param.setValueToDefault(elementParameters);
|
||||
IMetadataTable table = (IMetadataTable) param.getValue();
|
||||
String metadataTableName = metadataTable.getTableName();
|
||||
if (mappingParameter != null) {
|
||||
if (mappingParameter.getValue() != null && (!mappingParameter.getValue().equals(""))) { //$NON-NLS-1$
|
||||
table.setDbms((String) mappingParameter.getValue());
|
||||
@@ -1064,7 +1065,11 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
}
|
||||
|
||||
if (oldColumn != null) {
|
||||
boolean update = true;
|
||||
if (metadataTableName != null && !metadataTableName.equals(table.getTableName())) {
|
||||
update = newColumn.isCustom();
|
||||
}
|
||||
if (oldColumn != null && update) {
|
||||
// if column exists, then override read only /
|
||||
// custom
|
||||
oldColumn.setReadOnly(newColumn.isReadOnly());
|
||||
@@ -1082,10 +1087,6 @@ public final class MetadataToolHelper {
|
||||
oldColumn.setTalendType(newColumn.getTalendType());
|
||||
oldColumn.setComment(newColumn.getComment());
|
||||
}
|
||||
} else { // if column doesn't exist, then add it.
|
||||
// if (newColumn.isReadOnly() || newColumn.isCustom() || table.isReadOnly()) {
|
||||
// metadataTable.getListColumns().add(newColumn);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.talend.core.model.metadata.IMetadataColumn;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.AbstractMetadataObject;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.metadata.builder.connection.ConnectionFactory;
|
||||
@@ -350,7 +351,7 @@ public final class ConvertionHelper {
|
||||
newColumn.setDefault(column.getDefaultValue());
|
||||
newColumn.setKey(column.isKey());
|
||||
String label2 = column.getLabel();
|
||||
if (KeywordsValidator.isKeyword(label2)) {
|
||||
if (!MetadataToolHelper.isValidColumnName(label2)) {
|
||||
label2 = "_" + label2; //$NON-NLS-1$
|
||||
}
|
||||
newColumn.setLabel(label2);
|
||||
|
||||
@@ -232,6 +232,11 @@ public class HiveConnUtils {
|
||||
|
||||
private static boolean isSupportStandalone(HiveConnVersionInfo hiveVersionObj, int hiveServerIndex) {
|
||||
boolean isHiveServer1 = "HIVE".equals(HiveServerVersionUtils.extractKey(hiveServerIndex)); //$NON-NLS-1$
|
||||
|
||||
if (isHiveServer1 && HiveConnVersionInfo.Cloudera_CDH5_4.equals(hiveVersionObj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !(HiveConnVersionInfo.HDP_1_0.equals(hiveVersionObj) || isHiveServer1
|
||||
&& (HiveConnVersionInfo.HDP_1_2.equals(hiveVersionObj) || HiveConnVersionInfo.HDP_1_3.equals(hiveVersionObj) || HiveConnVersionInfo.HDP_2_0
|
||||
.equals(hiveVersionObj)));
|
||||
|
||||
@@ -46,6 +46,16 @@ public enum HiveConnVersionInfo {
|
||||
|
||||
DISTRO_CUSTOM(0, EHadoopDistributions.CUSTOM.getName(), EHadoopDistributions.CUSTOM.getDisplayName(), false),
|
||||
|
||||
HDP_2_2(
|
||||
1,
|
||||
EHadoopVersion4Drivers.HDP_2_2.getVersionValue(),
|
||||
EHadoopVersion4Drivers.HDP_2_2.getVersionDisplay(),
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
HiveConnVersionInfo.HORTONWORKS),
|
||||
|
||||
HDP_2_1(
|
||||
1,
|
||||
EHadoopVersion4Drivers.HDP_2_1.getVersionValue(),
|
||||
@@ -95,6 +105,9 @@ public enum HiveConnVersionInfo {
|
||||
APACHE_0_20_203(1, EHadoopVersion4Drivers.APACHE_0_20_203.getVersionValue(), EHadoopVersion4Drivers.APACHE_0_20_203
|
||||
.getVersionDisplay(), false, HiveConnVersionInfo.APACHE),
|
||||
|
||||
Cloudera_CDH5_4(1, EHadoopVersion4Drivers.CLOUDERA_CDH5_4.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH5_4
|
||||
.getVersionDisplay(), true, false, true, true, HiveConnVersionInfo.CLOUDERA),
|
||||
|
||||
Cloudera_CDH5_1(1, EHadoopVersion4Drivers.CLOUDERA_CDH5_1.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH5_1
|
||||
.getVersionDisplay(), true, false, true, true, HiveConnVersionInfo.CLOUDERA),
|
||||
|
||||
@@ -206,12 +219,14 @@ public enum HiveConnVersionInfo {
|
||||
HiveConnVersionInfo.HDP_1_3,
|
||||
HiveConnVersionInfo.HDP_2_0,
|
||||
HiveConnVersionInfo.HDP_2_1,
|
||||
HiveConnVersionInfo.HDP_2_2,
|
||||
HiveConnVersionInfo.APACHE_1_0_0,
|
||||
HiveConnVersionInfo.Cloudera_CDH4,
|
||||
HiveConnVersionInfo.Cloudera_CDH4_YARN,
|
||||
HiveConnVersionInfo.Cloudera_CDH5,
|
||||
HiveConnVersionInfo.Cloudera_CDH5_1,
|
||||
HiveConnVersionInfo.Cloudera_CDH5_1_MR1,
|
||||
HiveConnVersionInfo.Cloudera_CDH5_4,
|
||||
HiveConnVersionInfo.MAPR2,
|
||||
HiveConnVersionInfo.MAPR2_1_2,
|
||||
HiveConnVersionInfo.MAPR2_1_3,
|
||||
@@ -231,6 +246,7 @@ public enum HiveConnVersionInfo {
|
||||
HiveConnVersionInfo.HDP_1_3,
|
||||
HiveConnVersionInfo.HDP_2_0,
|
||||
HiveConnVersionInfo.HDP_2_1,
|
||||
HiveConnVersionInfo.HDP_2_2,
|
||||
HiveConnVersionInfo.APACHE_0_20_203,
|
||||
HiveConnVersionInfo.APACHE_1_0_0,
|
||||
HiveConnVersionInfo.Cloudera_CDH3,
|
||||
@@ -239,6 +255,7 @@ public enum HiveConnVersionInfo {
|
||||
HiveConnVersionInfo.Cloudera_CDH5,
|
||||
HiveConnVersionInfo.Cloudera_CDH5_1,
|
||||
HiveConnVersionInfo.Cloudera_CDH5_1_MR1,
|
||||
HiveConnVersionInfo.Cloudera_CDH5_4,
|
||||
HiveConnVersionInfo.MAPR1,
|
||||
HiveConnVersionInfo.MAPR2,
|
||||
HiveConnVersionInfo.MAPR2_1_2,
|
||||
@@ -270,8 +287,9 @@ public enum HiveConnVersionInfo {
|
||||
private boolean supportSecurity;
|
||||
|
||||
private static HiveConnVersionInfo[] hiveVersions = new HiveConnVersionInfo[] { HiveConnVersionInfo.Cloudera_CDH5,
|
||||
HiveConnVersionInfo.Cloudera_CDH5_1, HiveConnVersionInfo.Cloudera_CDH5_1_MR1, HiveConnVersionInfo.HDP_2_1,
|
||||
HiveConnVersionInfo.HDP_2_0, HiveConnVersionInfo.PIVOTAL_HD_2_0, HiveConnVersionInfo.APACHE_2_4_0_EMR };
|
||||
HiveConnVersionInfo.Cloudera_CDH5_1, HiveConnVersionInfo.Cloudera_CDH5_1_MR1, HiveConnVersionInfo.Cloudera_CDH5_4,
|
||||
HiveConnVersionInfo.HDP_2_2, HiveConnVersionInfo.HDP_2_1, HiveConnVersionInfo.HDP_2_0,
|
||||
HiveConnVersionInfo.PIVOTAL_HD_2_0, HiveConnVersionInfo.APACHE_2_4_0_EMR };
|
||||
|
||||
private HiveConnVersionInfo(int level, String key, String displayName, boolean supportSecurity,
|
||||
HiveConnVersionInfo... follows) {
|
||||
|
||||
@@ -91,7 +91,6 @@ import org.talend.core.service.IMetadataManagmentUiService;
|
||||
import org.talend.core.utils.KeywordsValidator;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.cwm.helper.ConnectionHelper;
|
||||
import org.talend.utils.json.JSONException;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment <br/>
|
||||
@@ -1132,6 +1131,10 @@ public class RepositoryToComponentProperty {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Map<String, Object> line = new HashMap<String, Object>();
|
||||
line.put("JAR_NAME", jar);
|
||||
value2.add(line);
|
||||
}
|
||||
}
|
||||
if (deployed) {
|
||||
@@ -1216,17 +1219,23 @@ public class RepositoryToComponentProperty {
|
||||
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION);
|
||||
}
|
||||
|
||||
if (value.equals("HBASE_MASTER_PRINCIPAL")) {
|
||||
return TalendQuoteUtils.addQuotes(connection.getParameters().get(
|
||||
ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MASTERPRINCIPAL));
|
||||
}
|
||||
|
||||
if (value.equals("HBASE_REGIONSERVER_PRINCIPAL")) {
|
||||
return TalendQuoteUtils.addQuotes(connection.getParameters().get(
|
||||
ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_REGIONSERVERPRINCIPAL));
|
||||
}
|
||||
|
||||
if (value.equals("HIVE_SERVER")) {
|
||||
return connection.getParameters().get(ConnParameterKeys.HIVE_SERVER_VERSION);
|
||||
}
|
||||
|
||||
if (value.equals("HBASE_PARAMETERS")) {
|
||||
try {
|
||||
String message = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_PROPERTIES);
|
||||
return HadoopRepositoryUtil.getHadoopPropertiesList(message, true);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
String message = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_PROPERTIES);
|
||||
return HadoopRepositoryUtil.getHadoopPropertiesFullList(connection, message, true);
|
||||
}
|
||||
|
||||
if (value.equals("HADOOP_ADVANCED_PROPERTIES")) {
|
||||
@@ -1236,11 +1245,12 @@ public class RepositoryToComponentProperty {
|
||||
} else if (EDatabaseTypeName.HBASE.getDisplayName().equals(databaseType)) {
|
||||
message = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_PROPERTIES);
|
||||
}
|
||||
try {
|
||||
return HadoopRepositoryUtil.getHadoopPropertiesList(message, true);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return HadoopRepositoryUtil.getHadoopPropertiesFullList(connection, message, true);
|
||||
}
|
||||
|
||||
if (value.equals("ADVANCED_PROPERTIES") && EDatabaseTypeName.HIVE.getDisplayName().equals(databaseType)) {
|
||||
String message = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES);
|
||||
return HadoopRepositoryUtil.getHadoopPropertiesList(message, true);
|
||||
}
|
||||
|
||||
if (value.equals("HADOOP_CUSTOM_JARS")) {
|
||||
@@ -1336,12 +1346,26 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
}
|
||||
|
||||
if (value.equals("JOBTRACKER_PRINCIPAL")) {
|
||||
String jobTrackerPrincipal = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_PRINCIPAL);
|
||||
if (jobTrackerPrincipal == null) {
|
||||
return jobTrackerPrincipal;
|
||||
/**
|
||||
* JOBTRACKER_PRINCIPAL and RESOURCEMANAGER_PRINCIPAL use the same field
|
||||
*
|
||||
* @see org.talend.repository.model.hadoopcluster.HadoopClusterConnection#getJtOrRmPrincipal()
|
||||
*/
|
||||
if (value.equals("JOBTRACKER_PRINCIPAL") || value.equals("RESOURCEMANAGER_PRINCIPAL")) {
|
||||
String jtOrRmPrincipal = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_PRINCIPAL);
|
||||
if (jtOrRmPrincipal == null) {
|
||||
return jtOrRmPrincipal;
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotesIfNotExist(StringUtils.trimToNull(jobTrackerPrincipal));
|
||||
return TalendQuoteUtils.addQuotesIfNotExist(StringUtils.trimToNull(jtOrRmPrincipal));
|
||||
}
|
||||
}
|
||||
|
||||
if (value.equals("JOBHISTORY_PRINCIPAL")) {
|
||||
String jobHistoryPrincipal = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_HISTORY_PRINCIPAL);
|
||||
if (jobHistoryPrincipal == null) {
|
||||
return jobHistoryPrincipal;
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotesIfNotExist(StringUtils.trimToNull(jobHistoryPrincipal));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1387,7 +1411,7 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
|
||||
if (value.equals("USE_KEYTAB")) {
|
||||
String USE_KEYTAB = connection.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_USEKEYTAB);
|
||||
String USE_KEYTAB = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB);
|
||||
if (USE_KEYTAB != null && USE_KEYTAB.equals("true")) {
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
@@ -1395,18 +1419,30 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
}
|
||||
|
||||
if (value.equals("PRINCIPAL")) {
|
||||
return TalendQuoteUtils.addQuotes(connection.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_PRINCIPLA));
|
||||
if (value.equals("PRINCIPAL") || value.equals("KEYTAB_PRINCIPAL")) {
|
||||
return TalendQuoteUtils.addQuotes(connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL));
|
||||
}
|
||||
|
||||
if (value.equals("KEYTAB_PATH")) {
|
||||
return TalendQuoteUtils.addQuotes(connection.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_KEYTAB));
|
||||
return TalendQuoteUtils.addQuotes(connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB));
|
||||
}
|
||||
|
||||
if (value.equals("IMPALA_PRINCIPAL")) {
|
||||
return TalendQuoteUtils.addQuotes(connection.getParameters().get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA));
|
||||
}
|
||||
|
||||
if (value.equals("IMPALA_VERSION")) {
|
||||
String impalaVersion = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
|
||||
if (impalaVersion != null) {
|
||||
// The value for IMPALA_CDH5 is wrong for a long time, so need to change it manaully, so can avoid to
|
||||
// add migration task
|
||||
if (EDatabaseVersion4Drivers.IMPALA_CDH5.getVersionValue().equals(impalaVersion)) {
|
||||
impalaVersion = "Cloudera_CDH5_1";
|
||||
}
|
||||
}
|
||||
return impalaVersion;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -1942,6 +1978,100 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* qiang.zhang Comment method "getTableXMLMappingValue".
|
||||
*
|
||||
* @param connection
|
||||
* @param tableInfo
|
||||
* @param metaTable
|
||||
*/
|
||||
public static void getTableXMLMappingValue(Connection connection, List<Map<String, Object>> tableInfo,
|
||||
IMetadataTable metaTable, Map<String, String> colRenameMap) {
|
||||
if (connection instanceof XmlFileConnection) {
|
||||
XmlFileConnection xmlConnection = (XmlFileConnection) connection;
|
||||
if (xmlConnection.isInputModel()) {
|
||||
EList objectList = xmlConnection.getSchema();
|
||||
XmlXPathLoopDescriptor xmlDesc = (XmlXPathLoopDescriptor) objectList.get(0);
|
||||
List<SchemaTarget> schemaTargets = xmlDesc.getSchemaTargets();
|
||||
tableInfo.clear();
|
||||
List<IMetadataColumn> listColumns = metaTable.getListColumns();
|
||||
|
||||
String tagName;
|
||||
for (int j = 0; j < schemaTargets.size(); j++) {
|
||||
SchemaTarget schemaTarget = schemaTargets.get(j);
|
||||
boolean foundColumn = false;
|
||||
for (IMetadataColumn metadataColumn : listColumns) {
|
||||
if (metadataColumn.getLabel().equals(schemaTarget.getTagName())) {
|
||||
foundColumn = true;
|
||||
tagName = "" + schemaTarget.getTagName().trim().replaceAll(" ", "_"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
tagName = MetadataToolHelper.validateColumnName(tagName, j);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("SCHEMA_COLUMN", tagName); //$NON-NLS-1$
|
||||
map.put("QUERY", TalendQuoteUtils.addQuotes(schemaTarget.getRelativeXPathQuery())); //$NON-NLS-1$
|
||||
tableInfo.add(map);
|
||||
}
|
||||
}
|
||||
// if can not found noramlly,so maybe the column name changed,use rename map we always found the new
|
||||
// column name here
|
||||
if (!foundColumn && colRenameMap != null && !colRenameMap.isEmpty()) {
|
||||
Set<String> newNameSet = colRenameMap.keySet();
|
||||
for (IMetadataColumn metadataColumn : listColumns) {
|
||||
if (newNameSet.contains(metadataColumn.getLabel())) {
|
||||
String oldColLabel = colRenameMap.get((metadataColumn.getLabel()));
|
||||
if (schemaTarget.getTagName().equals(oldColLabel)) {
|
||||
foundColumn = true;
|
||||
schemaTarget.setTagName(metadataColumn.getLabel());
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("SCHEMA_COLUMN", metadataColumn.getLabel()); //$NON-NLS-1$
|
||||
map.put("QUERY", TalendQuoteUtils.addQuotes(schemaTarget.getRelativeXPathQuery())); //$NON-NLS-1$
|
||||
tableInfo.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (connection instanceof MDMConnection) {
|
||||
MDMConnection xmlConnection = (MDMConnection) connection;
|
||||
EList objectList = xmlConnection.getSchemas();
|
||||
for (Concept concept : (List<Concept>) objectList) {
|
||||
if (concept.getLabel() == null || concept.getLabel().equals(metaTable.getLabel())) {
|
||||
List<ConceptTarget> conceptTargets = concept.getConceptTargets();
|
||||
tableInfo.clear();
|
||||
List<IMetadataColumn> listColumns = metaTable.getListColumns();
|
||||
for (IMetadataColumn metadataColumn : listColumns) {
|
||||
for (ConceptTarget schema : conceptTargets) {
|
||||
if (metadataColumn.getLabel().equals(schema.getTargetName())) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("SCHEMA_COLUMN", schema.getTargetName()); //$NON-NLS-1$
|
||||
map.put("QUERY", TalendQuoteUtils.addQuotes(schema.getRelativeLoopExpression())); //$NON-NLS-1$
|
||||
tableInfo.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (connection instanceof EDIFACTConnection) {
|
||||
EDIFACTConnection edifactConnection = (EDIFACTConnection) connection;
|
||||
List<IMetadataColumn> objectList = metaTable.getListColumns();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
for (IMetadataColumn column : objectList) {
|
||||
if (column instanceof EDIFACTColumn) {
|
||||
EDIFACTColumn edicolumn = (EDIFACTColumn) column;
|
||||
String ediColumnName = edicolumn.getEDIColumnName();
|
||||
String ediXpath = edicolumn.getEDIXpath();
|
||||
map.put("COLUMN_NAME", ediColumnName); //$NON-NLS-1$
|
||||
map.put("XPATH", ediXpath); //$NON-NLS-1$
|
||||
tableInfo.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void getTableXMLMappingValue(Connection connection, List<Map<String, Object>> tableInfo, INode node) {
|
||||
List<IMetadataTable> metaTables = node.getMetadataList();
|
||||
|
||||
@@ -2217,7 +2347,8 @@ public class RepositoryToComponentProperty {
|
||||
* @param metadataTable
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> getXMLMappingValue(Connection connection, List<IMetadataTable> metadataTables) {
|
||||
public static List<Map<String, Object>> getXMLMappingValue(Connection connection, List<IMetadataTable> metadataTables,
|
||||
Map<String, String> colRenameMap) {
|
||||
if (metadataTables == null || metadataTables.isEmpty()) {
|
||||
return new ArrayList<Map<String, Object>>();
|
||||
}
|
||||
@@ -2232,15 +2363,30 @@ public class RepositoryToComponentProperty {
|
||||
List<SchemaTarget> schemaTargets = xmlDesc.getSchemaTargets();
|
||||
List<Map<String, Object>> maps = new ArrayList<Map<String, Object>>();
|
||||
for (IMetadataColumn col : metadataTable.getListColumns()) {
|
||||
boolean foundColumn = false;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("QUERY", null); //$NON-NLS-1$
|
||||
for (int i = 0; i < schemaTargets.size(); i++) {
|
||||
SchemaTarget sch = schemaTargets.get(i);
|
||||
if (col.getLabel().equals(sch.getTagName())) {
|
||||
// map.put("SCHEMA_COLUMN", sch.getTagName());
|
||||
foundColumn = true;
|
||||
map.put("QUERY", TalendQuoteUtils.addQuotes(sch.getRelativeXPathQuery())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if (!foundColumn && colRenameMap != null && !colRenameMap.isEmpty()) {
|
||||
Set<String> newNameSet = colRenameMap.keySet();
|
||||
for (int i = 0; i < schemaTargets.size(); i++) {
|
||||
SchemaTarget sch = schemaTargets.get(i);
|
||||
if (newNameSet.contains(sch.getTagName())) {
|
||||
String oldColLabel = colRenameMap.get(sch.getTagName());
|
||||
if (col.getLabel().equals(oldColLabel)) {
|
||||
foundColumn = true;
|
||||
map.put("QUERY", TalendQuoteUtils.addQuotes(sch.getRelativeXPathQuery())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the Xml File Connection have the Keyword Column, can not get QUERY value .
|
||||
if (map.get(UpdatesConstants.QUERY) == null) {
|
||||
if (col.getLabel() != null && col.getLabel().startsWith("Column")) {
|
||||
|
||||
@@ -92,6 +92,11 @@ public abstract class AbstractNode implements INode {
|
||||
|
||||
private List<ModuleNeeded> modulesNeeded = new ArrayList<ModuleNeeded>();
|
||||
|
||||
// for DI job, and indicate if the component after the iterator
|
||||
// connection which enable parallel, even this component after
|
||||
// onComponentOk
|
||||
private String parallelIterator = null;
|
||||
|
||||
// as the talend job contains multiple mapreduce jobs, use this to indicate
|
||||
// which mapreduce job contains this
|
||||
// graphic node
|
||||
@@ -1201,4 +1206,22 @@ public abstract class AbstractNode implements INode {
|
||||
public void setRefNode(boolean isRefNode) {
|
||||
this.isRefNode = isRefNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for parallelIterator.
|
||||
*
|
||||
* @return the parallelIterator
|
||||
*/
|
||||
public String getParallelIterator() {
|
||||
return parallelIterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parallelIterator.
|
||||
*
|
||||
* @param parallelIterator the parallelIterator to set
|
||||
*/
|
||||
public void setParallelIterator(String parallelIterator) {
|
||||
this.parallelIterator = parallelIterator;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.core.model.process;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
@@ -94,9 +95,7 @@ public interface IProcess2 extends IRepositoryObject, IProcess {
|
||||
|
||||
public IUpdateManager getUpdateManager();
|
||||
|
||||
public byte[] getScreenshot();
|
||||
|
||||
public void setScreenshot(byte[] image);
|
||||
public Map<String, byte[]> getScreenshots();
|
||||
|
||||
public void dispose();
|
||||
|
||||
@@ -123,6 +122,8 @@ public interface IProcess2 extends IRepositoryObject, IProcess {
|
||||
|
||||
public void setLastRunContext(IContext context);
|
||||
|
||||
public Map<Object, Object> getAdditionalProperties();
|
||||
|
||||
boolean isSubjobEnabled();
|
||||
|
||||
void removeProblems4ProcessDeleted();
|
||||
@@ -133,4 +134,5 @@ public interface IProcess2 extends IRepositoryObject, IProcess {
|
||||
String getSpringContent();
|
||||
// END TESB-7887
|
||||
|
||||
public void refreshProcess();
|
||||
}
|
||||
|
||||
@@ -114,6 +114,8 @@ public class RepositoryViewObject implements IRepositoryViewObject {
|
||||
|
||||
private static final String TIP = "same name item with other project";
|
||||
|
||||
private boolean avoidGuiInfos;
|
||||
|
||||
public RepositoryViewObject(Property property, boolean avoidGuiInfos) {
|
||||
this.id = property.getId();
|
||||
this.author = property.getAuthor();
|
||||
@@ -140,6 +142,7 @@ public class RepositoryViewObject implements IRepositoryViewObject {
|
||||
informationStatus = factory.getStatus(informationLevel);
|
||||
modified = factory.isModified(property);
|
||||
}
|
||||
this.avoidGuiInfos = avoidGuiInfos;
|
||||
if (!avoidGuiInfos) {
|
||||
if (type == ERepositoryObjectType.JOBLET) {
|
||||
JobletProcessItem item = (JobletProcessItem) property.getItem();
|
||||
@@ -315,39 +318,41 @@ public class RepositoryViewObject implements IRepositoryViewObject {
|
||||
repositoryStatus = factory.getStatus(property.getItem());
|
||||
InformationLevel informationLevel = property.getMaxInformationLevel();
|
||||
informationStatus = factory.getStatus(informationLevel);
|
||||
if (type == ERepositoryObjectType.JOBLET) {
|
||||
JobletProcessItem item = (JobletProcessItem) property.getItem();
|
||||
if (item.getIcon() != null && item.getIcon().getInnerContent() != null
|
||||
&& item.getIcon().getInnerContent().length != 0) {
|
||||
customImage = getJobletCustomIcon(property);
|
||||
customImage = ImageUtils.propertyLabelScale(property.getId(), customImage, ICON_SIZE.ICON_16);
|
||||
}
|
||||
IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(
|
||||
IComponentsService.class);
|
||||
IJobletProviderService jobletservice = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
if (service != null && jobletservice != null) {
|
||||
IComponentsFactory factorySingleton = service.getComponentsFactory();
|
||||
IComponent component = factorySingleton.get(property.getLabel(), DI);
|
||||
if (component != null) {
|
||||
try {
|
||||
Property tProperty = jobletservice.getJobletComponentItem(component);
|
||||
if (!tProperty.getId().equals(this.id)) {
|
||||
informationStatus = ERepositoryStatus.WARN;
|
||||
property.setDescription(TIP);
|
||||
if (!this.avoidGuiInfos) {
|
||||
if (type == ERepositoryObjectType.JOBLET) {
|
||||
JobletProcessItem item = (JobletProcessItem) property.getItem();
|
||||
if (item.getIcon() != null && item.getIcon().getInnerContent() != null
|
||||
&& item.getIcon().getInnerContent().length != 0) {
|
||||
customImage = getJobletCustomIcon(property);
|
||||
customImage = ImageUtils.propertyLabelScale(property.getId(), customImage, ICON_SIZE.ICON_16);
|
||||
}
|
||||
IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(
|
||||
IComponentsService.class);
|
||||
IJobletProviderService jobletservice = (IJobletProviderService) GlobalServiceRegister.getDefault()
|
||||
.getService(IJobletProviderService.class);
|
||||
if (service != null && jobletservice != null) {
|
||||
IComponentsFactory factorySingleton = service.getComponentsFactory();
|
||||
IComponent component = factorySingleton.get(property.getLabel(), DI);
|
||||
if (component != null) {
|
||||
try {
|
||||
Property tProperty = jobletservice.getJobletComponentItem(component);
|
||||
if (!tProperty.getId().equals(this.id)) {
|
||||
informationStatus = ERepositoryStatus.WARN;
|
||||
property.setDescription(TIP);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// tProperty is null
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// tProperty is null
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == ERepositoryObjectType.DOCUMENTATION) {
|
||||
this.customImage = ImageProvider.getImage(RepositoryImageProvider.getIcon(type));
|
||||
Item item = property.getItem();
|
||||
if (item instanceof DocumentationItem) {
|
||||
customImage = coreSerivce.getImageWithDocExt(((DocumentationItem) item).getExtension());
|
||||
} else if (item instanceof LinkDocumentationItem) {
|
||||
customImage = coreSerivce.getImageWithSpecial(customImage).createImage();
|
||||
} else if (type == ERepositoryObjectType.DOCUMENTATION) {
|
||||
this.customImage = ImageProvider.getImage(RepositoryImageProvider.getIcon(type));
|
||||
Item item = property.getItem();
|
||||
if (item instanceof DocumentationItem) {
|
||||
customImage = coreSerivce.getImageWithDocExt(((DocumentationItem) item).getExtension());
|
||||
} else if (item instanceof LinkDocumentationItem) {
|
||||
customImage = coreSerivce.getImageWithSpecial(customImage).createImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
return property;
|
||||
|
||||
@@ -35,6 +35,9 @@ public abstract class AbstractUpdateManager implements IUpdateManager {
|
||||
// for repository schema rename
|
||||
private Map<String, String> schemaRenamedMap = new HashMap<String, String>();
|
||||
|
||||
// for repository file connection column rename
|
||||
private Map<String, String> columnRenamedMap = new HashMap<String, String>();
|
||||
|
||||
/* for table deleted and reselect on database wizard table */
|
||||
private Map<String, EUpdateResult> deletedOrReselectTablesMap = new HashMap<String, EUpdateResult>();
|
||||
|
||||
@@ -78,6 +81,27 @@ public abstract class AbstractUpdateManager implements IUpdateManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ldong Comment method "getColumnRenamedMap".
|
||||
*
|
||||
* used for file connection column rename update.
|
||||
*/
|
||||
public Map<String, String> getColumnRenamedMap() {
|
||||
return this.columnRenamedMap;
|
||||
}
|
||||
|
||||
public void setColumnRenamedMap(Map<String, String> columnRenamedMap) {
|
||||
this.columnRenamedMap.clear();
|
||||
if (columnRenamedMap == null) {
|
||||
return;
|
||||
}
|
||||
for (String old : columnRenamedMap.keySet()) {
|
||||
this.columnRenamedMap.put(old, columnRenamedMap.get(old));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isFromRepository() {
|
||||
return this.fromRepository;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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.update;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* created by ldong on Feb 6, 2015 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class ConnectionColumnUpdateManager {
|
||||
|
||||
private static ConnectionColumnUpdateManager columnManager = null;
|
||||
|
||||
private Map<String, String> columnRenameMap = new HashMap<String, String>();
|
||||
|
||||
private ConnectionColumnUpdateManager() {
|
||||
|
||||
}
|
||||
|
||||
public synchronized static ConnectionColumnUpdateManager getInstance() {
|
||||
if (columnManager == null) {
|
||||
columnManager = new ConnectionColumnUpdateManager();
|
||||
}
|
||||
return columnManager;
|
||||
}
|
||||
|
||||
public Map<String, String> getColumnRenameMap() {
|
||||
return this.columnRenameMap;
|
||||
}
|
||||
|
||||
public void addNewName(String newName, String oldName) {
|
||||
String name = columnRenameMap.get(oldName);
|
||||
if (name != null) {
|
||||
columnRenameMap.remove(oldName);
|
||||
columnRenameMap.put(newName, name);
|
||||
} else {
|
||||
columnRenameMap.put(newName, oldName);
|
||||
}
|
||||
}
|
||||
|
||||
public void setColumnRenameMap(Map<String, String> columnRenameMap) {
|
||||
this.columnRenameMap = columnRenameMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,6 +35,8 @@ import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.IRepositoryContextUpdateService;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.context.JobContext;
|
||||
@@ -101,6 +103,8 @@ public abstract class RepositoryUpdateManager {
|
||||
|
||||
private Map<String, String> schemaRenamedMap = new HashMap<String, String>();
|
||||
|
||||
private Map<String, String> columnRenamedMap = new HashMap<String, String>();
|
||||
|
||||
/**
|
||||
* for context group
|
||||
*/
|
||||
@@ -216,6 +220,14 @@ public abstract class RepositoryUpdateManager {
|
||||
this.schemaRenamedMap = schemaRenamedMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getColumnRenamedMap() {
|
||||
return this.columnRenamedMap;
|
||||
}
|
||||
|
||||
public void setColumnRenamedMap(Map<String, String> columnRenamedMap) {
|
||||
this.columnRenamedMap = columnRenamedMap;
|
||||
}
|
||||
|
||||
public abstract Set<? extends IUpdateItemType> getTypes();
|
||||
|
||||
public static boolean openPropagationDialog() {
|
||||
@@ -332,6 +344,7 @@ public abstract class RepositoryUpdateManager {
|
||||
openNoModificationDialog();
|
||||
}
|
||||
}
|
||||
getColumnRenamedMap().clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -437,6 +450,9 @@ public abstract class RepositoryUpdateManager {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (isSameConnection(object, parameter)) {
|
||||
return true;
|
||||
}
|
||||
if (object instanceof List) {
|
||||
List list = ((List) object);
|
||||
if (!list.isEmpty()) {
|
||||
@@ -479,10 +495,31 @@ public abstract class RepositoryUpdateManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isSameConnection(Object obj1, Object obj2) {
|
||||
Connection conn1 = getConnection(obj1);
|
||||
Connection conn2 = getConnection(obj2);
|
||||
if (conn1 != null && conn2 != null && conn1.equals(conn2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Connection getConnection(Object obj) {
|
||||
Connection conn = null;
|
||||
if (obj instanceof Connection) {
|
||||
conn = (Connection) obj;
|
||||
} else if (obj instanceof ConnectionItem) {
|
||||
conn = ((ConnectionItem) obj).getConnection();
|
||||
}
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
private boolean checkHadoopRelevances(Object resultParam) {
|
||||
if (resultParam != null && resultParam instanceof Connection && parameter instanceof Connection) {
|
||||
Connection parentConnection = (Connection) parameter;
|
||||
Connection childConnection = (Connection) resultParam;
|
||||
if (resultParam != null) {
|
||||
Connection parentConnection = getConnection(parameter);
|
||||
Connection childConnection = getConnection(resultParam);
|
||||
IHadoopClusterService hadoopClusterService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
|
||||
hadoopClusterService = (IHadoopClusterService) GlobalServiceRegister.getDefault().getService(
|
||||
@@ -962,6 +999,29 @@ public abstract class RepositoryUpdateManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<IRepositoryViewObject> noSqlConnList = factory.getAll(
|
||||
ERepositoryObjectType.valueOf(ERepositoryObjectType.class, "METADATA_NOSQL_CONNECTIONS"), true); //$NON-NLS-1$
|
||||
for (IRepositoryViewObject obj : noSqlConnList) {
|
||||
Item item = obj.getProperty().getItem();
|
||||
if (item instanceof ConnectionItem) {
|
||||
Connection conn = ((ConnectionItem) item).getConnection();
|
||||
if (conn.isContextMode()) {
|
||||
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
|
||||
if (contextItem == null) {
|
||||
continue;
|
||||
}
|
||||
if (citem == contextItem) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryContextUpdateService.class)) {
|
||||
IService service = GlobalServiceRegister.getDefault().getService(
|
||||
IRepositoryContextUpdateService.class);
|
||||
IRepositoryContextUpdateService repositoryContextUpdateService = (IRepositoryContextUpdateService) service;
|
||||
repositoryContextUpdateService.updateRelatedContextVariableName(conn, oldValue, newValue);
|
||||
}
|
||||
factory.save(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1096,6 +1156,10 @@ public abstract class RepositoryUpdateManager {
|
||||
if (getSchemaRenamedMap() != null && !getSchemaRenamedMap().isEmpty()) {
|
||||
manager.setSchemaRenamedMap(getSchemaRenamedMap());
|
||||
}
|
||||
|
||||
if (getColumnRenamedMap() != null && !getColumnRenamedMap().isEmpty()) {
|
||||
manager.setColumnRenamedMap(getColumnRenamedMap());
|
||||
}
|
||||
if (getDeletedOrReselectTablesMap() != null && !getDeletedOrReselectTablesMap().isEmpty()) {
|
||||
manager.setDeletedOrReselectTablesMap(getDeletedOrReselectTablesMap());
|
||||
}
|
||||
@@ -1272,7 +1336,7 @@ public abstract class RepositoryUpdateManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC PLV Comment method "updateFileConnection".
|
||||
* DOC PLV Comment method "updateFileConnection".For now only used in File xml connecton
|
||||
*
|
||||
* @param connectionItem
|
||||
* @param oldMetadataTable
|
||||
@@ -1309,6 +1373,10 @@ public abstract class RepositoryUpdateManager {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (!ConnectionColumnUpdateManager.getInstance().getColumnRenameMap().isEmpty()) {
|
||||
repositoryUpdateManager.setColumnRenamedMap(ConnectionColumnUpdateManager.getInstance().getColumnRenameMap());
|
||||
}
|
||||
return repositoryUpdateManager.doWork(show, onlySimpleShow);
|
||||
}
|
||||
|
||||
@@ -1858,6 +1926,11 @@ public abstract class RepositoryUpdateManager {
|
||||
// set renamed schema
|
||||
repositoryUpdateManager.setSchemaRenamedMap(schemaRenamedMap);
|
||||
|
||||
// set rename column
|
||||
if (!ConnectionColumnUpdateManager.getInstance().getColumnRenameMap().isEmpty()) {
|
||||
repositoryUpdateManager.setColumnRenamedMap(ConnectionColumnUpdateManager.getInstance().getColumnRenameMap());
|
||||
}
|
||||
|
||||
return repositoryUpdateManager.doWork(show, onlySimpleShow);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,4 +32,19 @@ public abstract class AbstractDragAndDropServiceHandler implements IDragAndDropS
|
||||
public Object getComponentValue(Connection connection, String value, IMetadataTable table) {
|
||||
return getComponentValue(connection, value, table, null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.utils.IDragAndDropServiceHandler#isValidForDataViewer(org.talend.core.model.metadata.
|
||||
* IMetadataTable)
|
||||
*/
|
||||
@Override
|
||||
public boolean isValidForDataViewer(Connection connection, IMetadataTable metadataTable) {
|
||||
if (!canHandle(connection)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,4 +98,15 @@ public interface IDragAndDropServiceHandler {
|
||||
*/
|
||||
public void handleTableRelevantParameters(Connection connection, IElement ele, IMetadataTable metadataTable);
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "isValidForDataViewer".
|
||||
* <p>
|
||||
* Check if the table can do data viewer.
|
||||
*
|
||||
* @param connection
|
||||
* @param metadataTable
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidForDataViewer(Connection connection, IMetadataTable metadataTable);
|
||||
|
||||
}
|
||||
|
||||
@@ -691,14 +691,34 @@ public class NodeUtil {
|
||||
*/
|
||||
public static INode getNodeByUniqueName(final IProcess process, String uniqueName) {
|
||||
|
||||
return getNodeByUniqueName(process,uniqueName,false);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC jzhao
|
||||
* <p>
|
||||
* function:get the node(maybe include virtual node) from generating nodes by unique name. aim:to get the property value from any node.
|
||||
* </p>
|
||||
* Notice: It is used to get property values from the pointed node we can also get the virtual node.
|
||||
*
|
||||
* @param process: a job process
|
||||
* @param uniqueName:the unique name of the pointed node.
|
||||
* @param isReturnVirtualNode: specify whether return the virtual node.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static INode getNodeByUniqueName(final IProcess process, String uniqueName ,boolean isReturnVirtualNode) {
|
||||
|
||||
List<INode> nodes = (List<INode>) process.getGeneratingNodes();
|
||||
INode return_node = null;
|
||||
for (INode current_node : nodes) {
|
||||
if(isReturnVirtualNode && current_node.isVirtualGenerateNode()){
|
||||
current_node = getVirtualNode(current_node);
|
||||
}
|
||||
if (uniqueName.equals(current_node.getUniqueName())) {
|
||||
return_node = current_node;
|
||||
return current_node;
|
||||
}
|
||||
}
|
||||
return return_node;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,10 +14,12 @@ package org.talend.core.model.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -174,14 +176,19 @@ public final class ParameterValueUtil {
|
||||
LinkedHashMap<Integer, Integer> quotaStrings = new LinkedHashMap<Integer, Integer>();
|
||||
// List<Point> functionNameAreas = new ArrayList<Point>();
|
||||
List<FunctionInfo> functions = new ArrayList<FunctionInfo>();
|
||||
// comment String set
|
||||
Set<String> commentStringSet = new HashSet<String>();
|
||||
|
||||
// get and store all start and end point of const strings
|
||||
int start = -1;
|
||||
int end = -2;
|
||||
char ch;
|
||||
boolean isInConstString = false;
|
||||
boolean isInCommentString = false;
|
||||
Character commentType = null;
|
||||
for (int i = 0; i < length; i++) {
|
||||
ch = value.charAt(i);
|
||||
if (ch == '\"') {
|
||||
if (isInCommentString == false && ch == '\"') {
|
||||
// in case of cases :
|
||||
// case 1 : [ "select * from " + context.table + " where value = \"context.table\"" ]
|
||||
// case 2 : [ "select * from " + context.table + " where value = \"\\" + context.table +
|
||||
@@ -190,12 +197,41 @@ public final class ParameterValueUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
isInConstString = !isInConstString;
|
||||
// [0 <= start] >> in case the first const String position compute error
|
||||
if (0 <= start && end < start) {
|
||||
// if (0 <= start && end < start) {
|
||||
// end = i;
|
||||
// quotaStrings.put(start, end);
|
||||
// } else {
|
||||
// start = i;
|
||||
// }
|
||||
if (isInConstString) {
|
||||
start = i;
|
||||
} else {
|
||||
end = i;
|
||||
quotaStrings.put(start, end);
|
||||
}
|
||||
} else if (isInConstString == false) {
|
||||
if (isInCommentString) {
|
||||
if (commentType != null && commentType.equals('/') && (ch == '\r' || ch == '\n')) {
|
||||
isInCommentString = false;
|
||||
commentType = null;
|
||||
end = i;
|
||||
} else if (commentType != null && commentType.equals('*') && ch == '/' && value.charAt(i - 1) == '*') {
|
||||
isInCommentString = false;
|
||||
commentType = null;
|
||||
end = i;
|
||||
}
|
||||
if (isInCommentString == false) {
|
||||
quotaStrings.put(start, end);
|
||||
commentStringSet.add(start + ":" + end); //$NON-NLS-1$
|
||||
}
|
||||
} else {
|
||||
start = i;
|
||||
if ((ch == '/' || ch == '*') && 0 < i && (i - 1) != end && value.charAt(i - 1) == '/') {
|
||||
isInCommentString = true;
|
||||
commentType = ch;
|
||||
start = i - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,7 +266,7 @@ public final class ParameterValueUtil {
|
||||
start = entry.getKey();
|
||||
end = entry.getValue() + 1;
|
||||
vEnd = start;
|
||||
if (vStart != start) {
|
||||
if (vStart < vEnd) {
|
||||
subString = value.substring(vStart, vEnd);
|
||||
calcMethodArea(subString, value, vStart, functions);
|
||||
}
|
||||
@@ -244,11 +280,13 @@ public final class ParameterValueUtil {
|
||||
start = entry.getKey();
|
||||
end = entry.getValue() + 1;
|
||||
vEnd = start;
|
||||
if (vStart == start) {
|
||||
// const string follow with const string, maybe won't happen...
|
||||
if (vEnd <= vStart) {
|
||||
// const string follow with const string, will be happen like this:
|
||||
// [String a = "string"/* it's a string*/;]
|
||||
|
||||
// get the const string
|
||||
subString = value.substring(start, end);
|
||||
if (start < methodMaxIndex) {
|
||||
if (!commentStringSet.contains(start + ":" + (end - 1)) && start < methodMaxIndex) { //$NON-NLS-1$
|
||||
subString = subString.replaceAll(oldName, newName);
|
||||
}
|
||||
} else {
|
||||
@@ -266,7 +304,7 @@ public final class ParameterValueUtil {
|
||||
// get the const string
|
||||
// deal with: context.getProperty("test") + "test"
|
||||
subString = value.substring(start, end);
|
||||
if (start < methodMaxIndex) {
|
||||
if (!commentStringSet.contains(start + ":" + (end - 1)) && start < methodMaxIndex) { //$NON-NLS-1$
|
||||
FunctionInfo function = FunctionInfo.getParentFunctionFromList(start, end, functions);
|
||||
Point funcNameArea = function.getNameArea();
|
||||
String functionName = value.substring(funcNameArea.x, funcNameArea.y);
|
||||
@@ -507,7 +545,7 @@ public final class ParameterValueUtil {
|
||||
replacedStrings.put(s, s);
|
||||
}
|
||||
}
|
||||
if (split.length == 1) {
|
||||
if (split.length == 1 && split[0].length() == value.length()) {
|
||||
returnValue.append(replacedStrings.get(split[0]));
|
||||
}
|
||||
// obtain consts & concat the consts with the variables
|
||||
@@ -588,7 +626,10 @@ public final class ParameterValueUtil {
|
||||
int currentMaxIndex = i;
|
||||
while (matcher.find()) {
|
||||
boolean isInQuota = false;
|
||||
boolean isInComment = false;
|
||||
Character commentType = null;
|
||||
int parenthesisNum = 0;
|
||||
int lastCommentEndIndex = -1;
|
||||
int matchedStart = matcher.start();
|
||||
int matchedEnd = matcher.end();
|
||||
Point functionNameArea = new Point(beginIndex + matchedStart, beginIndex + matchedEnd);
|
||||
@@ -602,12 +643,34 @@ public final class ParameterValueUtil {
|
||||
|
||||
for (; i < wholeString.length(); i++) {
|
||||
char ch = wholeString.charAt(i);
|
||||
if (ch == '\"' && !isEscapeSequence(wholeString, i)) {
|
||||
if (isInComment == false && ch == '\"' && !isEscapeSequence(wholeString, i)) {
|
||||
isInQuota = !isInQuota;
|
||||
}
|
||||
if (isInQuota) {
|
||||
continue;
|
||||
} else if (isInQuota) {
|
||||
continue;
|
||||
} else if (isInQuota == false) {
|
||||
if (isInComment) {
|
||||
if (commentType != null && commentType.equals('/') && (ch == '\r' || ch == '\n')) {
|
||||
isInComment = false;
|
||||
commentType = null;
|
||||
lastCommentEndIndex = i;
|
||||
} else if (commentType != null && commentType.equals('*') && ch == '/'
|
||||
&& wholeString.charAt(i - 1) == '*') {
|
||||
isInComment = false;
|
||||
commentType = null;
|
||||
lastCommentEndIndex = i;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
if ((ch == '/' || ch == '*') && 0 < i && (i - 1) != lastCommentEndIndex
|
||||
&& wholeString.charAt(i - 1) == '/') {
|
||||
isInComment = true;
|
||||
commentType = ch;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch == '(') {
|
||||
parenthesisNum++;
|
||||
} else if (ch == ')') {
|
||||
|
||||
@@ -156,4 +156,8 @@ public interface ITalendCorePrefConstants {
|
||||
public static final String CoreUIPlugin_ID = "org.talend.core.ui"; //$NON-NLS-1$
|
||||
|
||||
public static final String TOP_INSTALL_DONE = "top.install.done"; //$NON-NLS-1$
|
||||
|
||||
public static final String SVN_UPDATE_INFO_AUTO_CHECK = "PerformancePreferencePage.svn_update_info_auto_check"; //$NON-NLS-1$
|
||||
|
||||
public static final String SVN_UPDATE_INFO_AUTO_CHECK_TIME_INTERVAL = "PerformancePreferencePage.svn_update_info_auto_check_time_interval"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
@@ -28,6 +30,7 @@ public class DefaultRepositoryComponentDndFilter implements IRepositoryComponent
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRepositoryType(Item item, ERepositoryObjectType type) {
|
||||
RepositoryComponentSetting setting = RepositoryComponentManager.getSetting(item, type);
|
||||
if (setting != null) {
|
||||
@@ -36,11 +39,13 @@ public class DefaultRepositoryComponentDndFilter implements IRepositoryComponent
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean except(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component,
|
||||
String repositoryType) {
|
||||
return false; // default, no except components to valid
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component,
|
||||
String repositoryType) {
|
||||
if (component == null || repositoryType == null) {
|
||||
@@ -66,4 +71,9 @@ public class DefaultRepositoryComponentDndFilter implements IRepositoryComponent
|
||||
return tableWithMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IComponent> sort(List<IComponent> components, Item item, ERepositoryObjectType type, RepositoryNode seletetedNode) {
|
||||
return components;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
@@ -36,4 +38,6 @@ public interface IRepositoryComponentDndFilter {
|
||||
*/
|
||||
public boolean except(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component,
|
||||
String repositoryType);
|
||||
|
||||
public List<IComponent> sort(List<IComponent> components, Item item, ERepositoryObjectType type, RepositoryNode seletetedNode);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.core.repository;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -396,7 +397,7 @@ public final class RepositoryComponentManager {
|
||||
}
|
||||
}
|
||||
|
||||
List<IComponent> sortedComponents = new ArrayList<IComponent>();
|
||||
List<IComponent> sortedComponents = new LinkedList<IComponent>();
|
||||
sortedComponents.addAll(specialTopComponents);
|
||||
sortedComponents.addAll(normalTopComponents);
|
||||
|
||||
@@ -405,6 +406,13 @@ public final class RepositoryComponentManager {
|
||||
neededComponents.removeAll(normalTopComponents);
|
||||
sortedComponents.addAll(neededComponents);
|
||||
|
||||
for (RepositoryComponentDndFilterSetting dndFilter : getDndFilterSettings()) {
|
||||
IRepositoryComponentDndFilter filter = dndFilter.getFilter();
|
||||
if (filter != null) {
|
||||
sortedComponents = filter.sort(sortedComponents, item, type, seletetedNode);
|
||||
}
|
||||
}
|
||||
|
||||
return sortedComponents;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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.service;
|
||||
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
|
||||
/**
|
||||
* created by talend on Dec 17, 2014 Detailled comment
|
||||
*
|
||||
*/
|
||||
public interface IDQComponentService extends IService {
|
||||
|
||||
/**
|
||||
*
|
||||
* Handle component chaged
|
||||
*
|
||||
* @param oldConnection
|
||||
* @param newMetadataTable
|
||||
*/
|
||||
void externalComponentChange(IConnection oldConnection, IMetadataTable newMetadataTable);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
@@ -46,4 +47,6 @@ public interface IMRProcessService extends IService {
|
||||
public void generateMRInfosParameter(IProcess2 process);
|
||||
|
||||
public boolean isProgressBarNeeded(IProcess2 process);
|
||||
|
||||
public void refreshMRStatus(List<INode> nodeList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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.service;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.talend.core.IService;
|
||||
|
||||
/**
|
||||
* created by wchen on Mar 4, 2015 Detailled comment
|
||||
*
|
||||
*/
|
||||
public interface IMapperIDocService extends IService {
|
||||
|
||||
public void launchIDocImporter(Properties properties);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.core.IProviderService;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
|
||||
/**
|
||||
* DOC wanghong class global comment. Detailled comment
|
||||
*/
|
||||
public interface IJSONProviderService extends IProviderService {
|
||||
|
||||
public boolean isJSONNode(final INode node);
|
||||
|
||||
public boolean isRepositorySchemaLine(INode node, Map<String, Object> lineValue);
|
||||
|
||||
public ERepositoryObjectType getJSONRepositoryType();
|
||||
}
|
||||
@@ -29,7 +29,9 @@ import org.talend.designer.codegen.ITalendSynchronizer;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
|
||||
/**
|
||||
* DOC guanglong.du class global comment. Detailled comment
|
||||
* DOC guanglong.du class global comment. Detailled comment<br/>
|
||||
* <b>!!!NOTE!!!</b> ICamelDesignerCoreService should also be usable for commandline, should not add UI related codes;
|
||||
* for UI related codes, please add them into ICamelDesignerCoreUIService
|
||||
*/
|
||||
public interface ICamelDesignerCoreService extends IService {
|
||||
|
||||
@@ -40,9 +42,9 @@ public interface ICamelDesignerCoreService extends IService {
|
||||
public boolean isInstanceofCamelRoutes(Item item);
|
||||
|
||||
public ERepositoryObjectType getRoutes();
|
||||
|
||||
|
||||
public ERepositoryObjectType getRouteDocType();
|
||||
|
||||
|
||||
public ERepositoryObjectType getRouteDocsType();
|
||||
|
||||
public ProcessType getCamelProcessType(Item item);
|
||||
@@ -57,23 +59,23 @@ public interface ICamelDesignerCoreService extends IService {
|
||||
|
||||
public boolean isCamelMulitPageEditor(IEditorPart editor);
|
||||
|
||||
/**
|
||||
* Synchronized Route resource
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
public List<IPath> synchronizeRouteResource(Item item);
|
||||
|
||||
public String getDeleteFolderName(ERepositoryObjectType type);
|
||||
|
||||
public boolean isRouteBuilderNode(INode node);
|
||||
/**
|
||||
* Synchronized Route resource
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
public List<IPath> synchronizeRouteResource(Item item);
|
||||
|
||||
public boolean canCreateNodeOnLink(IConnection connection, INode node);
|
||||
|
||||
public EConnectionType getTargetConnectionType(INode node);
|
||||
public String getDeleteFolderName(ERepositoryObjectType type);
|
||||
|
||||
public void appendRouteInfo2Doc(Item item, Element jobElement);
|
||||
public boolean isRouteBuilderNode(INode node);
|
||||
|
||||
public FileItem newRouteDocumentationItem();
|
||||
public boolean canCreateNodeOnLink(IConnection connection, INode node);
|
||||
|
||||
public EConnectionType getTargetConnectionType(INode node);
|
||||
|
||||
public void appendRouteInfo2Doc(Item item, Element jobElement);
|
||||
|
||||
public FileItem newRouteDocumentationItem();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2015 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.core;
|
||||
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.repository.IRepositoryEditorInput;
|
||||
|
||||
/**
|
||||
* ESB service for UI part; ICamelDesignerCoreService should also be usable for commandline, should not add UI related
|
||||
* codes.
|
||||
*/
|
||||
public interface ICamelDesignerCoreUIService extends IService {
|
||||
|
||||
public boolean isInstanceofCamelRoutes(Item item);
|
||||
|
||||
public IRepositoryEditorInput getRouteEditorInput(ProcessItem processItem, boolean load, Boolean lastVersion)
|
||||
throws PersistenceException;
|
||||
|
||||
public String getRouteEditorId(ProcessItem processItem);
|
||||
}
|
||||
@@ -51,9 +51,9 @@ import org.talend.designer.runprocess.ProcessorException;
|
||||
/**
|
||||
* Provides Designer core services for other components <br/>
|
||||
* .
|
||||
*
|
||||
* $Id: IDesignerCore.java 1 2006-12-19 上午10:16:43 bqian
|
||||
*
|
||||
*
|
||||
* $Id: IDesignerCore.java 1 2006 -12 -19 上午10:16:43 bqian
|
||||
*
|
||||
*/
|
||||
public interface IDesignerCoreService extends IService {
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface IDesignerCoreService extends IService {
|
||||
|
||||
/**
|
||||
* tang Comment method "getProcessFromJobletProcessItem".
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@@ -118,9 +118,9 @@ public interface IDesignerCoreService extends IService {
|
||||
public Map<String, Date> getLastGeneratedJobsDateMap();
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* DOC YeXiaowei Comment method "getDisplayForProcessParameterFromName".
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@@ -154,6 +154,8 @@ public interface IDesignerCoreService extends IService {
|
||||
|
||||
public Set<ModuleNeeded> getNeededLibrariesForProcess(IProcess process, boolean withChildrens);
|
||||
|
||||
public Set<ModuleNeeded> getNeededModules(INode node, boolean withChildrens);
|
||||
|
||||
public void switchToCurContextsView();
|
||||
|
||||
public void switchToCurComponentSettingsView();
|
||||
@@ -162,7 +164,7 @@ public interface IDesignerCoreService extends IService {
|
||||
|
||||
/**
|
||||
* When database connection is renamed, refresh the connection label in the component view of job.
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
public void refreshComponentView(Item item);
|
||||
|
||||
@@ -53,6 +53,8 @@ public class FunctionManager {
|
||||
|
||||
public static final String FUN_SUFFIX = ")"; //$NON-NLS-1$
|
||||
|
||||
public static final String EMPTY_STRING = " "; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* qzhang Comment method "getFunctionByName".
|
||||
*
|
||||
|
||||
@@ -131,7 +131,7 @@ public final class ProjectManager {
|
||||
if (parentBranch != null) {
|
||||
for (ProjectReference pr : (List<ProjectReference>) p.getReferencedProjects()) {
|
||||
if (pr.getBranch() == null || parentBranch.equals(pr.getBranch())) {
|
||||
Project project = new Project(pr.getReferencedProject());
|
||||
Project project = new Project(pr.getReferencedProject(), false);
|
||||
allReferencedprojects.add(project);
|
||||
resolveSubRefProject(pr.getReferencedProject(), allReferencedprojects); // only to resolve all
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public final class ProjectManager {
|
||||
.getReferencedProjects(this.getCurrentProject());
|
||||
if (rProjects != null) {
|
||||
for (org.talend.core.model.properties.Project p : rProjects) {
|
||||
Project project = new Project(p);
|
||||
Project project = new Project(p, false);
|
||||
allReferencedprojects.add(project);
|
||||
resolveSubRefProject(p, allReferencedprojects);
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public final class ProjectManager {
|
||||
List<Project> refProjects = new ArrayList<Project>();
|
||||
for (ProjectReference refProject : (List<ProjectReference>) project.getEmfProject().getReferencedProjects()) {
|
||||
if (refProject.getBranch() == null || parentBranch.equals(refProject.getBranch())) {
|
||||
refProjects.add(new Project(refProject.getReferencedProject()));
|
||||
refProjects.add(new Project(refProject.getReferencedProject(), false));
|
||||
}
|
||||
}
|
||||
return refProjects;
|
||||
|
||||
@@ -26,6 +26,8 @@ public class RepositoryConstants {
|
||||
|
||||
public static final String TEMP_DIRECTORY = "temp"; //$NON-NLS-1$
|
||||
|
||||
public static final String SETTING_DIRECTORY = ".settings"; //$NON-NLS-1$
|
||||
|
||||
public static final String IMG_DIRECTORY = "images"; //$NON-NLS-1$
|
||||
|
||||
public static final String IMG_DIRECTORY_OF_JOB_OUTLINE = "images/job_outlines"; //$NON-NLS-1$
|
||||
@@ -42,7 +44,7 @@ public class RepositoryConstants {
|
||||
|
||||
public static final String USER_DEFINED = "UserDefined"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONTEXT_AND_VARIABLE_PATTERN = "^[a-zA-Z]+[a-zA-Z0-9\\_]*$"; //$NON-NLS-1$
|
||||
public static final String CONTEXT_AND_VARIABLE_PATTERN = "^[a-zA-Z\\_]+[a-zA-Z0-9\\_]*$"; //$NON-NLS-1$
|
||||
|
||||
public static final String PROJECT_PATTERN = "^[a-zA-Z]+[a-zA-Z0-9 \\-_]*$"; //$NON-NLS-1$
|
||||
|
||||
@@ -95,9 +97,7 @@ public class RepositoryConstants {
|
||||
public static String getPattern(ERepositoryObjectType type) {
|
||||
if (type == ERepositoryObjectType.FOLDER) {
|
||||
return FOLDER_PATTERN;
|
||||
} else if (type == ERepositoryObjectType.PROCESS || type == ERepositoryObjectType.JOBLET
|
||||
// Added the m/r for TDI-25928.
|
||||
|| type == ERepositoryObjectType.PROCESS_MR) {
|
||||
} else if (ERepositoryObjectType.getAllTypesOfProcess().contains(type) || type == ERepositoryObjectType.JOBLET) {
|
||||
return CODE_ITEM_PATTERN;
|
||||
} else if (type == ERepositoryObjectType.ROUTINES || type == ERepositoryObjectType.PIG_UDF
|
||||
|| "BEANS".equals(type.getType())) {
|
||||
|
||||
@@ -344,8 +344,12 @@ public class RepositoryNodeUtilities {
|
||||
RepositoryNode node = (RepositoryNode) childNode;
|
||||
if (isRepositoryFolder(node) || node.getType() == ENodeType.REFERENCED_PROJECT) {
|
||||
folderChild.add(node);
|
||||
} else if (isCurNodeUnderHadoopCluster(node, curNode)) {
|
||||
return getNodeOfHadoopCluster(node, curNode);
|
||||
} else if (isHadoopClusterNode(node)) {
|
||||
if (node.getId().equals(curNode.getId()) && node.getObjectType() == curNode.getRepositoryObjectType()) {
|
||||
return node;
|
||||
} else {
|
||||
folderChild.add(node);
|
||||
}
|
||||
} else if (node.getId().equals(curNode.getId()) && node.getObjectType() == curNode.getRepositoryObjectType()) {
|
||||
return node;
|
||||
}
|
||||
@@ -362,40 +366,8 @@ public class RepositoryNodeUtilities {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isCurNodeUnderHadoopCluster(IRepositoryNode parentNode, IRepositoryViewObject curNodeObject) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
|
||||
IHadoopClusterService hadoopClusterService = (IHadoopClusterService) GlobalServiceRegister.getDefault().getService(
|
||||
IHadoopClusterService.class);
|
||||
boolean isParentNodeOk = hadoopClusterService.isHadoopClusterNode(parentNode);
|
||||
if (isParentNodeOk) {
|
||||
boolean isCurrentNodeOk = false;
|
||||
if (curNodeObject.getRepositoryNode() != null) {
|
||||
isCurrentNodeOk = hadoopClusterService.isHadoopSubnode(curNodeObject.getRepositoryNode());
|
||||
} else {
|
||||
isCurrentNodeOk = hadoopClusterService.isHadoopSubItem(curNodeObject.getProperty().getItem());
|
||||
}
|
||||
return isCurrentNodeOk;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static RepositoryNode getNodeOfHadoopCluster(IRepositoryNode clusterNode, IRepositoryViewObject curNode) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
|
||||
IHadoopClusterService hadoopClusterService = (IHadoopClusterService) GlobalServiceRegister.getDefault().getService(
|
||||
IHadoopClusterService.class);
|
||||
if (curNode.getRepositoryNode() != null) {
|
||||
if (hadoopClusterService.isHadoopSubnode(curNode.getRepositoryNode())) {
|
||||
return (RepositoryNode) clusterNode;
|
||||
}
|
||||
} else {
|
||||
Item parentClusterItem = hadoopClusterService.getHadoopClusterBySubitemId(curNode.getId());
|
||||
if (clusterNode.getId().equals(parentClusterItem.getProperty().getId())) {
|
||||
return (RepositoryNode) clusterNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
private static boolean isHadoopClusterNode(IRepositoryNode node) {
|
||||
return hadoopClusterService != null && hadoopClusterService.isHadoopClusterNode(node);
|
||||
}
|
||||
|
||||
public static void expandNode(IRepositoryView view, RepositoryNode curNode, Set<RepositoryNode> nodes) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class AProgressMonitorDialogWithCancel<T> extends ProgressMonito
|
||||
super(parent);
|
||||
}
|
||||
|
||||
abstract protected T runWithCancel(IProgressMonitor monitor) throws Exception;
|
||||
abstract protected T runWithCancel(IProgressMonitor monitor) throws Throwable;
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@@ -73,7 +73,7 @@ public abstract class AProgressMonitorDialogWithCancel<T> extends ProgressMonito
|
||||
runnableWithCancel = new ARunnableWithProgressCancel<T>() {
|
||||
|
||||
@Override
|
||||
protected T runnableWithCancel(IProgressMonitor monitor) throws Exception {
|
||||
protected T runnableWithCancel(IProgressMonitor monitor) throws Throwable {
|
||||
return runWithCancel(monitor);
|
||||
}
|
||||
};
|
||||
@@ -188,7 +188,7 @@ public abstract class AProgressMonitorDialogWithCancel<T> extends ProgressMonito
|
||||
break;
|
||||
} catch (TimeoutException timeoutException) {
|
||||
continue;
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
executeException = e;
|
||||
break;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ public abstract class AProgressMonitorDialogWithCancel<T> extends ProgressMonito
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
futureTask.get();
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
// nothing need to do since all will be done in ARunnableWithProgressCancel
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.Properties;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.adaptor.LocationManager;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
@@ -58,7 +58,7 @@ public class ConnectionUserPerReader {
|
||||
private ConnectionUserPerReader() {
|
||||
proper = new EncryptedProperties();
|
||||
isRead = false;
|
||||
path = new Path(LocationManager.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
|
||||
path = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
|
||||
String tmp = String.valueOf(path.charAt(path.length() - 1));
|
||||
if (!tmp.equals(File.separator)) {
|
||||
perfile = new File(path + File.separator + perfileName);
|
||||
|
||||
@@ -20,7 +20,8 @@ Require-Bundle: org.apache.commons.lang,
|
||||
org.talend.core.repository,
|
||||
org.eclipse.nebula.widgets.nattable.core;bundle-version="1.1.0",
|
||||
org.eclipse.nebula.widgets.nattable.extension.glazedlists;bundle-version="1.1.0",
|
||||
org.talend.libraries.nattable
|
||||
org.talend.libraries.nattable,
|
||||
org.talend.librariesmanager
|
||||
Import-Package: org.eclipse.jdt.internal.ui.workingsets
|
||||
Export-Package: org.talend.core.model.components,
|
||||
org.talend.core.model.metadata.editor,
|
||||
|
||||
@@ -382,6 +382,10 @@ ModuleListCellEditor.externalLabel=External modules
|
||||
ModuleListCellEditor.innerLabel=Inner modules
|
||||
ModuleListCellEditor.selectLabel=Select module
|
||||
ModuleListCellEditor.title=Select Module
|
||||
ModuleListCellEditor.add=Add
|
||||
ModuleListCellEditor.delete=Delete
|
||||
ModuleListCellEditor.warningTitle=Select database driver jars
|
||||
ModuleListCellEditor.warningMessage=The jar have existed.
|
||||
MultiStringSelectionDialog.nameEmpty=Name can not be empty
|
||||
PromptDialog.stringTip=The input text must be surrounded with single quote.
|
||||
ApplicationActionBarAdvisor.menuFileLabel=&File
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.jface.viewers.CheckboxTreeViewer;
|
||||
import org.eclipse.jface.viewers.IContentProvider;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
@@ -69,6 +70,8 @@ public class FilteredCheckboxTree extends Composite {
|
||||
*/
|
||||
protected Text filterText;
|
||||
|
||||
protected ModifyListener filterTextModifyListener;
|
||||
|
||||
/**
|
||||
* The control representing the clear button for the filter text entry. This value may be <code>null</code> if no
|
||||
* such button exists, or if the controls have not yet been created.
|
||||
@@ -199,8 +202,7 @@ public class FilteredCheckboxTree extends Composite {
|
||||
showFilterControls = PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS);
|
||||
createControl(parent, treeStyle);
|
||||
createRefreshJob();
|
||||
// setInitialText(WorkbenchMessages.FilteredTree_FilterMessage);
|
||||
setInitialText(Messages.getString("WorkbenchMessages.FilteredTree_FilterMessage")); //$NON-NLS-1$
|
||||
|
||||
setFont(parent.getFont());
|
||||
}
|
||||
|
||||
@@ -285,7 +287,6 @@ public class FilteredCheckboxTree extends Composite {
|
||||
if (treeViewer instanceof NotifyingTreeViewer) {
|
||||
patternFilter.setUseCache(true);
|
||||
}
|
||||
treeViewer.addFilter(patternFilter);
|
||||
return treeViewer.getControl();
|
||||
}
|
||||
|
||||
@@ -364,7 +365,6 @@ public class FilteredCheckboxTree extends Composite {
|
||||
// }
|
||||
// }
|
||||
treeViewer.refresh(true);
|
||||
|
||||
if (text.length() > 0 && !initial) {
|
||||
/*
|
||||
* Expand elements one at a time. After each is expanded, check to see if the filter text has
|
||||
@@ -454,6 +454,7 @@ public class FilteredCheckboxTree extends Composite {
|
||||
*/
|
||||
protected void createFilterText(Composite parent) {
|
||||
filterText = doCreateFilterText(parent);
|
||||
setInitialText(Messages.getString("WorkbenchMessages.FilteredTree_FilterMessage")); //$NON-NLS-1$
|
||||
filterText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||
|
||||
/*
|
||||
@@ -546,7 +547,7 @@ public class FilteredCheckboxTree extends Composite {
|
||||
}
|
||||
});
|
||||
|
||||
filterText.addModifyListener(new ModifyListener() {
|
||||
filterTextModifyListener = new ModifyListener() {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -557,7 +558,8 @@ public class FilteredCheckboxTree extends Composite {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
textChanged();
|
||||
}
|
||||
});
|
||||
};
|
||||
filterText.addModifyListener(filterTextModifyListener);
|
||||
|
||||
GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
|
||||
// if the text widget supported cancel then it will have it's own
|
||||
@@ -595,6 +597,19 @@ public class FilteredCheckboxTree extends Composite {
|
||||
calculateCheckedLeafNodes();
|
||||
// narrowingDown = previousFilterText==null || getFilterString().startsWith(previousFilterText);
|
||||
previousFilterText = getFilterString();
|
||||
|
||||
boolean hasPatternFilter = false;
|
||||
for (ViewerFilter filter : treeViewer.getFilters()) {
|
||||
if (filter == patternFilter) {
|
||||
hasPatternFilter = true;
|
||||
}
|
||||
}
|
||||
// add pattern filter to be the last filter
|
||||
if (!hasPatternFilter) {
|
||||
patternFilter.setOtherFilters(treeViewer.getFilters());
|
||||
treeViewer.addFilter(patternFilter);
|
||||
}
|
||||
|
||||
// cancel currently running job first, to prevent unnecessary redraw
|
||||
refreshJob.cancel();
|
||||
refreshJob.schedule(200);
|
||||
@@ -776,8 +791,13 @@ public class FilteredCheckboxTree extends Composite {
|
||||
*/
|
||||
public void setInitialText(String text) {
|
||||
initialText = text;
|
||||
if (filterTextModifyListener != null) {
|
||||
filterText.removeModifyListener(filterTextModifyListener);
|
||||
}
|
||||
setFilterText(initialText);
|
||||
textChanged();
|
||||
if (filterTextModifyListener != null) {
|
||||
filterText.addModifyListener(filterTextModifyListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,13 @@ import org.eclipse.ui.internal.misc.StringMatcher;
|
||||
*/
|
||||
public class PatternFilter extends ViewerFilter {
|
||||
|
||||
private ViewerFilter[] otherFilters;
|
||||
|
||||
/**
|
||||
* Cache of element filtered by other filters
|
||||
*/
|
||||
private Map<Object, Object[]> filteredByOthersCache = new HashMap<Object, Object[]>();
|
||||
|
||||
/*
|
||||
* Cache of filtered elements in the tree
|
||||
*/
|
||||
@@ -69,6 +76,10 @@ public class PatternFilter extends ViewerFilter {
|
||||
return elements;
|
||||
}
|
||||
|
||||
if (elements.length == 0) {
|
||||
return elements;
|
||||
}
|
||||
|
||||
if (!useCache) {
|
||||
return super.filter(viewer, parent, elements);
|
||||
}
|
||||
@@ -240,7 +251,17 @@ public class PatternFilter extends ViewerFilter {
|
||||
* @return true if the given element has children that matches the filter text
|
||||
*/
|
||||
protected boolean isParentMatch(Viewer viewer, Object element) {
|
||||
Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider()).getChildren(element);
|
||||
Object[] children = filteredByOthersCache.get(element);
|
||||
if (children == null) {
|
||||
// fix for TDI-31520 , no need to check child elements already filtered by others
|
||||
children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider()).getChildren(element);
|
||||
if (otherFilters != null) {
|
||||
for (ViewerFilter filter : otherFilters) {
|
||||
children = filter.filter(viewer, element, children);
|
||||
}
|
||||
}
|
||||
filteredByOthersCache.put(element, children);
|
||||
}
|
||||
|
||||
if ((children != null) && (children.length > 0)) {
|
||||
return isAnyVisible(viewer, element, children);
|
||||
@@ -302,4 +323,13 @@ public class PatternFilter extends ViewerFilter {
|
||||
void setUseCache(boolean useCache) {
|
||||
this.useCache = useCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the otherFilters.
|
||||
*
|
||||
* @param otherFilters the otherFilters to set
|
||||
*/
|
||||
public void setOtherFilters(ViewerFilter[] otherFilters) {
|
||||
this.otherFilters = otherFilters;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,10 +98,8 @@ public abstract class ContextComposite extends Composite implements IContextMode
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
tableNebulas.setEnabled(false);
|
||||
} else {
|
||||
tableNebulas.setEnabled(enable);
|
||||
if (enable) {
|
||||
tableNebulas.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +110,7 @@ public abstract class ContextComposite extends Composite implements IContextMode
|
||||
|
||||
private void refreshView() {
|
||||
if (getContextManager() == null) {
|
||||
this.setEnabled(false);
|
||||
// this.setEnabled(false);
|
||||
tableNebulas.setEnabled(isReadOnly());
|
||||
} else {
|
||||
this.setEnabled(true);
|
||||
|
||||
@@ -123,16 +123,17 @@ public final class ContextManagerHelper {
|
||||
} catch (PersistenceException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (itemList != null) {
|
||||
List<ContextItem> toRemove = new ArrayList<ContextItem>();
|
||||
|
||||
for (ContextItem contextItem : itemList) {
|
||||
if (factory.getStatus(contextItem) == ERepositoryStatus.DELETED) {
|
||||
toRemove.add(contextItem);
|
||||
}
|
||||
}
|
||||
itemList.removeAll(toRemove);
|
||||
}
|
||||
// already did in AbstractRepositoryFactory.getContextItem()
|
||||
// if (itemList != null) {
|
||||
// List<ContextItem> toRemove = new ArrayList<ContextItem>();
|
||||
//
|
||||
// for (ContextItem contextItem : itemList) {
|
||||
// if (factory.getStatus(contextItem) == ERepositoryStatus.DELETED) {
|
||||
// toRemove.add(contextItem);
|
||||
// }
|
||||
// }
|
||||
// itemList.removeAll(toRemove);
|
||||
// }
|
||||
return itemList;
|
||||
}
|
||||
|
||||
@@ -230,21 +231,27 @@ public final class ContextManagerHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get parent objecte of the object
|
||||
*/
|
||||
public Object getParentContextItem(Object obj) {
|
||||
return getParentContextItem(obj, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* get parent object of the object
|
||||
*/
|
||||
public Object getParentContextItem(Object obj, List<ContextItem> allContextItems) {
|
||||
if (!isValid(obj)) {
|
||||
return null;
|
||||
}
|
||||
if (obj instanceof ContextItem) {
|
||||
return null;
|
||||
}
|
||||
Set<ContextItem> itemSet = getContextItems();
|
||||
if (itemSet != null) {
|
||||
if(allContextItems == null){
|
||||
allContextItems = new ArrayList<ContextItem>(getContextItems());
|
||||
}
|
||||
if (allContextItems != null) {
|
||||
// for SelectRepositoryContextDialog
|
||||
if (obj instanceof ContextParameterType) {
|
||||
for (ContextItem contextItem : itemSet) {
|
||||
for (ContextItem contextItem : allContextItems) {
|
||||
for (Object objType : contextItem.getContext()) {
|
||||
ContextType type = (ContextType) objType;
|
||||
if (type.getName().equals(contextItem.getDefaultContext())) {
|
||||
@@ -259,7 +266,7 @@ public final class ContextManagerHelper {
|
||||
}
|
||||
// for SelectRepositoryContextGroupDialog
|
||||
if (obj instanceof ContextType) {
|
||||
for (ContextItem contextItem : itemSet) {
|
||||
for (ContextItem contextItem : allContextItems) {
|
||||
if (contextItem.getContext().contains(obj)) {
|
||||
return contextItem;
|
||||
}
|
||||
@@ -272,18 +279,20 @@ public final class ContextManagerHelper {
|
||||
/*
|
||||
* get sibling objecte of the object(include self).
|
||||
*/
|
||||
public Set getSiblingContextObject(Object obj) {
|
||||
public Set getSiblingContextObject(Object obj, List<ContextItem> allContextItems) {
|
||||
if (!isValid(obj)) {
|
||||
return null;
|
||||
}
|
||||
Set<ContextItem> itemSet = getContextItems();
|
||||
if (itemSet != null) {
|
||||
if (allContextItems == null) {
|
||||
allContextItems = new ArrayList<ContextItem>(getContextItems());
|
||||
}
|
||||
if (allContextItems != null) {
|
||||
if (obj instanceof ContextItem) {
|
||||
return itemSet;
|
||||
return new HashSet(allContextItems);
|
||||
}
|
||||
// for SelectRepositoryContextDialog
|
||||
if (obj instanceof ContextParameterType) {
|
||||
for (ContextItem contextItem : getContextItems()) {
|
||||
for (ContextItem contextItem : allContextItems) {
|
||||
for (Object objType : contextItem.getContext()) {
|
||||
ContextType type = (ContextType) objType;
|
||||
if (type.getName().equals(contextItem.getDefaultContext())) {
|
||||
@@ -297,7 +306,7 @@ public final class ContextManagerHelper {
|
||||
}
|
||||
// for SelectRepositoryContextGroupDialog
|
||||
if (obj instanceof ContextType) {
|
||||
for (ContextItem contextItem : getContextItems()) {
|
||||
for (ContextItem contextItem : allContextItems) {
|
||||
if (contextItem.getContext().contains(obj)) {
|
||||
return new HashSet(contextItem.getContext());
|
||||
}
|
||||
@@ -307,6 +316,10 @@ public final class ContextManagerHelper {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set getSiblingContextObject(Object obj) {
|
||||
return getSiblingContextObject(obj, null);
|
||||
}
|
||||
|
||||
/*
|
||||
* get the have existed variables.
|
||||
@@ -342,15 +355,18 @@ public final class ContextManagerHelper {
|
||||
*
|
||||
* check that the obj is existed in job context.
|
||||
*/
|
||||
public boolean existParameterForJob(Object obj) {
|
||||
public boolean existParameterForJob(Object obj, List<ContextItem> allContextItems) {
|
||||
if (!isValid(obj)) {
|
||||
return false;
|
||||
}
|
||||
if(allContextItems == null) {
|
||||
allContextItems = new ArrayList<ContextItem>(getContextItems());
|
||||
}
|
||||
if (obj instanceof ContextItem) {
|
||||
Set<String> paramSet = this.itemNameToParametersMap.get(((ContextItem) obj).getProperty().getId());
|
||||
return paramSet != null && !paramSet.isEmpty();
|
||||
} else if (obj instanceof ContextParameterType) {
|
||||
ContextItem contextItem = (ContextItem) getParentContextItem(obj);
|
||||
ContextItem contextItem = (ContextItem) getParentContextItem(obj, allContextItems);
|
||||
if (contextItem != null) {
|
||||
Set<String> paramSet = this.itemNameToParametersMap.get(contextItem.getProperty().getId());
|
||||
return paramSet != null && paramSet.contains(((ContextParameterType) obj).getName());
|
||||
@@ -358,7 +374,11 @@ public final class ContextManagerHelper {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean existParameterForJob(Object obj) {
|
||||
return existParameterForJob(obj, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ggu Comment method "convertFormat".
|
||||
|
||||
@@ -14,8 +14,10 @@ package org.talend.core.ui.context;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
@@ -53,6 +55,7 @@ import org.talend.core.model.metadata.types.ContextParameterJavaTypeManager;
|
||||
import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IContextManager;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
|
||||
import org.talend.core.ui.context.model.ContextTabChildModel;
|
||||
@@ -340,10 +343,10 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
|
||||
ContextTableTabChildModel childModel = (ContextTableTabChildModel) object;
|
||||
removeChildModelInGroupBySource(childModel);
|
||||
}
|
||||
|
||||
modelManager.refresh();
|
||||
setButtonEnableState();
|
||||
}
|
||||
modelManager.refresh();
|
||||
setButtonEnableState();
|
||||
|
||||
if (!treeTable.getSelection().isEmpty()) {
|
||||
treeTable.clearSelection();
|
||||
}
|
||||
@@ -586,30 +589,10 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
|
||||
}
|
||||
} else {
|
||||
reInitializeUI();
|
||||
if (contextsCombo.getItems().length > 0) {
|
||||
contextsCombo.removeAll();
|
||||
}
|
||||
if (modelManager.getContextManager() != null) {
|
||||
for (IContext context : modelManager.getContextManager().getListContext()) {
|
||||
if (!Arrays.asList(contextsCombo.getItems()).contains(context.getName())) {
|
||||
contextsCombo.add(context.getName());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < contextsCombo.getItemCount(); i++) {
|
||||
IContext defaultContext = modelManager.getContextManager().getDefaultContext();
|
||||
if (defaultContext.getName().equals(contextsCombo.getItem(i))) {
|
||||
contextsCombo.select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
initializeContextCombo();
|
||||
|
||||
int visibleItemCount = contextsCombo.getItemCount();
|
||||
if (visibleItemCount > 20) {
|
||||
visibleItemCount = 20;
|
||||
}
|
||||
contextsCombo.setVisibleItemCount(visibleItemCount);
|
||||
checkContextGroupSource();
|
||||
|
||||
// dispose the data table composite
|
||||
disposeDataTable();
|
||||
@@ -625,6 +608,83 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeContextCombo() {
|
||||
IContextManager contextManager = getContextManager();
|
||||
if (contextsCombo.getItems().length > 0) {
|
||||
contextsCombo.removeAll();
|
||||
}
|
||||
if (contextManager != null) {
|
||||
List<IContext> contexts = contextManager.getListContext();
|
||||
for (IContext context : contexts) {
|
||||
if (!Arrays.asList(contextsCombo.getItems()).contains(context.getName())) {
|
||||
contextsCombo.add(context.getName());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < contextsCombo.getItemCount(); i++) {
|
||||
IContext defaultContext = contextManager.getDefaultContext();
|
||||
if (defaultContext.getName().equals(contextsCombo.getItem(i))) {
|
||||
contextsCombo.select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int visibleItemCount = contextsCombo.getItemCount();
|
||||
if (visibleItemCount > 20) {
|
||||
visibleItemCount = 20;
|
||||
}
|
||||
contextsCombo.setVisibleItemCount(visibleItemCount);
|
||||
}
|
||||
|
||||
private void checkContextGroupSource() {
|
||||
IContextManager contextManager = getContextManager();
|
||||
if (helper == null) {
|
||||
return;
|
||||
}
|
||||
if (contextManager != null) {
|
||||
helper.initHelper(contextManager);
|
||||
Map<String, Item> items = new HashMap<String, Item>();
|
||||
boolean needRefresh = false;
|
||||
for (IContextParameter param : contextManager.getDefaultContext().getContextParameterList()) {
|
||||
if (!param.isBuiltIn()) {
|
||||
String source = param.getSource();
|
||||
Item sourceItem = items.get(source);
|
||||
if (sourceItem == null) {
|
||||
sourceItem = ContextUtils.getRepositoryContextItemById(source);
|
||||
}
|
||||
if (sourceItem == null) { // source not found
|
||||
needRefresh = true;
|
||||
param.setSource(IContextParameter.BUILT_IN);
|
||||
propagateType(contextManager, param);
|
||||
} else {
|
||||
items.put(source, sourceItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needRefresh) {
|
||||
setModifiedFlag(contextManager);
|
||||
modelManager.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setModifiedFlag(IContextManager contextManager) {
|
||||
if (contextManager != null && contextManager instanceof JobContextManager) {
|
||||
JobContextManager manager = (JobContextManager) contextManager;
|
||||
manager.setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void propagateType(IContextManager contextManager, IContextParameter param) {
|
||||
for (IContext context : contextManager.getListContext()) {
|
||||
IContextParameter paramToModify = context.getContextParameter(param.getName());
|
||||
paramToModify.setType(param.getType());
|
||||
paramToModify.setComment(param.getComment());
|
||||
paramToModify.setSource(param.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeDataTable() {
|
||||
if (contextTableComp != null && !contextTableComp.isDisposed()) {
|
||||
for (Control control : contextTableComp.getChildren()) {
|
||||
|
||||
@@ -264,7 +264,7 @@ public class ContextTreeTable {
|
||||
natTable = new NatTable(parent, NatTable.DEFAULT_STYLE_OPTIONS | SWT.BORDER, gridLayer, false);
|
||||
natTable.setConfigRegistry(configRegistry);
|
||||
|
||||
addCustomStylingBehaviour(parent.getFont(), bodyDataProvider, columnGroupModel, manager.getContextManager());
|
||||
addCustomStylingBehaviour(parent.getFont(), bodyDataProvider, columnGroupModel, manager);
|
||||
|
||||
addCustomContextMenuBehavior(manager, bodyDataProvider, selectionProvider);
|
||||
|
||||
@@ -503,13 +503,14 @@ public class ContextTreeTable {
|
||||
}
|
||||
|
||||
private void addCustomStylingBehaviour(Font contextFont, final GlazedListsDataProvider<ContextTreeNode> bodyDataProvider,
|
||||
ColumnGroupModel groupModel, IContextManager contextManager) {
|
||||
ColumnGroupModel groupModel, IContextModelManager modelManager) {
|
||||
ContextNatTableStyleConfiguration natTableConfiguration = new ContextNatTableStyleConfiguration(contextFont);
|
||||
natTableConfiguration.cellPainter = new ContextNatTableBackGroudPainter(new ContextAutoResizeTextPainter(false, false,
|
||||
true), bodyDataProvider);
|
||||
|
||||
natTable.addConfiguration(natTableConfiguration);
|
||||
natTable.addConfiguration(new ContextNatTableConfiguration(bodyDataProvider, groupModel, contextManager));
|
||||
natTable.addConfiguration(new ContextNatTableConfiguration(bodyDataProvider, groupModel,
|
||||
modelManager.getContextManager(), modelManager));
|
||||
}
|
||||
|
||||
private void addCustomContextMenuBehavior(final IContextModelManager modelManager,
|
||||
@@ -518,7 +519,8 @@ public class ContextTreeTable {
|
||||
}
|
||||
|
||||
private void addContextColumnGroupsBehaviour(ColumnGroupHeaderLayer columnHeaderLayer, List<IContext> contexts) {
|
||||
int i = 1;
|
||||
// 0=Name,1=Type,2=Comment.
|
||||
int i = 2;
|
||||
for (IContext context : contexts) {
|
||||
String evnContext = context.getName();
|
||||
columnHeaderLayer.addColumnsIndexesToGroup(evnContext, new int[] { ++i, ++i, ++i });
|
||||
@@ -528,8 +530,10 @@ public class ContextTreeTable {
|
||||
private void registerColumnLabels(ColumnOverrideLabelAccumulator columnLabelAccumulator, List<IContext> contexts) {
|
||||
columnLabelAccumulator.registerColumnOverrides(0, new String[] { ContextTableConstants.COLUMN_NAME_PROPERTY });
|
||||
columnLabelAccumulator.registerColumnOverrides(1, new String[] { ContextTableConstants.COLUMN_TYPE_PROPERTY });
|
||||
columnLabelAccumulator.registerColumnOverrides(2, new String[] { ContextTableConstants.COLUMN_COMMENT_PROPERTY });
|
||||
// the columns after "type" will caculated by the contexts
|
||||
int j = 2;
|
||||
// 0=Name,1=Type,2=Comment.
|
||||
int j = 3;
|
||||
for (int i = 0; i < contexts.size(); i++) {
|
||||
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_CONTEXT_VALUE });
|
||||
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_CHECK_PROPERTY });
|
||||
|
||||
@@ -344,8 +344,8 @@ public class SelectRepositoryContextDialog extends SelectionDialog {
|
||||
parent = obj; // self
|
||||
siblings = new HashSet(helper.getContextParameterType((ContextItem) obj)); // child
|
||||
} else if (obj instanceof ContextParameterType) {
|
||||
parent = helper.getParentContextItem(obj);
|
||||
siblings = helper.getSiblingContextObject(obj);
|
||||
parent = helper.getParentContextItem(obj, contextItemList);
|
||||
siblings = helper.getSiblingContextObject(obj, contextItemList);
|
||||
}
|
||||
if (parent == null || siblings == null) {
|
||||
return;
|
||||
@@ -387,16 +387,19 @@ public class SelectRepositoryContextDialog extends SelectionDialog {
|
||||
for (ContextItem item : contextItemList) {
|
||||
ContextType type = getDefaultContextType(item);
|
||||
if (type != null) {
|
||||
for (Object paramObj : type.getContextParameter()) {
|
||||
ContextParameterType paramType = (ContextParameterType) paramObj;
|
||||
if (helper.existParameterForJob(paramType)) {
|
||||
List<?> paramList = type.getContextParameter();
|
||||
for (int i = 0; i < paramList.size(); i++) {
|
||||
final ContextParameterType paramType = (ContextParameterType) paramList.get(i);
|
||||
if (helper.existParameterForJob(paramType, contextItemList)) {
|
||||
treeViewer.setChecked(paramType, true);
|
||||
}
|
||||
// only check parent state once at then end of the loop to avoid Cartesian product.
|
||||
if (i == paramList.size() - 1) {
|
||||
updateParentCheckedState(paramType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ContextParameterType hasSelectedParam(ContextParameterType paramType) {
|
||||
|
||||
@@ -149,6 +149,7 @@ public class CheckAndAddContextDNDCommand extends Command {
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
helper.refreshContextView();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ public class CheckAndAddContextVariablesCommand extends Command {
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
helper.refreshContextView();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -269,6 +269,7 @@ public class MergeContextVariablesCommand extends Command {
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
helper.refreshContextView();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2015 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -21,6 +21,8 @@ public class ContextTableConstants {
|
||||
|
||||
public static final String COLUMN_TYPE_PROPERTY = "Type"; //$NON-NLS-1$
|
||||
|
||||
public static final String COLUMN_COMMENT_PROPERTY = "Comment"; //$NON-NLS-1$
|
||||
|
||||
public static final String COLUMN_CHECK_PROPERTY = ""; //$NON-NLS-1$
|
||||
|
||||
public static final String COLUMN_PROMPT_PROPERTY = "Prompt"; //$NON-NLS-1$
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.talend.core.model.metadata.types.ContextParameterJavaTypeManager;
|
||||
import org.talend.core.model.process.IContextManager;
|
||||
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
|
||||
import org.talend.core.ui.context.IContextModelManager;
|
||||
import org.talend.core.ui.context.model.ContextTabChildModel;
|
||||
import org.talend.core.ui.context.model.table.ContextTableConstants;
|
||||
|
||||
@@ -60,16 +61,22 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
|
||||
private IContextManager manager;
|
||||
|
||||
private IContextModelManager modelManager;
|
||||
|
||||
private ProxyDynamicCellEditor cutomCellEditor;
|
||||
|
||||
/**
|
||||
* DOC ldong ContextNatTableConfiguration constructor comment.
|
||||
*
|
||||
* @param dataProvider
|
||||
*/
|
||||
public ContextNatTableConfiguration(IDataProvider dataProvider, ColumnGroupModel columnGroupModel, IContextManager manager) {
|
||||
public ContextNatTableConfiguration(IDataProvider dataProvider, ColumnGroupModel columnGroupModel, IContextManager manager,
|
||||
IContextModelManager modelManager) {
|
||||
super();
|
||||
this.dataProvider = dataProvider;
|
||||
this.columnGroupModel = columnGroupModel;
|
||||
this.manager = manager;
|
||||
this.modelManager = modelManager;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -95,6 +102,8 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
ContextTableConstants.COLUMN_NAME_PROPERTY);
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, getEditRule(), DisplayMode.EDIT,
|
||||
ContextTableConstants.COLUMN_TYPE_PROPERTY);
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, getEditRule(), DisplayMode.EDIT,
|
||||
ContextTableConstants.COLUMN_COMMENT_PROPERTY);
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, getEditRule(), DisplayMode.EDIT,
|
||||
ContextTableConstants.COLUMN_CHECK_PROPERTY);
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, getEditRule(), DisplayMode.EDIT,
|
||||
@@ -113,6 +122,9 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
|
||||
ContextTableConstants.COLUMN_NAME_PROPERTY);
|
||||
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
|
||||
ContextTableConstants.COLUMN_COMMENT_PROPERTY);
|
||||
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleDefault, DisplayMode.NORMAL,
|
||||
ContextTableConstants.COLUMN_CHECK_PROPERTY);
|
||||
|
||||
@@ -132,6 +144,9 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleSelect, DisplayMode.SELECT,
|
||||
ContextTableConstants.COLUMN_NAME_PROPERTY);
|
||||
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleSelect, DisplayMode.SELECT,
|
||||
ContextTableConstants.COLUMN_COMMENT_PROPERTY);
|
||||
|
||||
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyleSelect, DisplayMode.SELECT,
|
||||
ContextTableConstants.COLUMN_CHECK_PROPERTY);
|
||||
|
||||
@@ -157,6 +172,9 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
|
||||
@Override
|
||||
public boolean isEditable(int columnIndex, int rowIndex) {
|
||||
if (modelManager != null && modelManager.isReadOnly()) {
|
||||
return false;
|
||||
}
|
||||
ContextTreeNode rowNode = ((GlazedListsDataProvider<ContextTreeNode>) dataProvider).getRowObject(rowIndex);
|
||||
if (ContextNatTableUtils.isEmptyTreeNode(rowNode.getTreeData())) {
|
||||
return false;
|
||||
@@ -178,6 +196,7 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
registerColumnThreeCheckBoxEditor(configRegistry);
|
||||
registerColumnFourTextEditor(configRegistry);
|
||||
registerColumnFiveTextEditor(configRegistry);
|
||||
registerColumnSixTextEditor(configRegistry);
|
||||
}
|
||||
|
||||
private void registerColumnFirstTextEditor(IConfigRegistry configRegistry) {
|
||||
@@ -296,6 +315,11 @@ public class ContextNatTableConfiguration extends AbstractRegistryConfiguration
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, cutomCellEditor, DisplayMode.EDIT,
|
||||
ContextTableConstants.COLUMN_CONTEXT_VALUE);
|
||||
}
|
||||
|
||||
private void registerColumnSixTextEditor(IConfigRegistry configRegistry) {
|
||||
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(true, true),
|
||||
DisplayMode.NORMAL, ContextTableConstants.COLUMN_COMMENT_PROPERTY);
|
||||
}
|
||||
|
||||
public class ContextCheckDisplayConverter extends DefaultBooleanDisplayConverter {
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.talend.core.model.properties.ContextItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Project;
|
||||
import org.talend.core.ui.context.IContextModelManager;
|
||||
import org.talend.core.ui.context.model.table.ContextTableConstants;
|
||||
import org.talend.core.ui.context.model.table.ContextTableTabChildModel;
|
||||
import org.talend.core.ui.context.model.table.ContextTableTabParentModel;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
@@ -55,9 +54,7 @@ public class ContextNatTableUtils {
|
||||
IContextParameter para = null;
|
||||
IContext context = null;
|
||||
if (manager != null) {
|
||||
if (!(property.equals(ContextTableConstants.COLUMN_NAME_PROPERTY))) {
|
||||
context = manager.getContext(property);
|
||||
}
|
||||
context = manager.getContext(property);
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -47,11 +47,12 @@ public class ContextRowDataListFixture {
|
||||
|
||||
public static String[] getPropertyNames(IContextModelManager manager) {
|
||||
List<IContext> contexts = getContexts(manager.getContextManager());
|
||||
int columnCount = contexts.size() * 3 + 2;
|
||||
int columnCount = contexts.size() * 3 + 3;
|
||||
String[] columnsName = new String[columnCount];
|
||||
int i = 0;
|
||||
columnsName[i++] = ContextTableConstants.COLUMN_NAME_PROPERTY;
|
||||
columnsName[i++] = ContextTableConstants.COLUMN_TYPE_PROPERTY;
|
||||
columnsName[i++] = ContextTableConstants.COLUMN_COMMENT_PROPERTY;
|
||||
if (contexts.size() > 0) {
|
||||
for (IContext context : contexts) {
|
||||
columnsName[i++] = ContextTableConstants.COLUMN_CONTEXT_VALUE;
|
||||
|
||||
@@ -170,6 +170,8 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
} else {
|
||||
return contextParaType;
|
||||
}
|
||||
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_COMMENT_PROPERTY)) {
|
||||
return currentParam.getComment();
|
||||
} else {
|
||||
if (this.groupModel.isPartOfAGroup(columnIndex)) {
|
||||
String columnGroupName = this.groupModel.getColumnGroupByIndex(columnIndex).getName();
|
||||
@@ -261,6 +263,14 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
}
|
||||
Command cmd = new SetContextNameCommand(manager, contextPara, newParaName, sourceId);
|
||||
runCommand(cmd, manager);
|
||||
} else if (currentColumnName.equals(ContextTableConstants.COLUMN_COMMENT_PROPERTY)) {
|
||||
ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
|
||||
IContextParameter contextPara = parent.getContextParameter();
|
||||
if (contextPara.getComment() == ((String) newValue)) {
|
||||
return;
|
||||
}
|
||||
Command cmd = new setContextCommentCommand(manager, contextPara, (String)newValue);
|
||||
runCommand(cmd, manager);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,9 +299,7 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
IContextParameter para = null;
|
||||
IContext context = null;
|
||||
if (manager != null) {
|
||||
if (!(property.equals(ContextTableConstants.COLUMN_NAME_PROPERTY))) {
|
||||
context = manager.getContext(property);
|
||||
}
|
||||
context = manager.getContext(property);
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -488,6 +496,87 @@ public class ExtendedContextColumnPropertyAccessor<R> implements IColumnProperty
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class setContextCommentCommand extends Command {
|
||||
|
||||
|
||||
IContextParameter param;
|
||||
|
||||
IContextModelManager modelManager;
|
||||
|
||||
String newValue, oldValue;
|
||||
|
||||
public setContextCommentCommand(IContextModelManager modelManager, IContextParameter param, String newValue) {
|
||||
super();
|
||||
this.modelManager = modelManager;
|
||||
this.param = param;
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if(newValue == null) {
|
||||
newValue = "";
|
||||
}
|
||||
boolean modified = false;
|
||||
if (modelManager.getContextManager() != null) {
|
||||
for (IContext context : modelManager.getContextManager().getListContext()) {
|
||||
for (IContextParameter contextParameter : context.getContextParameterList()) {
|
||||
if (param.getName().equals(contextParameter.getName())) {
|
||||
oldValue = param.getComment();
|
||||
param.setComment(newValue);
|
||||
contextParameter.setComment(newValue);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
updateRelation();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.gef.commands.Command#undo()
|
||||
*/
|
||||
@Override
|
||||
public void undo() {
|
||||
boolean modified = false;
|
||||
if (modelManager.getContextManager() != null) {
|
||||
for (IContext context : modelManager.getContextManager().getListContext()) {
|
||||
for (IContextParameter contextParameter : context.getContextParameterList()) {
|
||||
if (param.getName().equals(contextParameter.getName())) {
|
||||
param.setComment(oldValue);
|
||||
contextParameter.setComment(oldValue);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
updateRelation();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRelation() {
|
||||
// set updated flag.
|
||||
if (param != null) {
|
||||
IContextManager manager = modelManager.getContextManager();
|
||||
if (manager != null && manager instanceof JobContextManager) {
|
||||
JobContextManager jobContextManager = (JobContextManager) manager;
|
||||
// not added new
|
||||
if (!modelManager.isRepositoryContext() || modelManager.isRepositoryContext()
|
||||
&& jobContextManager.isOriginalParameter(param.getName())) {
|
||||
jobContextManager.setModified(true);
|
||||
manager.fireContextsChangedEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SetContextNameCommand extends Command {
|
||||
|
||||
|
||||
@@ -12,48 +12,20 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.metadata.celleditor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.DialogCellEditor;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.ListViewer;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.AbstractDataTableEditorView;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
|
||||
import org.talend.commons.ui.swt.formtools.LabelledFileField;
|
||||
import org.talend.commons.ui.swt.tableviewer.TableViewerCreator;
|
||||
import org.talend.commons.utils.io.FilesUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.process.IElement;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.IGEFProcess;
|
||||
@@ -61,7 +33,6 @@ import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.service.IDesignerCoreUIService;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
|
||||
/**
|
||||
* ggu class global comment. Detailled comment
|
||||
@@ -126,7 +97,7 @@ public class ModuleListCellEditor extends DialogCellEditor {
|
||||
@Override
|
||||
protected Object openDialogBox(Control cellEditorWindow) {
|
||||
String value = (String) getValue();
|
||||
ModuleListDialog dialog = new ModuleListDialog(cellEditorWindow.getShell(), value);
|
||||
ModuleListDialog dialog = new ModuleListDialog(cellEditorWindow.getShell(), value, this.param, false);
|
||||
if (dialog.open() == Window.OK) {
|
||||
String selecteModule = dialog.getSelecteModule();
|
||||
if (selecteModule != null && (value == null || !value.equals(selecteModule))) {
|
||||
@@ -199,198 +170,4 @@ public class ModuleListCellEditor extends DialogCellEditor {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ggu ModuleListDialog class global comment. Detailled comment
|
||||
*/
|
||||
class ModuleListDialog extends Dialog {
|
||||
|
||||
private String selecteModule;
|
||||
|
||||
private Button innerBtn, extBtn;
|
||||
|
||||
private ListViewer jarsViewer;
|
||||
|
||||
private LabelledFileField selectField;
|
||||
|
||||
private boolean isInner;
|
||||
|
||||
protected ModuleListDialog(Shell parentShell, String selecteModule) {
|
||||
super(parentShell);
|
||||
this.selecteModule = selecteModule;
|
||||
this.setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText(Messages.getString("ModuleListCellEditor.title")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#create()
|
||||
*/
|
||||
@Override
|
||||
public void create() {
|
||||
super.create();
|
||||
checkField(true); // init
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite composite = (Composite) super.createDialogArea(parent);
|
||||
|
||||
Group group = new Group(composite, SWT.NONE);
|
||||
group.setLayout(new GridLayout(2, false));
|
||||
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
innerBtn = new Button(group, SWT.RADIO);
|
||||
innerBtn.setText(Messages.getString("ModuleListCellEditor.innerLabel")); //$NON-NLS-1$
|
||||
extBtn = new Button(group, SWT.RADIO);
|
||||
extBtn.setText(Messages.getString("ModuleListCellEditor.externalLabel")); //$NON-NLS-1$
|
||||
|
||||
Composite comp = new Composite(composite, SWT.NONE);
|
||||
comp.setLayout(new GridLayout());
|
||||
GridData layoutData = new GridData(GridData.FILL_BOTH);
|
||||
layoutData.minimumHeight = 150;
|
||||
layoutData.minimumWidth = 450;
|
||||
layoutData.heightHint = 150;
|
||||
layoutData.widthHint = 450;
|
||||
comp.setLayoutData(layoutData);
|
||||
|
||||
//
|
||||
jarsViewer = new ListViewer(comp, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
jarsViewer.setContentProvider(new ArrayContentProvider());
|
||||
jarsViewer.setLabelProvider(new LabelProvider() {
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
String text = getText(element);
|
||||
if (text != null && !text.equals(selecteModule)) {
|
||||
return ImageProvider.getImage(EImage.LOCK_ICON);
|
||||
}
|
||||
return super.getImage(element);
|
||||
}
|
||||
|
||||
});
|
||||
jarsViewer.setInput(param.getListItemsDisplayName());
|
||||
jarsViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
Composite c = new Composite(comp, SWT.NONE);
|
||||
c.setLayout(new GridLayout(3, false));
|
||||
c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
selectField = new LabelledFileField(c,
|
||||
Messages.getString("ModuleListCellEditor.selectLabel"), FilesUtils.getAcceptJARFilesSuffix()); //$NON-NLS-1$
|
||||
|
||||
addListeners();
|
||||
// checkField(true); // init
|
||||
jarsViewer.getList().setSelection(new String[] { selecteModule });
|
||||
return composite;
|
||||
}
|
||||
|
||||
private void addListeners() {
|
||||
innerBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
checkField(true);
|
||||
}
|
||||
|
||||
});
|
||||
extBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
checkField(false);
|
||||
}
|
||||
|
||||
});
|
||||
jarsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
if (jarsViewer.getList().getSelection().length <= 0) {
|
||||
getOKButton().setEnabled(false);
|
||||
} else {
|
||||
getOKButton().setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
selectField.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (selectField.getText().trim().length()<=0) {
|
||||
getOKButton().setEnabled(false);
|
||||
} else {
|
||||
getOKButton().setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkField(boolean inner) {
|
||||
innerBtn.setSelection(inner);
|
||||
extBtn.setSelection(!inner);
|
||||
jarsViewer.getList().setVisible(inner);
|
||||
((GridData) jarsViewer.getList().getLayoutData()).exclude = !inner;
|
||||
selectField.getTextControl().getParent().setVisible(!inner);
|
||||
((GridData) selectField.getTextControl().getParent().getLayoutData()).exclude = inner;
|
||||
jarsViewer.getList().getParent().layout();
|
||||
boolean canFinish = true;
|
||||
if (innerBtn.getSelection()) {
|
||||
if (jarsViewer.getList().getSelection().length <= 0) {
|
||||
canFinish = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
String fileName = selectField.getText().trim();
|
||||
if (fileName.length() <= 0) {
|
||||
canFinish = false;
|
||||
}
|
||||
}
|
||||
if (getOKButton() != null) {
|
||||
getOKButton().setEnabled(canFinish);
|
||||
}
|
||||
}
|
||||
|
||||
public String getSelecteModule() {
|
||||
return this.selecteModule;
|
||||
}
|
||||
|
||||
public boolean isInner() {
|
||||
return isInner;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
isInner = innerBtn.getSelection();
|
||||
if (isInner) {
|
||||
if (jarsViewer.getList().getSelection().length > 0) {
|
||||
selecteModule = jarsViewer.getList().getSelection()[0];
|
||||
}
|
||||
} else {
|
||||
IPath path = Path.fromOSString(selectField.getText());
|
||||
File source = path.toFile();
|
||||
if (!source.exists()) {
|
||||
MessageDialog.openWarning(getParentShell(), "File Not Found", path
|
||||
+ " is not Found,Please make sure the file is exist!");
|
||||
return;
|
||||
}
|
||||
String lastSegment = path.lastSegment();
|
||||
try {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
|
||||
ILibrariesService service = (ILibrariesService) GlobalServiceRegister.getDefault().getService(
|
||||
ILibrariesService.class);
|
||||
service.deployLibrary(path.toFile().toURI().toURL());
|
||||
}
|
||||
} catch (IOException ee) {
|
||||
ExceptionHandler.process(ee);
|
||||
}
|
||||
selecteModule = lastSegment;
|
||||
}
|
||||
super.okPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,387 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.metadata.celleditor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.ListViewer;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.formtools.LabelledFileField;
|
||||
import org.talend.commons.utils.io.FilesUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.librariesmanager.model.ModulesNeededProvider;
|
||||
|
||||
/**
|
||||
* created by hwang on Dec 24, 2014 Detailled comment copied from ModuleListCellEditor/ModuleListDialog
|
||||
*/
|
||||
public class ModuleListDialog extends Dialog {
|
||||
|
||||
private String selecteModule;
|
||||
|
||||
private Button innerBtn, extBtn, addBtn, delBtn;;
|
||||
|
||||
private ListViewer jarsViewer;
|
||||
|
||||
private LabelledFileField selectField;
|
||||
|
||||
private boolean isInner;
|
||||
|
||||
private boolean isJDBCCreate = false;
|
||||
|
||||
private IElementParameter param;
|
||||
|
||||
private String[] selecteModuleArray = null;
|
||||
|
||||
private String[] moduleNameArray = null;
|
||||
|
||||
private List<String> jarsList = new ArrayList<String>();
|
||||
|
||||
public ModuleListDialog(Shell parentShell, String selecteModule, IElementParameter param, boolean isJDBCCreate) {
|
||||
super(parentShell);
|
||||
this.selecteModule = selecteModule;
|
||||
this.param = param;
|
||||
this.isJDBCCreate = isJDBCCreate;
|
||||
this.setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||
initModuleArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText(Messages.getString("ModuleListCellEditor.title")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#create()
|
||||
*/
|
||||
@Override
|
||||
public void create() {
|
||||
super.create();
|
||||
checkField(true); // init
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite composite = (Composite) super.createDialogArea(parent);
|
||||
|
||||
Group group = new Group(composite, SWT.NONE);
|
||||
group.setLayout(new GridLayout(2, false));
|
||||
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
innerBtn = new Button(group, SWT.RADIO);
|
||||
innerBtn.setText(Messages.getString("ModuleListCellEditor.innerLabel")); //$NON-NLS-1$
|
||||
extBtn = new Button(group, SWT.RADIO);
|
||||
extBtn.setText(Messages.getString("ModuleListCellEditor.externalLabel")); //$NON-NLS-1$
|
||||
|
||||
Composite comp = new Composite(composite, SWT.NONE);
|
||||
comp.setLayout(new GridLayout());
|
||||
GridData layoutData = new GridData(GridData.FILL_BOTH);
|
||||
layoutData.minimumHeight = 150;
|
||||
layoutData.minimumWidth = 450;
|
||||
layoutData.heightHint = 150;
|
||||
layoutData.widthHint = 450;
|
||||
comp.setLayoutData(layoutData);
|
||||
|
||||
int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL;
|
||||
if (isJDBCCreate) {
|
||||
style = SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL;
|
||||
}
|
||||
jarsViewer = new ListViewer(comp, style);
|
||||
jarsViewer.setContentProvider(new ArrayContentProvider());
|
||||
jarsViewer.setLabelProvider(new LabelProvider() {
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
String text = getText(element);
|
||||
if (text != null && !text.equals(selecteModule)) {
|
||||
return ImageProvider.getImage(EImage.LOCK_ICON);
|
||||
}
|
||||
return super.getImage(element);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jarsViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
Composite buttnComp = new Composite(comp, SWT.NONE);
|
||||
buttnComp.setLayout(new GridLayout(2, false));
|
||||
addBtn = new Button(buttnComp, SWT.PUSH);
|
||||
addBtn.setText(Messages.getString("ModuleListCellEditor.add")); //$NON-NLS-1$
|
||||
delBtn = new Button(buttnComp, SWT.PUSH);
|
||||
delBtn.setText(Messages.getString("ModuleListCellEditor.delete")); //$NON-NLS-1$
|
||||
|
||||
Composite c = new Composite(comp, SWT.NONE);
|
||||
c.setLayout(new GridLayout(3, false));
|
||||
c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
selectField = new LabelledFileField(c,
|
||||
Messages.getString("ModuleListCellEditor.selectLabel"), FilesUtils.getAcceptJARFilesSuffix()); //$NON-NLS-1$
|
||||
|
||||
addListeners();
|
||||
// checkField(true); // init
|
||||
jarsViewer.getList().setSelection(new String[] { selecteModule });
|
||||
return composite;
|
||||
}
|
||||
|
||||
private void addListeners() {
|
||||
innerBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
checkField(true);
|
||||
}
|
||||
|
||||
});
|
||||
extBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
checkField(false);
|
||||
}
|
||||
|
||||
});
|
||||
jarsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
if (jarsViewer.getList().getSelection().length <= 0) {
|
||||
getOKButton().setEnabled(false);
|
||||
} else {
|
||||
getOKButton().setEnabled(true);
|
||||
}
|
||||
selecteModuleArray = jarsViewer.getList().getSelection();
|
||||
}
|
||||
});
|
||||
selectField.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (selectField.getText().trim().length() <= 0) {
|
||||
getOKButton().setEnabled(false);
|
||||
} else {
|
||||
getOKButton().setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
addBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
FileDialog dialog = new FileDialog(getShell());
|
||||
dialog.setFilterExtensions(new String[] { "*.jar", "*.zip", "*.*", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
String userDir = System.getProperty("user.dir"); //$NON-NLS-1$
|
||||
String pathSeparator = System.getProperty("file.separator"); //$NON-NLS-1$
|
||||
dialog.setFilterPath(userDir + pathSeparator + "lib" + pathSeparator + "java"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String path = dialog.open();
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
if (!jarsList.contains(path)) {
|
||||
jarsList.add(path);
|
||||
jarsViewer.setInput(jarsList);
|
||||
} else {
|
||||
MessageDialog.openWarning(
|
||||
getShell(),
|
||||
Messages.getString("ModuleListCellEditor.warningTitle"), Messages.getString("ModuleListCellEditor.warningMessage")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
if (jarsList.size() > 0) {
|
||||
getOKButton().setEnabled(true);
|
||||
} else {
|
||||
getOKButton().setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
delBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
for (Object o : ((StructuredSelection) jarsViewer.getSelection()).toList()) {
|
||||
jarsList.remove(o);
|
||||
}
|
||||
jarsViewer.setInput(jarsList);
|
||||
|
||||
if (jarsList.size() > 0) {
|
||||
getOKButton().setEnabled(true);
|
||||
} else {
|
||||
getOKButton().setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkField(boolean inner) {
|
||||
innerBtn.setSelection(inner);
|
||||
extBtn.setSelection(!inner);
|
||||
jarsViewer.getList().setVisible(inner || isJDBCCreate);
|
||||
((GridData) jarsViewer.getList().getLayoutData()).exclude = !inner && !isJDBCCreate;
|
||||
selectField.getTextControl().getParent().setVisible(!inner && !isJDBCCreate);
|
||||
((GridData) selectField.getTextControl().getParent().getLayoutData()).exclude = inner || isJDBCCreate;
|
||||
addBtn.getParent().setVisible(!inner && isJDBCCreate);
|
||||
((GridData) addBtn.getParent().getLayoutData()).exclude = inner || !isJDBCCreate;
|
||||
jarsViewer.getList().getParent().layout();
|
||||
|
||||
jarsViewer.getList().removeAll();
|
||||
if (inner) {
|
||||
jarsViewer.setInput(this.moduleNameArray);
|
||||
if (selecteModuleArray != null) {
|
||||
jarsViewer.getList().setSelection(selecteModuleArray);
|
||||
} else if (selecteModule != null) {
|
||||
if (selecteModule.contains(";")) {
|
||||
String[] names = selecteModule.trim().split(";");
|
||||
jarsViewer.getList().setSelection(names);
|
||||
} else {
|
||||
jarsViewer.getList().setSelection(new String[] { selecteModule });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
jarsViewer.setInput(jarsList);
|
||||
}
|
||||
|
||||
boolean canFinish = true;
|
||||
if (innerBtn.getSelection()) {
|
||||
if (jarsViewer.getList().getSelection().length <= 0) {
|
||||
canFinish = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (isJDBCCreate) {
|
||||
if (jarsList.size() <= 0) {
|
||||
canFinish = false;
|
||||
}
|
||||
} else {
|
||||
String fileName = selectField.getText().trim();
|
||||
if (fileName.length() <= 0) {
|
||||
canFinish = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (getOKButton() != null) {
|
||||
getOKButton().setEnabled(canFinish);
|
||||
}
|
||||
}
|
||||
|
||||
public String getSelecteModule() {
|
||||
return this.selecteModule;
|
||||
}
|
||||
|
||||
public boolean isInner() {
|
||||
return isInner;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
isInner = innerBtn.getSelection();
|
||||
if (isInner) {
|
||||
if (isJDBCCreate) {
|
||||
selecteModuleArray = jarsViewer.getList().getSelection();
|
||||
} else {
|
||||
selecteModuleArray = null;
|
||||
selecteModule = jarsViewer.getList().getSelection()[0];
|
||||
}
|
||||
} else {
|
||||
List<String> pathList = new ArrayList<String>();
|
||||
if (isJDBCCreate) {
|
||||
pathList.addAll(jarsList);
|
||||
} else {
|
||||
selecteModuleArray = null;
|
||||
pathList.add(selectField.getText());
|
||||
}
|
||||
String[] jarNames = new String[pathList.size()];
|
||||
for (int i = 0; i < pathList.size(); i++) {
|
||||
String jarPath = pathList.get(i);
|
||||
IPath path = Path.fromOSString(jarPath);
|
||||
File source = path.toFile();
|
||||
if (!source.exists()) {
|
||||
MessageDialog.openWarning(getParentShell(), "File Not Found", path
|
||||
+ " is not Found,Please make sure the file is exist!");
|
||||
return;
|
||||
}
|
||||
String lastSegment = path.lastSegment();
|
||||
try {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
|
||||
ILibrariesService service = (ILibrariesService) GlobalServiceRegister.getDefault().getService(
|
||||
ILibrariesService.class);
|
||||
service.deployLibrary(path.toFile().toURI().toURL());
|
||||
}
|
||||
} catch (IOException ee) {
|
||||
ExceptionHandler.process(ee);
|
||||
}
|
||||
selecteModule = lastSegment;
|
||||
jarNames[i] = lastSegment;
|
||||
}
|
||||
if (isJDBCCreate) {
|
||||
selecteModuleArray = jarNames;
|
||||
}
|
||||
}
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
private void initModuleArray() {
|
||||
if (param != null) {
|
||||
this.moduleNameArray = param.getListItemsDisplayName();
|
||||
return;
|
||||
}
|
||||
List<ModuleNeeded> moduleNeededList = ModulesNeededProvider.getModulesNeeded();
|
||||
Set<String> moduleNameList = new TreeSet<String>();
|
||||
for (ModuleNeeded module : moduleNeededList) {
|
||||
String moduleName = module.getModuleName();
|
||||
moduleNameList.add(moduleName);
|
||||
}
|
||||
this.moduleNameArray = moduleNameList.toArray(new String[0]);
|
||||
if (this.moduleNameArray == null) {
|
||||
this.moduleNameArray = new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getSelecteModuleArray() {
|
||||
return this.selecteModuleArray;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class SchemaCellEditor extends DialogCellEditor {
|
||||
}
|
||||
if ("tSAPBapi".equals(node.getComponent().getName())) {
|
||||
node.getMetadataFromConnector(schemaToEdit);
|
||||
executeCommand(new RepositoryChangeMetadataForSAPBapi(node, functionUnit, metaTable, null));
|
||||
executeCommand(new RepositoryChangeMetadataForSAPBapi(node, functionUnit, metaTable, null, index));
|
||||
} else {
|
||||
executeCommand(new RepositoryChangeMetadataForSAPCommand(node, ISAPConstant.TABLE_SCHEMAS,
|
||||
metaTable.getLabel(), metaTable, index));
|
||||
|
||||
@@ -250,6 +250,9 @@ public class SchemaOperationChoiceDialog extends SelectionDialog {
|
||||
setButtonAndStatus(checkSchema());
|
||||
if (schemaCombo != null) {
|
||||
schemaCombo.setVisible(true);
|
||||
if (schemaCombo.getItemCount() == 0) {
|
||||
getOkButton().setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,6 +331,7 @@ public class SchemaOperationChoiceDialog extends SelectionDialog {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid && processType == EProcessType.BUILTIN) {
|
||||
// only, change to repository
|
||||
if (schemaCombo.getText().equals(schemaName)) {
|
||||
@@ -349,7 +353,7 @@ public class SchemaOperationChoiceDialog extends SelectionDialog {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (item != null) {
|
||||
Set tables = ConnectionHelper.getTables(item.getConnection());
|
||||
for (MetadataTable table : (Set<MetadataTable>) tables) {
|
||||
if (table.getLabel().equals(schemaCombo.getText())) {
|
||||
|
||||
@@ -52,8 +52,10 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
|
||||
private final String TRUE = "true"; //$NON-NLS-1$
|
||||
|
||||
private Integer selectionIndex;
|
||||
|
||||
public RepositoryChangeMetadataForSAPBapi(INode node, SAPFunctionUnit functionUnit, IMetadataTable newMetadatTable,
|
||||
IMetadataTable oldMetadataTable) {
|
||||
IMetadataTable oldMetadataTable, Integer selectionIndex) {
|
||||
super();
|
||||
this.node = node;
|
||||
this.functionUnit = functionUnit;
|
||||
@@ -62,6 +64,13 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
newMetadatTable.setTableType(newMetadatTable.getTableType());
|
||||
}
|
||||
this.oldMetadataTable = oldMetadataTable;
|
||||
this.selectionIndex = selectionIndex;
|
||||
|
||||
}
|
||||
|
||||
public RepositoryChangeMetadataForSAPBapi(INode node, SAPFunctionUnit functionUnit, IMetadataTable newMetadatTable,
|
||||
IMetadataTable oldMetadataTable) {
|
||||
this(node, functionUnit, newMetadatTable, oldMetadataTable, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,10 +113,6 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
inputTableParam.setValue(paramValues);
|
||||
}
|
||||
if (newMetadatTable != null) {
|
||||
Map<String, String> properties = newMetadatTable.getAdditionalProperties();
|
||||
if (properties != null) {
|
||||
properties.put(ISINPUT, TRUE);
|
||||
}
|
||||
// create new line
|
||||
createNewSchema(paramValues, newMetadatTable, MetadataSchemaType.INPUT.name());
|
||||
} else {
|
||||
@@ -143,7 +148,7 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
return;
|
||||
}
|
||||
Boolean isInput = MetadataSchemaType.INPUT.name().equals(tableType);
|
||||
HashMap valueMap = new HashMap<String, Object>();
|
||||
Map valueMap = null;
|
||||
|
||||
String uinqueTableName = node.getProcess().generateUniqueConnectionName(
|
||||
MultiSchemasUtil.getConnectionBaseName(newMetadatTable.getLabel()));
|
||||
@@ -151,14 +156,24 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
if (paramType == null) {
|
||||
return;
|
||||
}
|
||||
if (selectionIndex != null && selectionIndex < paramValues.size()) {
|
||||
valueMap = paramValues.get(selectionIndex);
|
||||
}
|
||||
|
||||
if (valueMap == null) {
|
||||
valueMap = new HashMap();
|
||||
paramValues.add(valueMap);
|
||||
}
|
||||
valueMap.put(ISAPConstant.NAME, TalendQuoteUtils.addQuotes(newMetadatTable.getLabel()));
|
||||
valueMap.put(ISAPConstant.TYPE, paramType);
|
||||
valueMap.put(ISAPConstant.FIELD_SCHEMA, uinqueTableName);
|
||||
if (isInput) {
|
||||
valueMap.put(ISAPConstant.PARENT_ROW, ""); //$NON-NLS-1$
|
||||
Map<String, String> properties = newMetadatTable.getAdditionalProperties();
|
||||
if (properties != null) {
|
||||
properties.put(ISINPUT, TRUE);
|
||||
}
|
||||
}
|
||||
paramValues.add(valueMap);
|
||||
|
||||
if (oldMetadataTable != null) {
|
||||
CoreUIPlugin.getDefault().getDesignerCoreService().removeConnection(node, oldMetadataTable.getTableName());
|
||||
|
||||
@@ -65,6 +65,7 @@ import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView;
|
||||
import org.talend.core.ui.metadata.editor.MetadataTableEditorView;
|
||||
import org.talend.core.utils.MetaDataDialogUtil;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
|
||||
@@ -197,7 +198,7 @@ public class MetadataDialog extends Dialog {
|
||||
isEBCDIC = node.getComponent().getName().contains("EBCDIC");
|
||||
if (node.getComponent().isSupportDbType() || node.getComponent().getOriginalFamilyName().startsWith(DATABASE_LABEL)
|
||||
|| eltComponent || isEBCDIC) {
|
||||
dbComponent = true && !isEBCDIC;
|
||||
dbComponent = !isEBCDIC;
|
||||
for (IElementParameter currentParam : node.getElementParameters()) {
|
||||
if (currentParam.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
|
||||
metaView.setCurrentDbms((String) currentParam.getValue());
|
||||
@@ -289,6 +290,13 @@ public class MetadataDialog extends Dialog {
|
||||
metaView.setAdditionalFields(fieldList);
|
||||
}
|
||||
|
||||
showColumnsOfCustomComponents(node, metaView);
|
||||
}
|
||||
|
||||
private static void showColumnsOfCustomComponents(INode node, MetadataTableEditorView metaView) {
|
||||
if (isRedShiftNode(node)) {
|
||||
metaView.setShowPrecisionColumn(false);
|
||||
}
|
||||
if (isSingleAndStruct) {
|
||||
metaView.setShowDbColumnName(false, false);
|
||||
metaView.setShowKeyColumn(false);
|
||||
@@ -330,7 +338,8 @@ public class MetadataDialog extends Dialog {
|
||||
String key = (String) it.next();
|
||||
if (key.equals("SAP_TABLE_NAME")) {
|
||||
String value = (String) map.get(key);
|
||||
if (this.outputMetaTable.getLabel().equals(TalendQuoteUtils.removeQuotes(value))) {
|
||||
String tableLabel = this.outputMetaTable.getLabel();
|
||||
if (tableLabel != null && tableLabel.equals(TalendQuoteUtils.removeQuotes(value))) {
|
||||
if (map.containsKey("SCHEMA-TYPE") && map.containsValue("REPOSITORY")) {
|
||||
nodeModeFlag = true;
|
||||
}
|
||||
@@ -787,4 +796,7 @@ public class MetadataDialog extends Dialog {
|
||||
this.isSingleAndStruct = isSingle;
|
||||
}
|
||||
|
||||
private static boolean isRedShiftNode(INode node) {
|
||||
return MetaDataDialogUtil.isRedShiftNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.metadata.types.JavaTypesManager;
|
||||
import org.talend.core.model.update.ConnectionColumnUpdateManager;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.core.ui.metadata.celleditor.JavaTypeComboValueAdapter;
|
||||
import org.talend.core.ui.proposal.JavaSimpleDateFormatProposalProvider;
|
||||
@@ -141,6 +142,8 @@ public abstract class AbstractMetadataTableEditorView<B> extends AbstractDataTab
|
||||
|
||||
private boolean isSapSpecialSchema = false;
|
||||
|
||||
private boolean showDefaultColumn = true;
|
||||
|
||||
/**
|
||||
* DOC amaumont AbstractMetadataTableEditorView constructor comment.
|
||||
*/
|
||||
@@ -309,8 +312,9 @@ public abstract class AbstractMetadataTableEditorView<B> extends AbstractDataTab
|
||||
}
|
||||
|
||||
// //////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
configureDefaultColumn(tableViewerCreator);
|
||||
if (showDefaultColumn) {
|
||||
configureDefaultColumn(tableViewerCreator);
|
||||
}
|
||||
|
||||
// //////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -709,6 +713,9 @@ public abstract class AbstractMetadataTableEditorView<B> extends AbstractDataTab
|
||||
|
||||
@Override
|
||||
public void newValidValueTyped(int itemIndex, Object previousValue, Object newValue, CELL_EDITOR_STATE state) {
|
||||
if (!newValue.equals(previousValue)) {
|
||||
ConnectionColumnUpdateManager.getInstance().addNewName((String) newValue, (String) previousValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1144,4 +1151,22 @@ public abstract class AbstractMetadataTableEditorView<B> extends AbstractDataTab
|
||||
public void setSapSpecialSchema(boolean isSapSpecialSchema) {
|
||||
this.isSapSpecialSchema = isSapSpecialSchema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for showDefaultColumn.
|
||||
*
|
||||
* @return the showDefaultColumn
|
||||
*/
|
||||
public boolean isShowDefaultColumn() {
|
||||
return this.showDefaultColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the showDefaultColumn.
|
||||
*
|
||||
* @param showDefaultColumn the showDefaultColumn to set
|
||||
*/
|
||||
public void setShowDefaultColumn(boolean showDefaultColumn) {
|
||||
this.showDefaultColumn = showDefaultColumn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,15 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.workspace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
@@ -25,7 +34,9 @@ import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.actions.ActionFactory;
|
||||
import org.talend.core.model.general.ConnectionBean;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.repository.ui.login.connections.ConnectionUserPerReader;
|
||||
|
||||
/**
|
||||
* Implements the open workspace action. Opens a dialog prompting for a directory and then restarts the IDE on that
|
||||
@@ -89,6 +100,7 @@ public class OpenWorkspaceAction extends Action implements ActionFactory.IWorkbe
|
||||
public void run() {
|
||||
data.workspaceSelected(location);
|
||||
data.writePersistedData();
|
||||
setCorrespondingConnectionAsDefault(location);
|
||||
restart(location);
|
||||
}
|
||||
}
|
||||
@@ -141,6 +153,7 @@ public class OpenWorkspaceAction extends Action implements ActionFactory.IWorkbe
|
||||
dropDownMenuMgr = new MenuManager();
|
||||
final ChooseWorkspaceData data = new ChooseWorkspaceData(Platform.getInstanceLocation().getURL());
|
||||
data.readPersistedData();
|
||||
filterUsefulWorkspaces(data);
|
||||
String current = data.getInitialDefault();
|
||||
String[] workspaces = data.getRecentWorkspaces();
|
||||
for (int i = 0; i < workspaces.length; i++) {
|
||||
@@ -324,4 +337,65 @@ public class OpenWorkspaceAction extends Action implements ActionFactory.IWorkbe
|
||||
public void dispose() {
|
||||
window = null;
|
||||
}
|
||||
|
||||
protected void setCorrespondingConnectionAsDefault(String selectedWorkspace) {
|
||||
if (selectedWorkspace == null || selectedWorkspace.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ConnectionUserPerReader connectionReader = ConnectionUserPerReader.getInstance();
|
||||
List<ConnectionBean> connections = connectionReader.readConnections();
|
||||
if (connections == null || connections.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<String, ConnectionBean> usefullWorkspaces = new HashMap<String, ConnectionBean>();
|
||||
for (ConnectionBean connBean : connections) {
|
||||
String workSpace = connBean.getWorkSpace();
|
||||
if (workSpace == null || workSpace.trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
usefullWorkspaces.put(workSpace, connBean);
|
||||
}
|
||||
if (usefullWorkspaces.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConnectionBean connBean = usefullWorkspaces.get(selectedWorkspace);
|
||||
if (connBean == null) {
|
||||
return;
|
||||
}
|
||||
connectionReader.saveLastConnectionBean(connBean);
|
||||
}
|
||||
|
||||
protected void filterUsefulWorkspaces(ChooseWorkspaceData data) {
|
||||
String[] recentWorkspaces = null;
|
||||
if (data == null || (recentWorkspaces = data.getRecentWorkspaces()) == null || recentWorkspaces.length == 0) {
|
||||
return;
|
||||
}
|
||||
List<ConnectionBean> connections = ConnectionUserPerReader.getInstance().readConnections();
|
||||
if (connections == null || connections.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Set<String> workspaceSet = new HashSet<String>();
|
||||
for (ConnectionBean connBean : connections) {
|
||||
String workspace = connBean.getWorkSpace();
|
||||
if (workspace == null || workspace.trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
workspaceSet.add(workspace);
|
||||
}
|
||||
if (workspaceSet.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> recentWorkspacesList = new ArrayList<String>(Arrays.asList(recentWorkspaces));
|
||||
Iterator<String> iter = recentWorkspacesList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (!workspaceSet.contains(iter.next())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
data.setRecentWorkspaces(recentWorkspacesList.toArray(new String[0]));
|
||||
data.writePersistedData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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.talend.core.model.metadata.IDatabaseConstant;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
|
||||
/**
|
||||
* created by ldong on Jan 16, 2015 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class MetaDataDialogUtil {
|
||||
|
||||
public static final String PROPERTY = "PROPERTY"; //$NON-NLS-1$
|
||||
|
||||
public static boolean isRedShiftNode(INode node) {
|
||||
if (node != null) {
|
||||
IElementParameter param = node.getElementParameter(PROPERTY);
|
||||
if (param != null && param.getFieldType() == EParameterFieldType.PROPERTY_TYPE
|
||||
&& IDatabaseConstant.REDSHIFT.equals(param.getRepositoryValue())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2015 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -44,11 +44,13 @@ public class ContextRemoveParameterCommand extends Command {
|
||||
private Set<String> contextParamNames = new HashSet<String>();
|
||||
|
||||
private Map<String, List<IContextParameter>> mapParams = new HashMap<String, List<IContextParameter>>();
|
||||
|
||||
|
||||
private boolean needRefresh;
|
||||
|
||||
public ContextRemoveParameterCommand(IContextManager contextManager, Set<String> contextParamNames) {
|
||||
init(contextManager, contextParamNames);
|
||||
init(contextManager, contextParamNames, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Added by Marvin Wang on Mar.5, 2012 for bug TDI 8574, should use contextParaName and paraSourceId to identify
|
||||
* which ContextParameter can be removed.
|
||||
@@ -58,10 +60,23 @@ public class ContextRemoveParameterCommand extends Command {
|
||||
* @param paraSourceId
|
||||
*/
|
||||
public ContextRemoveParameterCommand(IContextManager contextManager, Set<String> contextParamNames, String paraSourceId) {
|
||||
init(contextManager, contextParamNames);
|
||||
init(contextManager, contextParamNames, true);
|
||||
this.paraSourceId = paraSourceId;
|
||||
}
|
||||
|
||||
|
||||
public ContextRemoveParameterCommand(IContextManager contextManager, String contextParamName, String paraSourceId, boolean needRefresh) {
|
||||
this(contextManager, contextParamName, needRefresh);
|
||||
this.paraSourceId = paraSourceId;
|
||||
}
|
||||
|
||||
public ContextRemoveParameterCommand(IContextManager contextManager, String contextParamName, boolean needRefresh) {
|
||||
Set<String> names = new HashSet<String>();
|
||||
if (contextParamName != null) {
|
||||
names.add(contextParamName);
|
||||
}
|
||||
init(contextManager, names, needRefresh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Added by Marvin Wang on Mar.5, 2012 for bug TDI 8574, should use contextParaName and paraSourceId to identify
|
||||
* which ContextParameter can be removed.
|
||||
@@ -69,25 +84,36 @@ public class ContextRemoveParameterCommand extends Command {
|
||||
* @param contextManager
|
||||
* @param contextParamName
|
||||
* @param paraSourceId
|
||||
* @deprecated
|
||||
* replaced by <code>ContextRemoveParameterCommand(IContextManager contextManager, String contextParamName, String paraSourceId, boolean needRefresh)</code>.
|
||||
*/
|
||||
@Deprecated
|
||||
public ContextRemoveParameterCommand(IContextManager contextManager, String contextParamName, String paraSourceId) {
|
||||
this(contextManager, contextParamName);
|
||||
this.paraSourceId = paraSourceId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param contextManager
|
||||
* @param contextParamName
|
||||
* @deprecated
|
||||
* replaced by <code>ContextRemoveParameterCommand(IContextManager contextManager, String contextParamName, boolean needRefresh)</code>.
|
||||
*/
|
||||
@Deprecated
|
||||
public ContextRemoveParameterCommand(IContextManager contextManager, String contextParamName) {
|
||||
Set<String> names = new HashSet<String>();
|
||||
if (contextParamName != null) {
|
||||
names.add(contextParamName);
|
||||
}
|
||||
init(contextManager, names);
|
||||
init(contextManager, names, false);
|
||||
}
|
||||
|
||||
private void init(IContextManager contextManager, Set<String> contextParamNames) {
|
||||
private void init(IContextManager contextManager, Set<String> contextParamNames, boolean needRefresh) {
|
||||
this.contextManager = contextManager;
|
||||
if (contextParamNames != null) {
|
||||
this.contextParamNames.addAll(contextParamNames);
|
||||
}
|
||||
this.needRefresh = needRefresh;
|
||||
this.setLabel(Messages.getString("ContextRemoveParameterCommand.label")); //$NON-NLS-1$
|
||||
this.helper = new ContextManagerHelper(contextManager);
|
||||
}
|
||||
@@ -166,7 +192,9 @@ public class ContextRemoveParameterCommand extends Command {
|
||||
}
|
||||
}
|
||||
contextManager.fireContextsChangedEvent();
|
||||
this.helper.refreshContextView();
|
||||
if (needRefresh) {
|
||||
helper.refreshContextView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,6 +213,6 @@ public class ContextRemoveParameterCommand extends Command {
|
||||
}
|
||||
}
|
||||
contextManager.fireContextsChangedEvent();
|
||||
this.helper.refreshContextView();
|
||||
helper.refreshContextView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
@@ -61,13 +62,18 @@ public class Contexts {
|
||||
public static void switchToCurContextsView(String perspectiveId, String viewId) {
|
||||
Set<String> perspIDs = new HashSet<String>();
|
||||
perspIDs.add(perspectiveId);
|
||||
AbstractContextView cxtView = getView(perspIDs, viewId);
|
||||
|
||||
final AbstractContextView cxtView = getView(perspIDs, viewId);
|
||||
if (cxtView == null) {
|
||||
return;
|
||||
}
|
||||
updateTitle(cxtView);
|
||||
refreshView(cxtView);
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateTitle(cxtView);
|
||||
refreshView(cxtView);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void refreshContextsView() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user