use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class BaseStreamingDialog method loadFileTrans.
private void loadFileTrans(String fname) throws KettleException {
executorTransMeta = new TransMeta(transMeta.environmentSubstitute(fname), repository);
executorTransMeta.clearChanged();
specificationMethod = ObjectLocationSpecificationMethod.FILENAME;
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class BaseStreamingDialog method createSubTransMeta.
protected TransMeta createSubTransMeta() {
RecordsFromStreamMeta rm = new RecordsFromStreamMeta();
String[] fieldNames = getFieldNames();
int[] empty = new int[fieldNames.length];
Arrays.fill(empty, -1);
rm.setFieldname(fieldNames);
rm.setType(getFieldTypes());
rm.setLength(empty);
rm.setPrecision(empty);
StepMeta recsFromStream = new StepMeta("RecordsFromStream", "Get records from stream", rm);
recsFromStream.setLocation(new Point(100, 100));
recsFromStream.setDraw(true);
TransMeta transMeta = new TransMeta();
transMeta.addStep(recsFromStream);
transMeta.setFilename("");
return transMeta;
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class BaseStreamingDialog method createNewSubtrans.
protected void createNewSubtrans() {
TransMeta newSubTransMeta = createSubTransMeta();
boolean saved = false;
String path = null;
if (spoonInstance.getRepository() != null) {
try {
saved = spoonInstance.saveToRepository(newSubTransMeta);
path = getRepositoryRelativePath(newSubTransMeta.getPathAndName());
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Title"), BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Message"), e);
}
} else {
saved = spoonInstance.saveXMLFile(newSubTransMeta, false);
if (saved) {
try {
path = getRelativePath(KettleVFS.getFileObject(newSubTransMeta.getFilename()).toString());
} catch (KettleFileException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Title"), BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Message"), e);
}
}
}
if (saved && null != path) {
wTransPath.setText(path);
createSubtrans(newSubTransMeta);
if (props.showNewSubtransPopup()) {
NewSubtransDialog newSubtransDialog = new NewSubtransDialog(shell, SWT.NONE);
props.setShowNewSubtransPopup(!newSubtransDialog.open());
}
}
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class SimpleMappingDialog method loadFileTrans.
private void loadFileTrans(String fname) throws KettleException {
mappingTransMeta = new TransMeta(transMeta.environmentSubstitute(fname));
mappingTransMeta.clearChanged();
}
use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.
the class XBaseInputDialog method preview.
// Preview the data
private void preview() {
// Create the XML input step
try {
XBaseInputMeta oneMeta = new XBaseInputMeta();
getInfo(oneMeta);
if (oneMeta.isAcceptingFilenames()) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "XBaseInputDialog.Dialog.SpecifyASampleFile.Message"));
mb.setText(BaseMessages.getString(PKG, "XBaseInputDialog.Dialog.SpecifyASampleFile.Title"));
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "XBaseInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "XBaseInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), e);
}
}
Aggregations