use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.
the class SparkRunConfigurationExecutorTest method testWssWebSocketVersionExecute.
@Test
public void testWssWebSocketVersionExecute() {
SparkRunConfiguration sparkRunConfiguration = new SparkRunConfiguration();
sparkRunConfiguration.setName("Spark Configuration");
sparkRunConfiguration.setSchema("https://");
sparkRunConfiguration.setUrl("127.0.0.2:8121");
TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
sparkRunConfigurationExecutor.execute(sparkRunConfiguration, transExecutionConfiguration, abstractMeta, variableSpace, null);
verify(variableSpace).setVariable("engine.protocol", "https");
verify(variableSpace).setVariable("engine.host", "127.0.0.2");
verify(variableSpace).setVariable("engine.port", "8121");
}
use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.
the class SparkRunConfigurationExecutorTest method testExecuteWithNoAelSecurityInstalled.
@Test
public void testExecuteWithNoAelSecurityInstalled() {
ICapability aelSecurityCapability = mock(ICapability.class);
setCapability(aelSecurityCapability, SparkRunConfigurationExecutor.AEL_SECURITY_CAPABILITY_ID, false);
ICapability jaasCapability = mock(ICapability.class);
setCapability(jaasCapability, SparkRunConfigurationExecutor.JAAS_CAPABILITY_ID, false);
SparkRunConfiguration sparkRunConfiguration = new SparkRunConfiguration();
sparkRunConfiguration.setName("Spark Configuration");
TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
sparkRunConfigurationExecutor.execute(sparkRunConfiguration, transExecutionConfiguration, abstractMeta, variableSpace, null);
verify(jaasCapability, never()).isInstalled();
}
use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.
the class SparkRunConfigurationExecutorTest method testExecuteWithAelSecurityInstalled.
@Test
public void testExecuteWithAelSecurityInstalled() {
ICapability aelSecurityCapability = mock(ICapability.class);
setCapability(aelSecurityCapability, SparkRunConfigurationExecutor.AEL_SECURITY_CAPABILITY_ID, true);
ICapability jaasCapability = mock(ICapability.class);
setCapability(jaasCapability, SparkRunConfigurationExecutor.JAAS_CAPABILITY_ID, false);
SparkRunConfiguration sparkRunConfiguration = new SparkRunConfiguration();
sparkRunConfiguration.setName("Spark Configuration");
TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
sparkRunConfigurationExecutor.execute(sparkRunConfiguration, transExecutionConfiguration, abstractMeta, variableSpace, null);
verify(jaasCapability).isInstalled();
verify(jaasCapability).install();
}
use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.
the class Spoon method init.
public void init(TransMeta ti) {
FormLayout layout = new FormLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
shell.setLayout(layout);
addFileListener(new TransFileListener());
addFileListener(new JobFileListener());
// INIT Data structure
if (ti != null) {
delegates.trans.addTransformation(ti);
}
// Load settings in the props
loadSettings();
transExecutionConfiguration = new TransExecutionConfiguration();
transExecutionConfiguration.setGatheringMetrics(true);
transPreviewExecutionConfiguration = new TransExecutionConfiguration();
transPreviewExecutionConfiguration.setGatheringMetrics(true);
transDebugExecutionConfiguration = new TransExecutionConfiguration();
transDebugExecutionConfiguration.setGatheringMetrics(true);
jobExecutionConfiguration = new JobExecutionConfiguration();
// Clean out every time we start, auto-loading etc, is not a good idea
// If they are needed that often, set them in the kettle.properties file
//
variables = new RowMetaAndData(new RowMeta());
// props.setLook(shell);
shell.setImage(GUIResource.getInstance().getImageSpoon());
cursor_hourglass = new Cursor(display, SWT.CURSOR_WAIT);
cursor_hand = new Cursor(display, SWT.CURSOR_HAND);
Composite sashComposite = null;
MainSpoonPerspective mainPerspective = null;
try {
KettleXulLoader xulLoader = new KettleXulLoader();
xulLoader.setIconsSize(16, 16);
xulLoader.setOuterContext(shell);
xulLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
ApplicationWindowLocal.setApplicationWindow(this);
mainSpoonContainer = xulLoader.loadXul(XUL_FILE_MAIN, new XulSpoonResourceBundle());
BindingFactory bf = new DefaultBindingFactory();
bf.setDocument(mainSpoonContainer.getDocumentRoot());
mainSpoonContainer.addEventHandler(this);
/* menuBar = (XulMenubar) */
mainSpoonContainer.getDocumentRoot().getElementById("spoon-menubar");
mainToolbar = (XulToolbar) mainSpoonContainer.getDocumentRoot().getElementById("main-toolbar");
props.setLook((Control) mainToolbar.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR);
/* canvas = (XulVbox) */
mainSpoonContainer.getDocumentRoot().getElementById("trans-job-canvas");
deck = (SwtDeck) mainSpoonContainer.getDocumentRoot().getElementById("canvas-deck");
final Composite tempSashComposite = new Composite(shell, SWT.None);
sashComposite = tempSashComposite;
mainPerspective = new MainSpoonPerspective(tempSashComposite, tabfolder);
if (startupPerspective == null) {
startupPerspective = mainPerspective.getId();
}
SpoonPerspectiveManager.getInstance().setStartupPerspective(startupPerspective);
SpoonPerspectiveManager.getInstance().addPerspective(mainPerspective);
SpoonPluginManager.getInstance().applyPluginsForContainer("spoon", mainSpoonContainer);
SpoonPerspectiveManager.getInstance().setDeck(deck);
SpoonPerspectiveManager.getInstance().setXulDoc(mainSpoonContainer);
SpoonPerspectiveManager.getInstance().initialize();
} catch (Exception e) {
LogChannel.GENERAL.logError("Error initializing transformation", e);
}
// addBar();
// Set the shell size, based upon previous time...
WindowProperty windowProperty = props.getScreen(APP_TITLE);
if (windowProperty != null) {
windowProperty.setShell(shell);
} else {
shell.pack();
// Default = maximized!
shell.setMaximized(true);
}
layout = new FormLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
GridData data = new GridData();
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
data.verticalAlignment = SWT.FILL;
data.horizontalAlignment = SWT.FILL;
sashComposite.setLayoutData(data);
sashComposite.setLayout(layout);
sashform = new SashForm(sashComposite, SWT.HORIZONTAL);
FormData fdSash = new FormData();
fdSash.left = new FormAttachment(0, 0);
// fdSash.top = new FormAttachment((org.eclipse.swt.widgets.ToolBar)
// toolbar.getNativeObject(), 0);
fdSash.top = new FormAttachment(0, 0);
fdSash.bottom = new FormAttachment(100, 0);
fdSash.right = new FormAttachment(100, 0);
sashform.setLayoutData(fdSash);
createPopupMenus();
addTree();
addTabs();
mainPerspective.setTabset(this.tabfolder);
((Composite) deck.getManagedObject()).layout(true, true);
SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifeCycleEvent.STARTUP);
// Add a browser widget
if (props.showWelcomePageOnStartup()) {
showWelcomePage();
}
// Allow data to be copied or moved to the drop target
int operations = DND.DROP_COPY | DND.DROP_DEFAULT;
DropTarget target = new DropTarget(shell, operations);
// Receive data in File format
final FileTransfer fileTransfer = FileTransfer.getInstance();
Transfer[] types = new Transfer[] { fileTransfer };
target.setTransfer(types);
target.addDropListener(new DropTargetListener() {
@Override
public void dragEnter(DropTargetEvent event) {
if (event.detail == DND.DROP_DEFAULT) {
if ((event.operations & DND.DROP_COPY) != 0) {
event.detail = DND.DROP_COPY;
} else {
event.detail = DND.DROP_NONE;
}
}
}
@Override
public void dragOver(DropTargetEvent event) {
event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
}
@Override
public void dragOperationChanged(DropTargetEvent event) {
if (event.detail == DND.DROP_DEFAULT) {
if ((event.operations & DND.DROP_COPY) != 0) {
event.detail = DND.DROP_COPY;
} else {
event.detail = DND.DROP_NONE;
}
}
}
@Override
public void dragLeave(DropTargetEvent event) {
}
@Override
public void dropAccept(DropTargetEvent event) {
}
@Override
public void drop(DropTargetEvent event) {
if (fileTransfer.isSupportedType(event.currentDataType)) {
String[] files = (String[]) event.data;
for (String file : files) {
openFile(file, false);
}
}
}
});
// listen for steps being added or removed
PluginRegistry.getInstance().addPluginListener(StepPluginType.class, new PluginTypeListener() {
@Override
public void pluginAdded(Object serviceObject) {
// hack to get the tree to reload
previousShowTrans = false;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
refreshCoreObjects();
}
});
}
@Override
public void pluginRemoved(Object serviceObject) {
// hack to get the tree to reload
previousShowTrans = false;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
refreshCoreObjects();
}
});
}
@Override
public void pluginChanged(Object serviceObject) {
}
});
}
use of org.pentaho.di.trans.TransExecutionConfiguration in project pentaho-kettle by pentaho.
the class SpoonTransformationDelegate method executeTransformation.
public void executeTransformation(final TransMeta transMeta, final boolean local, final boolean remote, final boolean cluster, final boolean preview, final boolean debug, final Date replayDate, final boolean safe, LogLevel logLevel) throws KettleException {
if (transMeta == null) {
return;
}
// See if we need to ask for debugging information...
//
TransDebugMeta transDebugMeta = null;
TransExecutionConfiguration executionConfiguration = null;
if (preview) {
executionConfiguration = spoon.getTransPreviewExecutionConfiguration();
} else if (debug) {
executionConfiguration = spoon.getTransDebugExecutionConfiguration();
} else {
executionConfiguration = spoon.getTransExecutionConfiguration();
}
// Set defaults so the run configuration can set it up correctly
executionConfiguration.setExecutingLocally(true);
executionConfiguration.setExecutingRemotely(false);
executionConfiguration.setExecutingClustered(false);
// Set repository and safe mode information in both the exec config and the metadata
transMeta.setRepository(spoon.rep);
transMeta.setMetaStore(spoon.metaStore);
executionConfiguration.setRepository(spoon.rep);
executionConfiguration.setSafeModeEnabled(safe);
if (debug) {
// See if we have debugging information stored somewhere?
//
transDebugMeta = transDebugMetaMap.get(transMeta);
if (transDebugMeta == null) {
transDebugMeta = new TransDebugMeta(transMeta);
transDebugMetaMap.put(transMeta, transDebugMeta);
}
// Set the default number of rows to retrieve on all selected steps...
//
List<StepMeta> selectedSteps = transMeta.getSelectedSteps();
if (selectedSteps != null && selectedSteps.size() > 0) {
transDebugMeta.getStepDebugMetaMap().clear();
for (StepMeta stepMeta : transMeta.getSelectedSteps()) {
StepDebugMeta stepDebugMeta = new StepDebugMeta(stepMeta);
stepDebugMeta.setRowCount(PropsUI.getInstance().getDefaultPreviewSize());
stepDebugMeta.setPausingOnBreakPoint(true);
stepDebugMeta.setReadingFirstRows(false);
transDebugMeta.getStepDebugMetaMap().put(stepMeta, stepDebugMeta);
}
}
} else if (preview) {
// See if we have preview information stored somewhere?
//
transDebugMeta = transPreviewMetaMap.get(transMeta);
if (transDebugMeta == null) {
transDebugMeta = new TransDebugMeta(transMeta);
transPreviewMetaMap.put(transMeta, transDebugMeta);
}
// Set the default number of preview rows on all selected steps...
//
List<StepMeta> selectedSteps = transMeta.getSelectedSteps();
if (selectedSteps != null && selectedSteps.size() > 0) {
transDebugMeta.getStepDebugMetaMap().clear();
for (StepMeta stepMeta : transMeta.getSelectedSteps()) {
StepDebugMeta stepDebugMeta = new StepDebugMeta(stepMeta);
stepDebugMeta.setRowCount(PropsUI.getInstance().getDefaultPreviewSize());
stepDebugMeta.setPausingOnBreakPoint(false);
stepDebugMeta.setReadingFirstRows(true);
transDebugMeta.getStepDebugMetaMap().put(stepMeta, stepDebugMeta);
}
}
}
int debugAnswer = TransDebugDialog.DEBUG_CONFIG;
if (debug || preview) {
// pass repository for mappings
transDebugMeta.getTransMeta().setRepository(spoon.rep);
TransDebugDialog transDebugDialog = new TransDebugDialog(spoon.getShell(), transDebugMeta);
debugAnswer = transDebugDialog.open();
if (debugAnswer != TransDebugDialog.DEBUG_CANCEL) {
executionConfiguration.setExecutingLocally(true);
executionConfiguration.setExecutingRemotely(false);
executionConfiguration.setExecutingClustered(false);
} else {
//
return;
}
}
Object[] data = spoon.variables.getData();
String[] fields = spoon.variables.getRowMeta().getFieldNames();
Map<String, String> variableMap = new HashMap<String, String>();
// the default
variableMap.putAll(executionConfiguration.getVariables());
for (int idx = 0; idx < fields.length; idx++) {
String value = executionConfiguration.getVariables().get(fields[idx]);
if (Utils.isEmpty(value)) {
value = data[idx].toString();
}
variableMap.put(fields[idx], value);
}
executionConfiguration.setVariables(variableMap);
executionConfiguration.getUsedVariables(transMeta);
executionConfiguration.getUsedArguments(transMeta, spoon.getArguments());
executionConfiguration.setReplayDate(replayDate);
executionConfiguration.setLogLevel(logLevel);
boolean execConfigAnswer = true;
if (debugAnswer == TransDebugDialog.DEBUG_CONFIG && replayDate == null && transMeta.isShowDialog()) {
TransExecutionConfigurationDialog dialog = new TransExecutionConfigurationDialog(spoon.getShell(), executionConfiguration, transMeta);
execConfigAnswer = dialog.open();
}
if (execConfigAnswer) {
TransGraph activeTransGraph = spoon.getActiveTransGraph();
activeTransGraph.transLogDelegate.addTransLog();
// Set the named parameters
Map<String, String> paramMap = executionConfiguration.getParams();
for (String key : paramMap.keySet()) {
transMeta.setParameterValue(key, Const.NVL(paramMap.get(key), ""));
}
transMeta.activateParameters();
//
if (executionConfiguration.getLogLevel() != null) {
transMeta.setLogLevel(executionConfiguration.getLogLevel());
}
// Set the run options
transMeta.setClearingLog(executionConfiguration.isClearingLog());
transMeta.setSafeModeEnabled(executionConfiguration.isSafeModeEnabled());
transMeta.setGatheringMetrics(executionConfiguration.isGatheringMetrics());
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.SpoonTransMetaExecutionStart.id, transMeta);
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.SpoonTransExecutionConfiguration.id, executionConfiguration);
try {
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.SpoonTransBeforeStart.id, new Object[] { executionConfiguration, transMeta, transMeta, spoon.getRepository() });
} catch (KettleException e) {
log.logError(e.getMessage(), transMeta.getFilename());
return;
}
if (!executionConfiguration.isExecutingLocally() && !executionConfiguration.isExecutingRemotely()) {
if (transMeta.hasChanged()) {
activeTransGraph.showSaveFileMessage();
}
}
//
if (debug || preview) {
if (transDebugMeta.getNrOfUsedSteps() == 0) {
MessageBox box = new MessageBox(spoon.getShell(), SWT.ICON_WARNING | SWT.YES | SWT.NO);
box.setText(BaseMessages.getString(PKG, "Spoon.Dialog.Warning.NoPreviewOrDebugSteps.Title"));
box.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.Warning.NoPreviewOrDebugSteps.Message"));
int answer = box.open();
if (answer != SWT.YES) {
return;
}
}
}
//
if (executionConfiguration.isExecutingLocally()) {
if (debug || preview) {
activeTransGraph.debug(executionConfiguration, transDebugMeta);
} else {
activeTransGraph.start(executionConfiguration);
}
// Are we executing remotely?
//
} else if (executionConfiguration.isExecutingRemotely()) {
activeTransGraph.handleTransMetaChanges(transMeta);
if (transMeta.hasChanged()) {
showSaveTransformationBeforeRunningDialog(spoon.getShell());
} else if (executionConfiguration.getRemoteServer() != null) {
String carteObjectId = Trans.sendToSlaveServer(transMeta, executionConfiguration, spoon.rep, spoon.metaStore);
monitorRemoteTrans(transMeta, carteObjectId, executionConfiguration.getRemoteServer());
spoon.delegates.slaves.addSpoonSlave(executionConfiguration.getRemoteServer());
} else {
MessageBox mb = new MessageBox(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.NoRemoteServerSpecified.Message"));
mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.NoRemoteServerSpecified.Title"));
mb.open();
}
// Are we executing clustered?
//
} else if (executionConfiguration.isExecutingClustered()) {
activeTransGraph.handleTransMetaChanges(transMeta);
if (transMeta.hasChanged()) {
showSaveTransformationBeforeRunningDialog(spoon.getShell());
} else {
splitTrans(transMeta, executionConfiguration);
}
}
}
}
Aggregations