Compare commits
124 Commits
patch/7.3.
...
release/5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -178,8 +178,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 +244,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());
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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$
|
||||
@@ -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.getInstanceLocation().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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ 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.ContextItem;
|
||||
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;
|
||||
@@ -586,30 +588,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 +607,82 @@ 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) {
|
||||
List<IContext> contexts = contextManager.getListContext();
|
||||
helper.initHelper(contextManager);
|
||||
boolean needRefresh = false;
|
||||
for (IContext context : contexts) {
|
||||
for (IContextParameter param : context.getContextParameterList()) {
|
||||
if (!param.isBuiltIn()) {
|
||||
// TDI-31787:the context parameter's source can be either from context or joblet
|
||||
Item sourceItem = ContextUtils.getRepositoryContextItemById(param.getSource());
|
||||
if (sourceItem instanceof ContextItem) {
|
||||
ContextItem item = helper.getContextItemById(param.getSource());
|
||||
if (item == null) { // source not found
|
||||
needRefresh = true;
|
||||
param.setSource(IContextParameter.BUILT_IN);
|
||||
propagateType(contextManager, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeDataTable() {
|
||||
if (contextTableComp != null && !contextTableComp.isDisposed()) {
|
||||
for (Control control : contextTableComp.getChildren()) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -289,9 +289,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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -319,5 +319,4 @@ ActionBarBuildHelper.CloseAllAction_toolTip=Close All
|
||||
ActionBarBuildHelper.SaveAll_text=Sav&e All
|
||||
ActionBarBuildHelper.SaveAll_toolTip=Save All
|
||||
ContextOrderProperty.BuiltInComment=Build-in context variables
|
||||
ContextOrderProperty.RepositoryComment=Context variables from repository context:
|
||||
ContextOrderProperty.contextEncoding=file.encoding
|
||||
ContextOrderProperty.RepositoryComment=Context variables from repository context:
|
||||
@@ -47,6 +47,8 @@ public class ContextOrderProperties extends Properties {
|
||||
|
||||
private final static String REPOSITORY_COMMENT = Messages.getString("ContextOrderProperty.RepositoryComment"); //$NON-NLS-1$
|
||||
|
||||
private final static String DEFAULT_PROPERTY_ENCODING = "8859_1";
|
||||
|
||||
/**
|
||||
* Version ID
|
||||
*/
|
||||
@@ -175,11 +177,10 @@ public class ContextOrderProperties extends Properties {
|
||||
|
||||
@Override
|
||||
public void store(OutputStream out, String comments) throws IOException {
|
||||
String defaultEncoding = System.getProperty(Messages.getString("ContextOrderProperty.contextEncoding")); //$NON-NLS-1$
|
||||
orderStore(new BufferedWriter(new OutputStreamWriter(out, defaultEncoding)), comments);
|
||||
orderStore(new BufferedWriter(new OutputStreamWriter(out, DEFAULT_PROPERTY_ENCODING)), comments, true);
|
||||
}
|
||||
|
||||
public void orderStore(Writer writer, String comments) throws IOException {
|
||||
public void orderStore(Writer writer, String comments, boolean escUnicode) throws IOException {
|
||||
BufferedWriter bufferedWriter = (writer instanceof BufferedWriter) ? (BufferedWriter) writer : new BufferedWriter(writer);
|
||||
if (comments != null) {
|
||||
writeComments(bufferedWriter, comments);
|
||||
@@ -193,8 +194,8 @@ public class ContextOrderProperties extends Properties {
|
||||
String key = iterator.next();
|
||||
String value = this.getProperty(key);
|
||||
String comment = this.commentMap.get(key);
|
||||
key = saveConvert(key, true, false);
|
||||
value = saveConvert(value, false, false);
|
||||
key = saveConvert(key, true, escUnicode);
|
||||
value = saveConvert(value, false, escUnicode);
|
||||
if (comment != null && !comment.equals("")) {
|
||||
bufferedWriter.newLine();
|
||||
writeComments(bufferedWriter, comment);
|
||||
|
||||
@@ -289,11 +289,14 @@ public class TalendTextUtils {
|
||||
// added by hyWang(bug 6637),to see if the column name need to be add queotes
|
||||
// check the field name.
|
||||
|
||||
String temp = removeQuotes(fieldName);
|
||||
Pattern pattern = Pattern.compile("\\w+"); //$NON-NLS-1$
|
||||
Matcher matcher = pattern.matcher(temp);
|
||||
|
||||
// for bug 11938
|
||||
// to see if the table name or column name was start with number
|
||||
String temp = removeQuotes(fieldName);
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z_]*$"); //$NON-NLS-1$
|
||||
Matcher matcher = pattern.matcher(temp);
|
||||
Pattern pattern2 = Pattern.compile("^[0-9]+[_0-9a-zA-Z]*$"); //$NON-NLS-1$
|
||||
Matcher matcher2 = pattern2.matcher(temp);
|
||||
|
||||
// for bug 12092
|
||||
boolean isSqlKeyword = KeywordsValidator.isSqlKeyword(temp, name.getProduct());
|
||||
@@ -301,7 +304,7 @@ public class TalendTextUtils {
|
||||
boolean isH2 = EDatabaseTypeName.H2 == name;
|
||||
|
||||
// if the database type is IBMDB2 and the field name contain lowercase character, should add quotes
|
||||
if (((!matcher.matches() || isSqlKeyword) && !isH2 && EDatabaseTypeName.SAS != name && EDatabaseTypeName.IMPALA != name)
|
||||
if (((!matcher.matches() || matcher2.matches() || isSqlKeyword) && !isH2 && EDatabaseTypeName.SAS != name && EDatabaseTypeName.IMPALA != name)
|
||||
|| isIBMDB2ContainLowerCase(dbType, fieldName)) {
|
||||
isCheck = true; // contain other char
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class CorePreferenceInitializer extends AbstractPreferenceInitializer {
|
||||
if (!CommonsPlugin.isHeadless()) {
|
||||
Display display = getDisplay();
|
||||
if (display != null) {
|
||||
display.syncExec(new Runnable() {
|
||||
display.asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -106,6 +106,8 @@ public class ProcessorUtilities {
|
||||
|
||||
private static Map<String, Integer> lastGeneratedWithStatsOrTrace = new HashMap<String, Integer>();
|
||||
|
||||
private static Date exportTimeStamp;// time stamp create when exporting a job and reset when export ends.
|
||||
|
||||
private static final int GENERATED_WITH_STATS = 1;
|
||||
|
||||
private static final int GENERATED_WITH_TRACES = 2;
|
||||
@@ -145,6 +147,11 @@ public class ProcessorUtilities {
|
||||
codeLocation = exportCodeLocation;
|
||||
libraryPath = exportLibraryPath;
|
||||
exportConfig = true;
|
||||
exportTimeStamp = new Date();
|
||||
}
|
||||
|
||||
public static Date getExportTimestamp() {
|
||||
return exportTimeStamp;
|
||||
}
|
||||
|
||||
public static boolean isExportConfig() {
|
||||
@@ -156,6 +163,7 @@ public class ProcessorUtilities {
|
||||
codeLocation = null;
|
||||
libraryPath = null;
|
||||
exportConfig = false;
|
||||
exportTimeStamp = null;
|
||||
}
|
||||
|
||||
public static String getInterpreter() {
|
||||
|
||||
@@ -33,10 +33,9 @@ public class ExternalNodesFactory {
|
||||
public static IExternalNode getInstance(final String extensionId) {
|
||||
List<IExternalNode> listComponents;
|
||||
try {
|
||||
listComponents = ExtensionImplementationProvider.getInstance(ExtensionPointFactory.EXTERNAL_COMPONENT,
|
||||
extensionId);
|
||||
listComponents = ExtensionImplementationProvider.getInstance(ExtensionPointFactory.EXTERNAL_COMPONENT, extensionId);
|
||||
} catch (IllegalPluginConfigurationException e) {
|
||||
throw new RuntimeException("plugin:" + extensionId + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
throw new RuntimeException("plugin:" + extensionId + " not found", e); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
return listComponents.get(0);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ Bundle-Version: 1.0.0.qualifier
|
||||
Require-Bundle: org.eclipse.xsd,
|
||||
org.apache.commons.beanutils,
|
||||
org.apache.commons.lang,
|
||||
org.talend.libraries.apache
|
||||
org.talend.libraries.apache,
|
||||
org.talend.core.runtime
|
||||
Export-Package: org.talend.datatools.xml.utils
|
||||
Bundle-Vendor: .Talend SA.
|
||||
|
||||
@@ -52,6 +52,10 @@ public class ATreeNode {
|
||||
|
||||
private boolean isOptional = false;
|
||||
|
||||
private long dataMaxLength = -1;
|
||||
|
||||
private long precisionValue;
|
||||
|
||||
private static HashMap xmlTypeToDataType = new HashMap();
|
||||
|
||||
static {
|
||||
@@ -348,4 +352,19 @@ public class ATreeNode {
|
||||
this.isOptional = isOptional;
|
||||
}
|
||||
|
||||
public long getDataMaxLength() {
|
||||
return this.dataMaxLength;
|
||||
}
|
||||
|
||||
public void setDataMaxLength(long dataMaxLength) {
|
||||
this.dataMaxLength = dataMaxLength;
|
||||
}
|
||||
|
||||
public long getPrecisionValue() {
|
||||
return this.precisionValue;
|
||||
}
|
||||
|
||||
public void setPrecisionValue(long precisionValue) {
|
||||
this.precisionValue = precisionValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ public class SaxParser extends DefaultHandler implements Runnable {
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
SAXParser xr;
|
||||
try {
|
||||
@@ -189,8 +190,8 @@ public class SaxParser extends DefaultHandler implements Runnable {
|
||||
}
|
||||
spConsumer.detectNewRow(pathHolder.getPath(), prefix, uri, true);
|
||||
for (int i = 0; i < atts.getLength(); i++) {
|
||||
spConsumer.manipulateData(getAttributePath(atts, i), atts.getValue(i));
|
||||
spConsumer.detectNewRow(getAttributePath(atts, i), null, null, true);
|
||||
spConsumer.manipulateData(getAttributePath(atts, i), atts.getValue(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.xerces.impl.xs.XMLSchemaLoader;
|
||||
import org.apache.xerces.impl.xs.XSAttributeGroupDecl;
|
||||
import org.apache.xerces.impl.xs.XSAttributeUseImpl;
|
||||
@@ -44,6 +45,9 @@ import org.apache.xerces.xs.XSObjectList;
|
||||
import org.apache.xerces.xs.XSParticle;
|
||||
import org.apache.xerces.xs.XSTypeDefinition;
|
||||
import org.eclipse.xsd.XSDSchema;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.model.metadata.types.JavaDataTypeHelper;
|
||||
import org.talend.core.model.metadata.types.JavaTypesManager;
|
||||
|
||||
/**
|
||||
* This class is used to offer GUI a utility to get an tree from certain xml/xsd file.
|
||||
@@ -145,6 +149,8 @@ final class XMLFileSchemaTreePopulator implements ISaxParserConsumer {
|
||||
|
||||
private Map<String, String> prefixToNamespace = new HashMap<String, String>();
|
||||
|
||||
private Map<String, ATreeNode> nodePathMap = new HashMap<String, ATreeNode>();
|
||||
|
||||
Thread spThread;
|
||||
|
||||
/**
|
||||
@@ -166,6 +172,63 @@ final class XMLFileSchemaTreePopulator implements ISaxParserConsumer {
|
||||
*/
|
||||
@Override
|
||||
public void manipulateData(String path, String value) {
|
||||
guessColumnInfo(path, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC cmeng Comment method "guessDataType".
|
||||
*
|
||||
* @param path
|
||||
* @param value
|
||||
*/
|
||||
private void guessColumnInfo(String path, String value) {
|
||||
// Most of the codes are copied from XmlFileStep3Form.refreshMetaDataTable(...)
|
||||
|
||||
ATreeNode treeNode = nodePathMap.get(getTreamedPath(path));
|
||||
if (treeNode == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. set data type
|
||||
String dataType = treeNode.getDataType();
|
||||
if (StringUtils.isEmpty(dataType)) {
|
||||
dataType = JavaDataTypeHelper.getTalendTypeOfValue(value);
|
||||
} else {
|
||||
dataType = JavaDataTypeHelper.getCommonType(dataType, JavaDataTypeHelper.getTalendTypeOfValue(value));
|
||||
}
|
||||
try {
|
||||
treeNode.setDataType(dataType);
|
||||
} catch (OdaException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
// 2. set data length
|
||||
long dataLength = treeNode.getDataMaxLength();
|
||||
long curValueLength = value.length();
|
||||
if (dataLength < curValueLength) {
|
||||
dataLength = curValueLength;
|
||||
}
|
||||
treeNode.setDataMaxLength(dataLength);
|
||||
|
||||
// 3. set precision
|
||||
int curPrecision = 0;
|
||||
long precisionValue = 0;
|
||||
if (value.indexOf(',') > -1) {
|
||||
curPrecision = value.lastIndexOf(',');
|
||||
precisionValue = dataLength - curPrecision;
|
||||
} else if (value.indexOf('.') > -1) {
|
||||
curPrecision = value.lastIndexOf('.');
|
||||
precisionValue = dataLength - curPrecision;
|
||||
}
|
||||
|
||||
if (JavaTypesManager.FLOAT.getId().equals(dataType) || JavaTypesManager.DOUBLE.getId().equals(dataType)) {
|
||||
treeNode.setPrecisionValue(precisionValue);
|
||||
} else {
|
||||
treeNode.setPrecisionValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -176,7 +239,7 @@ final class XMLFileSchemaTreePopulator implements ISaxParserConsumer {
|
||||
*/
|
||||
@Override
|
||||
public void detectNewRow(String path, String prefix, String uri, boolean start) {
|
||||
String treamedPath = path.replaceAll("\\Q[\\E\\d+\\Q]\\E", "").trim();
|
||||
String treamedPath = getTreamedPath(path);
|
||||
this.insertNode(treamedPath, prefix, uri);
|
||||
// If not attribute
|
||||
if (!isAttribute(path) && start) {
|
||||
@@ -192,6 +255,10 @@ final class XMLFileSchemaTreePopulator implements ISaxParserConsumer {
|
||||
|
||||
}
|
||||
|
||||
private String getTreamedPath(String path) {
|
||||
return path.replaceAll("\\Q[\\E\\d+\\Q]\\E", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/**
|
||||
* Exam whether given path specified an attribute
|
||||
*
|
||||
@@ -293,6 +360,8 @@ final class XMLFileSchemaTreePopulator implements ISaxParserConsumer {
|
||||
} else {
|
||||
matchedNode = new ATreeNode();
|
||||
|
||||
nodePathMap.put(treatedPath, matchedNode);
|
||||
|
||||
if ((i == path.length - 1) && isAttribute) {
|
||||
if (isAttribute && !this.includeAttribute) {
|
||||
continue;
|
||||
|
||||
@@ -70,6 +70,8 @@ public class XSDPopulationUtil2 {
|
||||
|
||||
private boolean supportSubstitution = false;
|
||||
|
||||
private boolean includeAbsSubs = false;
|
||||
|
||||
private Map<XSDElementDeclaration, ATreeNode> particleToTreeNode = new HashMap<XSDElementDeclaration, ATreeNode>();
|
||||
|
||||
ResourceSet resourceSet = new ResourceSetImpl();
|
||||
@@ -306,11 +308,11 @@ public class XSDPopulationUtil2 {
|
||||
boolean resolvedAsComplex = false;
|
||||
if (typeDef instanceof XSDComplexTypeDefinition) {
|
||||
XSDTypeDefinition xsdTypeDefinition = typeDef;
|
||||
String path = currentPath + elementName + "/";
|
||||
if (xsdTypeDefinition != null && xsdTypeDefinition.getName() != null) {
|
||||
partNode.setDataType(xsdTypeDefinition.getQName());
|
||||
}
|
||||
addComplexTypeDetails(xsdSchema, partNode, xsdTypeDefinition, prefix, namespace, path);
|
||||
String path = currentPath + elementName + "/";
|
||||
if (xsdTypeDefinition != null && xsdTypeDefinition.getName() != null) {
|
||||
partNode.setDataType(xsdTypeDefinition.getQName());
|
||||
}
|
||||
addComplexTypeDetails(xsdSchema, partNode, xsdTypeDefinition, prefix, namespace, path);
|
||||
resolvedAsComplex = true;
|
||||
} else if (typeDef.getTargetNamespace() != null) {
|
||||
resolvedAsComplex = true;
|
||||
@@ -632,7 +634,7 @@ public class XSDPopulationUtil2 {
|
||||
parentNode.setValue(oldValue + SUBS);
|
||||
Object[] originalChildren = parentNode.getChildren();
|
||||
parentNode.removeAllChildren();
|
||||
if (!elementDeclaration.isAbstract()) {
|
||||
if (!elementDeclaration.isAbstract() || includeAbsSubs) {
|
||||
ATreeNode cloneNode = new ATreeNode();
|
||||
BeanUtils.copyProperties(cloneNode, parentNode);
|
||||
cloneNode.setSubstitution(false);
|
||||
@@ -747,4 +749,13 @@ public class XSDPopulationUtil2 {
|
||||
public void setEnableGeneratePrefix(boolean enableGeneratePrefix) {
|
||||
this.enableGeneratePrefix = enableGeneratePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the includeAbsSubs.
|
||||
*
|
||||
* @param includeAbsSubs the includeAbsSubs to set
|
||||
*/
|
||||
public void setIncludeAbsSubs(boolean includeAbsSubs) {
|
||||
this.includeAbsSubs = includeAbsSubs;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -16,4 +16,14 @@ bin.includes = META-INF/,\
|
||||
lib/stax2-api-3.1.1.jar,\
|
||||
lib/woodstox-core-asl-4.2.0.jar,\
|
||||
lib/javax.ws.rs-api-2.0-m10.jar,\
|
||||
plugin.xml
|
||||
plugin.xml,\
|
||||
lib/stax2-api-3.1.4.jar,\
|
||||
lib/woodstox-core-asl-4.4.1.jar,\
|
||||
lib/xml-resolver-1.2.jar,\
|
||||
lib/xmlschema-core-2.1.0.jar,\
|
||||
lib/cxf-xjc-ts-3.0.2.jar,\
|
||||
lib/cxf-xjc-runtime-3.0.2.jar,\
|
||||
lib/cxf-xjc-dv-3.0.2.jar,\
|
||||
lib/cxf-xjc-bug671-3.0.2.jar,\
|
||||
lib/cxf-xjc-boolean-3.0.2.jar,\
|
||||
lib/cxf-2.7.15-modified.jar
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user