Search in sources :

Example 1 with MethodProcessor

use of org.pentaho.di.ui.spoon.partition.processor.MethodProcessor in project pentaho-kettle by pentaho.

the class Spoon method editPartitioning.

public void editPartitioning(TransMeta transMeta, StepMeta stepMeta) {
    String[] schemaNames;
    try {
        schemaNames = pickupPartitionSchemaNames(transMeta);
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.ErrorDialog.Title"), BaseMessages.getString(PKG, "Spoon.ErrorDialog.ErrorFetchingFromRepo.PartitioningSchemas"), e);
        return;
    }
    try {
        /*Check if Partition schema has already defined*/
        if (isDefinedSchemaExist(schemaNames)) {
            /*Prepare settings for Method selection*/
            PluginRegistry registry = PluginRegistry.getInstance();
            List<PluginInterface> plugins = registry.getPlugins(PartitionerPluginType.class);
            int exactSize = StepPartitioningMeta.methodDescriptions.length + plugins.size();
            PartitionSettings settings = new PartitionSettings(exactSize, transMeta, stepMeta, this);
            settings.fillOptionsAndCodesByPlugins(plugins);
            /*Method selection*/
            PartitionMethodSelector methodSelector = new PartitionMethodSelector();
            String partitionMethodDescription = methodSelector.askForPartitionMethod(shell, settings);
            if (!StringUtil.isEmpty(partitionMethodDescription)) {
                String method = settings.getMethodByMethodDescription(partitionMethodDescription);
                int methodType = StepPartitioningMeta.getMethodType(method);
                settings.updateMethodType(methodType);
                settings.updateMethod(method);
                /*Schema selection*/
                MethodProcessor methodProcessor = MethodProcessorFactory.create(methodType);
                methodProcessor.schemaSelection(settings, shell, delegates);
            }
            addUndoChange(settings.getTransMeta(), new StepMeta[] { settings.getBefore() }, new StepMeta[] { settings.getAfter() }, new int[] { settings.getTransMeta().indexOfStep(settings.getStepMeta()) });
            refreshGraph();
        }
    } catch (Exception e) {
        new ErrorDialog(shell, "Error", "There was an unexpected error while editing the partitioning method specifics:", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) MethodProcessor(org.pentaho.di.ui.spoon.partition.processor.MethodProcessor) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) PartitionSettings(org.pentaho.di.ui.spoon.partition.PartitionSettings) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PartitionMethodSelector(org.pentaho.di.ui.spoon.partition.PartitionMethodSelector) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) SWTException(org.eclipse.swt.SWTException) KettleRowException(org.pentaho.di.core.exception.KettleRowException) FileSystemException(org.apache.commons.vfs2.FileSystemException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleAuthException(org.pentaho.di.core.exception.KettleAuthException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleException(org.pentaho.di.core.exception.KettleException) MalformedURLException(java.net.MalformedURLException)

Aggregations

MalformedURLException (java.net.MalformedURLException)1 FileSystemException (org.apache.commons.vfs2.FileSystemException)1 SWTException (org.eclipse.swt.SWTException)1 KettleAuthException (org.pentaho.di.core.exception.KettleAuthException)1 KettleException (org.pentaho.di.core.exception.KettleException)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 KettleMissingPluginsException (org.pentaho.di.core.exception.KettleMissingPluginsException)1 KettleRowException (org.pentaho.di.core.exception.KettleRowException)1 KettleValueException (org.pentaho.di.core.exception.KettleValueException)1 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)1 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)1 Point (org.pentaho.di.core.gui.Point)1 LifecycleException (org.pentaho.di.core.lifecycle.LifecycleException)1 PluginInterface (org.pentaho.di.core.plugins.PluginInterface)1 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1 PartitionMethodSelector (org.pentaho.di.ui.spoon.partition.PartitionMethodSelector)1 PartitionSettings (org.pentaho.di.ui.spoon.partition.PartitionSettings)1