Search in sources :

Example 1 with RunConfiguration

use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.

the class DefaultRunConfigurationProviderTest method testLoadNullName.

@Test
public void testLoadNullName() {
    RunConfiguration defaultRunConfiguration = defaultRunConfigurationProvider.load(null);
    assertEquals(defaultRunConfiguration.getType(), "Pentaho");
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) Test(org.junit.Test)

Example 2 with RunConfiguration

use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationDelegate method edit.

public void edit(RunConfiguration runConfiguration) {
    final String key = runConfiguration.getName();
    RunConfigurationDialog dialog = new RunConfigurationDialog(spoonSupplier.get().getShell(), configurationManager, runConfiguration);
    RunConfiguration savedRunConfiguration = dialog.open();
    if (savedRunConfiguration != null) {
        configurationManager.delete(key);
        configurationManager.save(savedRunConfiguration);
        spoonSupplier.get().refreshTree();
        updateLoadedJobs(key, savedRunConfiguration);
    }
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration)

Example 3 with RunConfiguration

use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationDelegate method create.

public void create() {
    List<String> names = configurationManager.getNames();
    String name = BaseMessages.getString(PKG, "RunConfigurationPopupMenuExtension.Configuration.Default") + " ";
    int index = 1;
    while (names.contains(name + String.valueOf(index))) {
        index++;
    }
    name = name + String.valueOf(index);
    DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
    defaultRunConfiguration.setName(name);
    RunConfigurationDialog dialog = new RunConfigurationDialog(spoonSupplier.get().getShell(), configurationManager, defaultRunConfiguration);
    RunConfiguration savedRunConfiguration = dialog.open();
    if (savedRunConfiguration != null) {
        configurationManager.save(savedRunConfiguration);
        spoonSupplier.get().refreshTree();
    }
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 4 with RunConfiguration

use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationPopupMenuExtension method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface logChannelInterface, Object extension) throws KettleException {
    Menu popupMenu = null;
    Tree selectionTree = (Tree) extension;
    TreeSelection[] objects = spoonSupplier.get().getTreeObjects(selectionTree);
    TreeSelection object = objects[0];
    Object selection = object.getSelection();
    if (selection == RunConfiguration.class) {
        popupMenu = createRootPopupMenu(selectionTree);
    } else if (selection instanceof RunConfiguration) {
        runConfiguration = (RunConfiguration) selection;
        if (runConfiguration.isReadOnly()) {
            return;
        }
        popupMenu = createItemPopupMenu(selectionTree);
    }
    if (popupMenu != null) {
        ConstUI.displayMenu(popupMenu, selectionTree);
    } else {
        selectionTree.setMenu(null);
    }
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) TreeSelection(org.pentaho.di.ui.spoon.TreeSelection) Tree(org.eclipse.swt.widgets.Tree) Menu(org.eclipse.swt.widgets.Menu)

Example 5 with RunConfiguration

use of org.pentaho.di.engine.configuration.api.RunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationManager method load.

@Override
public List<RunConfiguration> load() {
    List<RunConfiguration> runConfigurations = new ArrayList<>();
    for (RunConfigurationProvider runConfigurationProvider : getRunConfigurationProviders()) {
        runConfigurations.addAll(runConfigurationProvider.load());
    }
    Collections.sort(runConfigurations, (o1, o2) -> {
        if (o2.getName().equals(DefaultRunConfigurationProvider.DEFAULT_CONFIG_NAME)) {
            return 1;
        }
        return o1.getName().compareToIgnoreCase(o2.getName());
    });
    return runConfigurations;
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) ArrayList(java.util.ArrayList) RunConfigurationProvider(org.pentaho.di.engine.configuration.api.RunConfigurationProvider) DefaultRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider)

Aggregations

RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)16 DefaultRunConfiguration (org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration)7 AbstractMeta (org.pentaho.di.base.AbstractMeta)5 EmbeddedMetaStore (org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)5 EmbeddedRunConfigurationManager (org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager)5 RunConfigurationManager (org.pentaho.di.engine.configuration.impl.RunConfigurationManager)5 ArrayList (java.util.ArrayList)3 KettleException (org.pentaho.di.core.exception.KettleException)3 Map (java.util.Map)2 Test (org.junit.Test)2 ExtensionPoint (org.pentaho.di.core.extension.ExtensionPoint)2 Utils (org.pentaho.di.core.util.Utils)2 DefaultRunConfigurationProvider (org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 StringUtils (org.apache.commons.lang.StringUtils)1