use of org.pentaho.di.trans.Partitioner in project pentaho-kettle by pentaho.
the class SpoonStepsDelegate method getPartitionerDialog.
public StepDialogInterface getPartitionerDialog(StepMeta stepMeta, StepPartitioningMeta partitioningMeta, TransMeta transMeta) throws KettleException {
Partitioner partitioner = partitioningMeta.getPartitioner();
String dialogClassName = partitioner.getDialogClassName();
Class<?> dialogClass;
Class<?>[] paramClasses = new Class<?>[] { Shell.class, StepMeta.class, StepPartitioningMeta.class, TransMeta.class };
Object[] paramArgs = new Object[] { spoon.getShell(), stepMeta, partitioningMeta, transMeta };
Constructor<?> dialogConstructor;
try {
dialogClass = partitioner.getClass().getClassLoader().loadClass(dialogClassName);
dialogConstructor = dialogClass.getConstructor(paramClasses);
return (StepDialogInterface) dialogConstructor.newInstance(paramArgs);
} catch (Exception e) {
// try the old way for compatibility
Method method;
try {
Class<?>[] sig = new Class<?>[] { Shell.class, StepMetaInterface.class, TransMeta.class };
method = stepMeta.getClass().getDeclaredMethod("getDialog", sig);
if (method != null) {
return (StepDialogInterface) method.invoke(stepMeta, new Object[] { spoon.getShell(), stepMeta, transMeta });
}
} catch (Throwable ignored) {
}
throw new KettleException(e);
}
}
Aggregations