use of org.talend.core.repository.model.ILocalRepositoryFactory in project tdi-studio-se by Talend.
the class Connection method init.
private void init(INode source, INode target, EConnectionType lineStyle, String connectorName, String metaName, String linkName, final boolean monitorConnection) {
if (lineStyle.equals(EConnectionType.ITERATE)) {
performance = new IterateConnectionPerformance(this);
} else if (lineStyle.hasConnectionCategory(IConnectionCategory.DEPENDENCY)) {
// "OnComponentOK/OnComponentError/OnSubJobOK/OnSubJobError/If"
performance = new LiteralConnectionPerformance(this);
} else if (ComponentCategory.CATEGORY_4_SPARK.getName().equals(source.getProcess().getComponentsType())) {
performance = new SparkBatchConnectionPerformance(this);
} else {
// if no parallel execution existed, just delegate to super class.
performance = new ParallelConnectionPerformance(this);
}
this.connectorName = connectorName;
this.lineStyle = lineStyle;
this.metaName = metaName;
this.monitorConnection = monitorConnection;
resuming = new ConnectionResuming(this);
if (lineStyle.hasConnectionCategory(IConnectionCategory.FLOW)) {
trace = new ConnectionTrace(this);
createTraceParamters();
IComponent component = ComponentsFactoryProvider.getInstance().get("tFlowMeter", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
if (component != null) {
// only if tFlowMeter is available and not M/R job
IProcess process = source.getProcess();
if (process instanceof IProcess2) {
IProcess2 process2 = (IProcess2) process;
if (!ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process2.getComponentsType())) {
createMeterParameters(process2);
}
}
}
}
setName(linkName);
if (trace != null) {
trace.setOffset(label.getOffset());
}
if (resuming != null) {
resuming.setOffset(label.getOffset());
}
if (source.getProcess().getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName()) && ComponentsFactoryProvider.getInstance().get("tPartitioner", ComponentCategory.CATEGORY_4_DI.getName()) != null) {
this.source = source;
createParallelizeParameters();
}
reconnect(source, target, lineStyle);
updateName();
if (lineStyle.equals(EConnectionType.RUN_IF)) {
ElementParameter param = new ElementParameter(this);
switch(LanguageManager.getCurrentLanguage()) {
case JAVA:
param.setFieldType(EParameterFieldType.MEMO_JAVA);
break;
default:
param.setFieldType(EParameterFieldType.MEMO_PERL);
}
param.setCategory(EComponentCategory.BASIC);
//$NON-NLS-1$
param.setValue("");
param.setNbLines(5);
param.setName(EParameterName.CONDITION.getName());
param.setDisplayName(EParameterName.CONDITION.getDisplayName());
param.setShow(true);
param.setNumRow(1);
param.setDefaultValue(param.getValue());
addElementParameter(param);
}
if (lineStyle.equals(EConnectionType.ROUTE_WHEN)) {
String[] strList = { "constant", "el", "groovy", "header", "javaScript", "jxpath", "mvel", "ognl", "php", "property", "python", "ruby", "simple", "spel", "sql", "xpath", "xquery" };
IElementParameter supportedLanguages = source.getElementParameter("ROUTE_WHEN_LANGUAGES");
if (supportedLanguages != null) {
Object[] values = supportedLanguages.getListItemsValue();
if (values != null) {
strList = new String[values.length];
System.arraycopy(values, 0, strList, 0, values.length);
}
}
IElementParameter param = new ElementParameter(this);
param.setCategory(EComponentCategory.BASIC);
param.setName(EParameterName.ROUTETYPE.getName());
param.setDisplayName(EParameterName.ROUTETYPE.getDisplayName());
param.setListItemsValue(strList);
param.setListItemsDisplayName(strList);
param.setListItemsDisplayCodeName(strList);
param.setNbLines(1);
param.setFieldType(EParameterFieldType.CLOSED_LIST);
param.setValue(supportedLanguages.getValue());
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
param = new ElementParameter(this);
switch(LanguageManager.getCurrentLanguage()) {
case JAVA:
param.setFieldType(EParameterFieldType.MEMO_JAVA);
break;
default:
param.setFieldType(EParameterFieldType.MEMO_PERL);
}
param.setCategory(EComponentCategory.BASIC);
//$NON-NLS-1$
param.setValue("");
param.setNbLines(5);
param.setName(EParameterName.CONDITION.getName());
param.setDisplayName(EParameterName.CONDITION.getDisplayName());
param.setShow(true);
param.setNumRow(2);
addElementParameter(param);
// TESB-8043
if ("cMessageRouter".equals(source.getComponent().getName())) {
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
//$NON-NLS-1$
param.setValue("false");
param.setName(EParameterName.ENDOFCHOICE.getName());
param.setDisplayName(EParameterName.ENDOFCHOICE.getDisplayName());
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
param.setValue("false");
param.setName(EParameterName.USE_NAMESPACES.getName());
param.setDisplayName(EParameterName.USE_NAMESPACES.getDisplayName());
param.setShowIf(EParameterName.ROUTETYPE.getName() + "=='xpath'");
param.setShow(true);
param.setNumRow(17);
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.TABLE);
param.setCategory(EComponentCategory.BASIC);
param.setName(EParameterName.NAMESPACES.getName());
param.setDisplayName(EParameterName.NAMESPACES.getDisplayName());
param.setShow(true);
param.setShowIf("(" + EParameterName.ROUTETYPE.getName() + "=='xpath') AND (" + EParameterName.USE_NAMESPACES.getName() + " == 'true')");
param.setNumRow(18);
String[] columns = new String[] { EParameterName.PREFIX.getName(), EParameterName.URI.getName() };
param.setListItemsDisplayCodeName(columns);
param.setListItemsDisplayName(new String[] { EParameterName.PREFIX.getDisplayName(), EParameterName.URI.getName() });
ElementParameter p = new ElementParameter(this);
p.setFieldType(EParameterFieldType.TEXT);
p.setName(EParameterName.PREFIX.getName());
ElementParameter p1 = new ElementParameter(this);
p1.setFieldType(EParameterFieldType.TEXT);
p1.setName(EParameterName.URI.getName());
param.setListItemsValue(new ElementParameter[] { p, p1 });
param.setValue(new ArrayList<Map<String, Object>>());
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.LABEL);
param.setCategory(EComponentCategory.BASIC);
param.setName("WARNING");
param.setDisplayName(EParameterName.LANGUAGEWARNING.getDisplayName());
param.setShow(true);
param.setShowIf("(" + EParameterName.ROUTETYPE.getName() + "=='xpath') AND (" + EParameterName.USE_NAMESPACES.getName() + " == 'true')");
param.setValue(EParameterName.LANGUAGEWARNING.getDisplayName());
param.setNumRow(19);
addElementParameter(param);
}
}
if (lineStyle.equals(EConnectionType.ROUTE_CATCH)) {
IElementParameter param = new ElementParameter(this);
param.setCategory(EComponentCategory.BASIC);
param.setName(EParameterName.EXCEPTIONLIST.getName());
param.setDisplayName(EParameterName.EXCEPTIONLIST.getDisplayName());
param.setNbLines(5);
param.setFieldType(EParameterFieldType.TEXT);
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
}
if (lineStyle.equals(EConnectionType.ITERATE)) {
IElementParameter param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
param.setValue(Boolean.FALSE);
param.setName(ENABLE_PARALLEL);
//$NON-NLS-1$
param.setDisplayName(Messages.getString("Connection.enableParallel"));
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.BASIC);
// param.setListItemsDisplayName(new String[] { "2", "3", "4" });
// param.setListItemsDisplayCodeName(new String[] { "2", "3", "4" });
// param.setListItemsValue(new String[] { "2", "3", "4" });
//$NON-NLS-1$
param.setValue("2");
param.setName(NUMBER_PARALLEL);
//$NON-NLS-1$
param.setDisplayName(Messages.getString("Connection.numberParallel"));
param.setShow(true);
//$NON-NLS-1$
param.setShowIf("ENABLE_PARALLEL == 'true'");
param.setNumRow(1);
param.setRequired(true);
addElementParameter(param);
}
// add activate parameter
ElementParameter param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setValue(Boolean.TRUE);
param.setName(EParameterName.ACTIVATE.getName());
param.setDisplayName(EParameterName.ACTIVATE.getDisplayName());
param.setShow(false);
param.setNumRow(1);
param.setDefaultValue(param.getValue());
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.UNIQUE_NAME.getName());
param.setValue(this.getUniqueName());
param.setDisplayName(EParameterName.UNIQUE_NAME.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(1);
param.setReadOnly(true);
param.setShow(false);
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.UPDATE_COMPONENTS.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.UPDATE_COMPONENTS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
param.setNumRow(5);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
addElementParameter(param);
if (lineStyle.hasConnectionCategory(IConnectionCategory.FLOW)) {
initTraceParamters();
}
if (PluginChecker.isTeamEdition()) {
boolean isLocalRepository = (ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider() instanceof ILocalRepositoryFactory);
param = new ElementParameter(this);
param.setName(EParameterName.RESUMING_CHECKPOINT.getName());
param.setValue(Boolean.FALSE);
param.setGroupDisplayName(EParameterName.RESUMING_CHECKPOINT.getDisplayName());
param.setDisplayName(EParameterName.RESUMING_CHECKPOINT.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.RESUMING);
param.setGroup(RESUMING_CHECKPOINT);
param.setNumRow(2);
param.setShow(true);
param.setReadOnly(isLocalRepository);
param.setDefaultValue(param.getValue());
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.RESUMLABEL.getName());
param.setDisplayName(EParameterName.RESUMLABEL.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.RESUMING);
param.setGroup(RESUMING_CHECKPOINT);
param.setValue("");
param.setNumRow(3);
param.setShow(true);
param.setReadOnly(isLocalRepository);
param.setDefaultValue(param.getValue());
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.FAILURE_INSTRUCTIONS.getName());
param.setDisplayName(EParameterName.FAILURE_INSTRUCTIONS.getDisplayName());
param.setFieldType(EParameterFieldType.MEMO);
param.setCategory(EComponentCategory.RESUMING);
param.setGroup(RESUMING_CHECKPOINT);
param.setNbLines(5);
param.setNumRow(4);
param.setShow(true);
param.setReadOnly(isLocalRepository);
param.setDefaultValue(param.getValue());
addElementParameter(param);
// breakpoint
if (lineStyle.hasConnectionCategory(IConnectionCategory.FLOW) || lineStyle.hasConnectionCategory(IConnectionCategory.MERGE)) {
param = new ElementParameter(this);
param.setName(EParameterName.ACTIVEBREAKPOINT.getName());
param.setDisplayName(EParameterName.ACTIVEBREAKPOINT.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BREAKPOINT);
param.setNumRow(13);
param.setValue(false);
param.setContextMode(false);
param.setDefaultValue(param.getValue());
param.setShow(true);
addElementParameter(param);
IComponent component = ComponentsFactoryProvider.getInstance().get("tFilterRow", ComponentCategory.CATEGORY_4_DI.getName());
Node tmpNode = new Node(component, (Process) source.getProcess());
tmpNode.setTemplate(source.isTemplate());
tmpNode.setGeneratedByJobscriptBool(source.isGeneratedByJobscriptBool());
tmpNode.addInput(this);
ElementParameter tmpParam = (ElementParameter) tmpNode.getElementParameter("LOGICAL_OP");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(14);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
tmpParam = (ElementParameter) tmpNode.getElementParameter("CONDITIONS");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(15);
ColumnListController.updateColumnList(tmpNode, null, true);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
tmpParam = (ElementParameter) tmpNode.getElementParameter("USE_ADVANCED");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(16);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
tmpParam = (ElementParameter) tmpNode.getElementParameter("ADVANCED_COND");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(17);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
}
}
}
use of org.talend.core.repository.model.ILocalRepositoryFactory in project tdi-studio-se by Talend.
the class ReloadSystemRoutinesAction method run.
@Override
public void run() {
try {
IRepositoryFactory factory = ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider();
if (factory instanceof ILocalRepositoryFactory) {
((ILocalRepositoryFactory) factory).synchronizeRoutines(null);
// TDI-21143 : Studio repository view : remove all refresh call to repo view
// IRepositoryView viewPart = RepositoryManagerHelper.findRepositoryView();
// if (viewPart != null) {
// viewPart.refresh(ERepositoryObjectType.ROUTINES);
// }
//$NON-NLS-1$
log.info(Messages.getString("ReloadSystemRoutinesAction.logInfo.sysRoutinesSuccessfullyReloaded"));
}
} catch (PersistenceException e) {
MessageBoxExceptionHandler.process(e);
}
}
Aggregations