Search in sources :

Example 1 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class TransFileListener method open.

public boolean open(Node transNode, String fname, boolean importfile) throws KettleMissingPluginsException {
    final Spoon spoon = Spoon.getInstance();
    final PropsUI props = PropsUI.getInstance();
    try {
        // Call extension point(s) before the file has been opened
        ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.TransBeforeOpen.id, fname);
        TransMeta transMeta = new TransMeta();
        transMeta.loadXML(transNode, fname, spoon.getMetaStore(), spoon.getRepository(), true, new Variables(), new OverwritePrompter() {

            public boolean overwritePrompt(String message, String rememberText, String rememberPropertyName) {
                MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
                Object[] res = spoon.messageDialogWithToggle(BaseMessages.getString(PKG, "System.Button.Yes"), null, message, Const.WARNING, new String[] { BaseMessages.getString(PKG, "System.Button.Yes"), BaseMessages.getString(PKG, "System.Button.No") }, 1, rememberText, !props.askAboutReplacingDatabaseConnections());
                int idx = ((Integer) res[0]).intValue();
                boolean toggleState = ((Boolean) res[1]).booleanValue();
                props.setAskAboutReplacingDatabaseConnections(!toggleState);
                // Yes means: overwrite
                return ((idx & 0xFF) == 0);
            }
        });
        if (transMeta.hasMissingPlugins()) {
            StepMeta stepMeta = transMeta.getStep(0);
            MissingTransDialog missingDialog = new MissingTransDialog(spoon.getShell(), transMeta.getMissingTrans(), stepMeta.getStepMetaInterface(), transMeta, stepMeta.getName());
            if (missingDialog.open() == null) {
                return true;
            }
        }
        transMeta.setRepositoryDirectory(spoon.getDefaultSaveLocation(transMeta));
        transMeta.setRepository(spoon.getRepository());
        transMeta.setMetaStore(spoon.getMetaStore());
        spoon.setTransMetaVariables(transMeta);
        spoon.getProperties().addLastFile(LastUsedFile.FILE_TYPE_TRANSFORMATION, fname, null, false, null);
        spoon.addMenuLast();
        // if any exist.
        if (importfile) {
            if (spoon.getRepository() != null) {
                transMeta = fixLinks(transMeta);
            }
        } else {
            transMeta.clearChanged();
        }
        transMeta.setFilename(fname);
        spoon.addTransGraph(transMeta);
        spoon.sharedObjectsFileMap.put(transMeta.getSharedObjects().getFilename(), transMeta.getSharedObjects());
        // Call extension point(s) now that the file has been opened
        ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.TransAfterOpen.id, transMeta);
        SpoonPerspectiveManager.getInstance().activatePerspective(MainSpoonPerspective.class);
        spoon.refreshTree();
        return true;
    } catch (KettleMissingPluginsException e) {
        throw e;
    } catch (KettleException e) {
        new ErrorDialog(spoon.getShell(), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Message") + fname, e);
    }
    return false;
}
Also used : Variables(org.pentaho.di.core.variables.Variables) KettleException(org.pentaho.di.core.exception.KettleException) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) MissingTransDialog(org.pentaho.di.ui.trans.steps.missing.MissingTransDialog) TransMeta(org.pentaho.di.trans.TransMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) OverwritePrompter(org.pentaho.di.core.gui.OverwritePrompter) StepMeta(org.pentaho.di.trans.step.StepMeta) PropsUI(org.pentaho.di.ui.core.PropsUI)

Example 2 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class JobEntryCreateFolder method main.

public static void main(String[] args) {
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    new JobEntryCreateFile().check(remarks, null, new Variables(), null, null);
    System.out.printf("Remarks: %s\n", remarks);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) JobEntryCreateFile(org.pentaho.di.job.entries.createfile.JobEntryCreateFile) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Example 3 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class JobEntrySFTP method main.

public static void main(String[] args) {
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    new JobEntrySFTP().check(remarks, null, new Variables(), null, null);
    System.out.printf("Remarks: %s\n", remarks);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Example 4 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class JobEntryExportRepository method main.

public static void main(String[] args) {
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    new JobEntrySFTP().check(remarks, null, new Variables(), null, null);
    System.out.printf("Remarks: %s\n", remarks);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) JobEntrySFTP(org.pentaho.di.job.entries.sftp.JobEntrySFTP) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Example 5 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class JobEntryJob method main.

public static void main(String[] args) {
    List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
    new JobEntryJob().check(remarks, null, new Variables(), null, null);
    System.out.printf("Remarks: %s\n", remarks);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface)

Aggregations

Variables (org.pentaho.di.core.variables.Variables)119 Test (org.junit.Test)67 TransMeta (org.pentaho.di.trans.TransMeta)31 ArrayList (java.util.ArrayList)25 CheckResultInterface (org.pentaho.di.core.CheckResultInterface)20 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)20 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)20 StepMeta (org.pentaho.di.trans.step.StepMeta)18 RowMeta (org.pentaho.di.core.row.RowMeta)17 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)16 VariableSpace (org.pentaho.di.core.variables.VariableSpace)14 Repository (org.pentaho.di.repository.Repository)12 TableView (org.pentaho.di.ui.core.widget.TableView)10 FormAttachment (org.eclipse.swt.layout.FormAttachment)9 FormData (org.eclipse.swt.layout.FormData)9 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)9 Label (org.eclipse.swt.widgets.Label)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)7