use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationImportExtensionPoint method createSlaveServerRunConfigurations.
private List<RunConfiguration> createSlaveServerRunConfigurations(List<String> existingConfigurationNames, AbstractMeta abstractMeta) {
List<RunConfiguration> runConfigurations = new ArrayList<>();
if (abstractMeta instanceof JobMeta) {
JobMeta jobMeta = (JobMeta) abstractMeta;
Map<String, List<JobEntryTrans>> slaveServerGroups = jobMeta.getJobCopies().stream().map(JobEntryCopy::getEntry).filter(entry -> entry instanceof JobEntryTrans).map(entry -> (JobEntryTrans) entry).filter(entry -> Utils.isEmpty(entry.getRunConfiguration())).filter(entry -> !Utils.isEmpty(entry.getRemoteSlaveServerName())).collect(Collectors.groupingBy(JobEntryTrans::getRemoteSlaveServerName));
slaveServerGroups.forEach((remoteServerName, entries) -> {
String runConfigurationName = createRunConfigurationName(existingConfigurationNames, remoteServerName);
DefaultRunConfiguration runConfiguration = createRunConfiguration(runConfigurationName, remoteServerName);
runConfigurations.add(runConfiguration);
entries.forEach(e -> e.setRunConfiguration(runConfiguration.getName()));
});
}
return runConfigurations;
}
use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationSaveExtensionPoint method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface logChannelInterface, Object o) throws KettleException {
AbstractMeta abstractMeta = (AbstractMeta) ((Object[]) o)[0];
String runConfiguration = (String) ((Object[]) o)[1];
final EmbeddedMetaStore embeddedMetaStore = abstractMeta.getEmbeddedMetaStore();
RunConfigurationManager embeddedRunConfigurationManager = EmbeddedRunConfigurationManager.build(embeddedMetaStore);
embeddedRunConfigurationManager.deleteAll();
RunConfiguration loadedRunConfiguration = runConfigurationManager.load(abstractMeta.environmentSubstitute(runConfiguration));
embeddedRunConfigurationManager.save(loadedRunConfiguration);
}
use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationDialog method open.
public RunConfiguration open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 15;
formLayout.marginHeight = 15;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "RunConfigurationDialog.Title"));
shell.setImage(getImage());
Composite wSettings = new Composite(shell, SWT.SHADOW_NONE);
props.setLook(wSettings);
FormLayout specLayout = new FormLayout();
specLayout.marginWidth = 0;
specLayout.marginHeight = 0;
wSettings.setLayout(specLayout);
wlName = new Label(wSettings, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "RunConfigurationDialog.Label.Name"));
props.setLook(wlName);
FormData fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, 0);
wlName.setLayoutData(fdlName);
wName = new Text(wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
FormData fdName = new FormData();
fdName.left = new FormAttachment(0, 0);
fdName.top = new FormAttachment(wlName, 5);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wName.addModifyListener(modifyEvent -> {
runConfiguration.setName(wName.getText());
if (Utils.isEmpty(runConfiguration.getName())) {
wOK.setEnabled(false);
} else {
wOK.setEnabled(true);
}
});
wlDescription = new Label(wSettings, SWT.RIGHT);
wlDescription.setText(BaseMessages.getString(PKG, "RunConfigurationDialog.Label.Description"));
props.setLook(wlDescription);
FormData fdlDescription = new FormData();
fdlDescription.left = new FormAttachment(0, 0);
fdlDescription.top = new FormAttachment(wName, 10);
wlDescription.setLayoutData(fdlDescription);
wDescription = new Text(wSettings, SWT.MULTI | SWT.LEFT | SWT.BORDER);
props.setLook(wDescription);
FormData fdDescription = new FormData();
fdDescription.height = 40;
fdDescription.left = new FormAttachment(0, 0);
fdDescription.top = new FormAttachment(wlDescription, 5);
fdDescription.right = new FormAttachment(100, 0);
wDescription.setLayoutData(fdDescription);
wDescription.addModifyListener(modifyEvent -> runConfiguration.setDescription(wDescription.getText()));
wlEngine = new Label(wSettings, SWT.RIGHT);
wlEngine.setText(BaseMessages.getString(PKG, "RunConfigurationDialog.Label.Engine"));
props.setLook(wlEngine);
FormData fdlEngine = new FormData();
fdlEngine.left = new FormAttachment(0, 0);
fdlEngine.top = new FormAttachment(wDescription, 10);
wlEngine.setLayoutData(fdlEngine);
wEngine = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wEngine.setItems(executionConfigurationManager.getTypes());
wEngine.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
String engine = wEngine.getText();
if (!engine.equals(runConfiguration.getType())) {
updateOptions(engine);
}
}
});
wEngine.select(0);
props.setLook(wEngine);
FormData fdEngine = new FormData();
fdEngine.width = 150;
fdEngine.left = new FormAttachment(0, 0);
fdEngine.top = new FormAttachment(wlEngine, 5);
wEngine.setLayoutData(fdEngine);
gOptions = new Group(wSettings, SWT.SHADOW_ETCHED_IN);
gOptions.setText(BaseMessages.getString(PKG, "RunConfigurationDialog.Group.Settings"));
props.setLook(gOptions);
FormData fdOptions = new FormData();
fdOptions.top = new FormAttachment(wEngine, 15);
fdOptions.right = new FormAttachment(100);
fdOptions.left = new FormAttachment(0);
fdOptions.height = 140;
gOptions.setLayoutData(fdOptions);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
FormData fdCancel = new FormData();
fdCancel.right = new FormAttachment(100, 0);
fdCancel.bottom = new FormAttachment(100, 0);
wCancel.setLayoutData(fdCancel);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
FormData fdOk = new FormData();
fdOk.right = new FormAttachment(wCancel, -5);
fdOk.bottom = new FormAttachment(100, 0);
wOK.setLayoutData(fdOk);
Label hSpacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdhSpacer = new FormData();
fdhSpacer.height = 1;
fdhSpacer.left = new FormAttachment(0, 0);
fdhSpacer.bottom = new FormAttachment(wCancel, -15);
fdhSpacer.right = new FormAttachment(100, 0);
hSpacer.setLayoutData(fdhSpacer);
FormData fdSettings = new FormData();
fdSettings.left = new FormAttachment(0);
fdSettings.top = new FormAttachment(0);
fdSettings.right = new FormAttachment(100);
fdSettings.bottom = new FormAttachment(hSpacer, -15);
wSettings.setLayoutData(fdSettings);
setValues();
Listener lsCancel = e -> cancel();
Listener lsOK = e -> ok();
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
BaseStepDialog.setSize(shell, 450, 300);
shell.setMinimumSize(shell.getSize());
wName.setSelection(0, wName.getText().length());
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return savedRunConfiguration;
}
use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationDialog method updateOptions.
private void updateOptions(String type) {
RunConfiguration newRunConfiguration = runConfigurationMap.get(type);
if (newRunConfiguration == null) {
newRunConfiguration = executionConfigurationManager.getRunConfigurationByType(type);
newRunConfiguration.setName(runConfiguration.getName());
newRunConfiguration.setDescription(runConfiguration.getDescription());
runConfigurationMap.put(type, newRunConfiguration);
}
runConfiguration = newRunConfiguration;
setValues();
}
use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationTreeDelegateExtension method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface log, Object extension) throws KettleException {
SpoonTreeDelegateExtension treeDelExt = (SpoonTreeDelegateExtension) extension;
int caseNumber = treeDelExt.getCaseNumber();
AbstractMeta meta = treeDelExt.getTransMeta();
String[] path = treeDelExt.getPath();
List<TreeSelection> objects = treeDelExt.getObjects();
TreeSelection object = null;
if (path[2].equals(RunConfigurationViewTreeExtension.TREE_LABEL)) {
switch(caseNumber) {
case 3:
object = new TreeSelection(path[2], RunConfiguration.class, meta);
break;
case 4:
try {
RunConfiguration runConfiguration = runConfigurationManager.load(path[3]);
if (!runConfiguration.isReadOnly()) {
object = new TreeSelection(path[3], runConfiguration, meta);
}
} catch (Exception e) {
// Do Nothing
}
break;
}
}
if (object != null) {
objects.add(object);
}
}
Aggregations