public ModPartitionerDialog( Shell parent, StepMeta stepMeta, StepPartitioningMeta partitioningMeta, TransMeta transMeta ) { super( parent, (BaseStepMeta) stepMeta.getStepMetaInterface(), transMeta, partitioningMeta .getPartitioner().getDescription() ); this.stepMeta = stepMeta; this.partitioningMeta = partitioningMeta; partitioner = (ModPartitioner) partitioningMeta.getPartitioner(); fieldName = partitioner.getFieldName(); }
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 ); } }
public StepPartitioningMeta loadStepPartitioningMeta( ObjectId id_step ) throws KettleException { StepPartitioningMeta stepPartitioningMeta = new StepPartitioningMeta(); stepPartitioningMeta.setPartitionSchemaName( repository .getStepAttributeString( id_step, "PARTITIONING_SCHEMA" ) ); String methodCode = repository.getStepAttributeString( id_step, "PARTITIONING_METHOD" ); stepPartitioningMeta.setMethod( StepPartitioningMeta.getMethod( methodCode ) ); if ( stepPartitioningMeta.getPartitioner() != null ) { stepPartitioningMeta.getPartitioner().loadRep( repository, id_step ); } stepPartitioningMeta.hasChanged( true ); return stepPartitioningMeta; }
/** * Saves partitioning properties in the repository for the given step. * * @param meta * the partitioning metadata to store. * @param id_transformation * the ID of the transformation * @param id_step * the ID of the step * @throws KettleDatabaseException * In case anything goes wrong * */ public void saveStepPartitioningMeta( StepPartitioningMeta meta, ObjectId id_transformation, ObjectId id_step ) throws KettleException { repository.saveStepAttribute( id_transformation, id_step, "PARTITIONING_SCHEMA", meta.getPartitionSchema() != null ? meta .getPartitionSchema().getName() : "" ); // selected schema repository.saveStepAttribute( id_transformation, id_step, "PARTITIONING_METHOD", meta.getMethodCode() ); if ( meta.getPartitioner() != null ) { meta.getPartitioner().saveRep( repository, id_transformation, id_step ); } }
when( mockHelper.transMeta.findNextSteps( any( StepMeta.class ) ) ).thenReturn( stepMetas ); when( mockHelper.stepMeta.getStepPartitioningMeta() ).thenReturn( stepPartitioningMeta ); when( stepPartitioningMeta.getPartitioner() ).thenReturn( partitioner ); when( partitioner.getNrPartitions() ).thenReturn( 2 );
int partCount = ( (BasePartitioner) nextStepPartitioningMeta.getPartitioner() ).getNrPartitions();
String methodCode = getString( stepNode, PROP_PARTITIONING_METHOD ); stepPartitioningMeta.setMethod( StepPartitioningMeta.getMethod( methodCode ) ); if ( stepPartitioningMeta.getPartitioner() != null ) { proxy = new RepositoryProxy( stepNode.getNode( NODE_PARTITIONER_CUSTOM ) ); stepPartitioningMeta.getPartitioner().loadRep( proxy, null );
stepNode.setProperty( PROP_PARTITIONING_SCHEMA, ref ); if ( partitioningMeta.getPartitioner() != null ) { DataNode partitionerCustomNode = new DataNode( NODE_PARTITIONER_CUSTOM ); proxy = new RepositoryProxy( partitionerCustomNode ); partitioningMeta.getPartitioner().saveRep( proxy, null, null ); stepNode.addNode( partitionerCustomNode );
public DemoPartitionerDialog( Shell parent, StepMeta stepMeta, StepPartitioningMeta partitioningMeta, TransMeta transMeta ) { super( parent, (BaseStepMeta) stepMeta.getStepMetaInterface(), transMeta, partitioningMeta.getPartitioner().getDescription() ); this.stepMeta = stepMeta; this.partitioningMeta = partitioningMeta; partitioner = (DemoPartitioner) partitioningMeta.getPartitioner(); fieldName = partitioner.getFieldName(); }