org.pentaho.di.trans.step.StepDataInterface Java Examples
The following examples show how to use
org.pentaho.di.trans.step.StepDataInterface.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MailInput.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (MailInputMeta) smi; data = (MailInputData) sdi; Object[] outputRowData = getOneRow(); if ( outputRowData == null ) { // no more input to be expected... setOutputDone(); return false; } if ( isRowLevel() ) { log.logRowlevel( toString(), BaseMessages.getString( PKG, "MailInput.Log.OutputRow", data.outputRowMeta .getString( outputRowData ) ) ); } putRow( data.outputRowMeta, outputRowData ); // copy row to output rowset(s); if ( data.rowlimit > 0 && data.rownr >= data.rowlimit ) { // limit has been reached: stop now. setOutputDone(); return false; } return true; }
Example #2
Source File: FieldSplitter.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FieldSplitterMeta) smi; data = (FieldSplitterData) sdi; Object[] r = getRow(); // get row from rowset, wait for our turn, indicate busy! if ( r == null ) { // no more input to be expected... setOutputDone(); return false; } Object[] outputRowData = splitField( r ); putRow( data.outputMeta, outputRowData ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FieldSplitter.Log.LineNumber" ) + getLinesRead() ); } } return true; }
Example #3
Source File: GPLoad.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (GPLoadMeta) smi; data = (GPLoadData) sdi; Trans trans = getTrans(); preview = trans.isPreview(); if ( super.init( smi, sdi ) ) { try { verifyDatabaseConnection(); } catch ( KettleException ex ) { logError( ex.getMessage() ); return false; } return true; } return false; }
Example #4
Source File: FilterRows.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * @see StepInterface#init(org.pentaho.di.trans.step.StepMetaInterface , org.pentaho.di.trans.step.StepDataInterface) */ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (FilterRowsMeta) smi; data = (FilterRowsData) sdi; if ( super.init( smi, sdi ) ) { // PDI-6785 // could it be a better idea to have a clone on the condition in data and do this on the first row? meta.getCondition().clearFieldPositions(); List<StreamInterface> targetStreams = meta.getStepIOMeta().getTargetStreams(); data.trueStepname = targetStreams.get( 0 ).getStepname(); data.falseStepname = targetStreams.get( 1 ).getStepname(); data.chosesTargetSteps = targetStreams.get( 0 ).getStepMeta() != null || targetStreams.get( 1 ).getStepMeta() != null; return true; } return false; }
Example #5
Source File: XMLInput.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (XMLInputMeta) smi; data = (XMLInputData) sdi; if ( super.init( smi, sdi ) ) { data.files = meta.getFiles( this ).getFiles(); if ( data.files == null || data.files.size() == 0 ) { logError( BaseMessages.getString( PKG, "XMLInput.Log.NoFiles" ) ); return false; } data.rownr = 1L; return true; } return false; }
Example #6
Source File: SymmetricCryptoTrans.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (SymmetricCryptoTransMeta) smi; data = (SymmetricCryptoTransData) sdi; if ( super.init( smi, sdi ) ) { // Add init code here. try { // Define a new instance data.CryptMeta = new SymmetricCryptoMeta( meta.getAlgorithm() ); // Initialize a new crypto trans object data.Crypt = new SymmetricCrypto( data.CryptMeta, environmentSubstitute( meta.getSchema() ) ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "SymmetricCryptoTrans.ErrorInit." ), e ); return false; } return true; } return false; }
Example #7
Source File: SynchronizeAfterMergeTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Test public void initWithCommitSizeVariable() { StepMeta stepMeta = mock( StepMeta.class ); doReturn( STEP_NAME ).when( stepMeta ).getName(); doReturn( 1 ).when( stepMeta ).getCopies(); SynchronizeAfterMergeMeta smi = mock( SynchronizeAfterMergeMeta.class ); SynchronizeAfterMergeData sdi = mock( SynchronizeAfterMergeData.class ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); doReturn( mock( MySQLDatabaseMeta.class ) ).when( dbMeta ).getDatabaseInterface(); doReturn( dbMeta ).when( smi ).getDatabaseMeta(); doReturn( "${commit.size}" ).when( smi ).getCommitSize(); TransMeta transMeta = mock( TransMeta.class ); doReturn( "1" ).when( transMeta ).getVariable( Const.INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER ); doReturn( "2" ).when( transMeta ).getVariable( Const.INTERNAL_VARIABLE_CLUSTER_SIZE ); doReturn( "Y" ).when( transMeta ).getVariable( Const.INTERNAL_VARIABLE_CLUSTER_MASTER ); doReturn( stepMeta ).when( transMeta ).findStep( STEP_NAME ); SynchronizeAfterMerge step = mock( SynchronizeAfterMerge.class ); doCallRealMethod().when( step ).setTransMeta( any( TransMeta.class ) ); doCallRealMethod().when( step ).setStepMeta( any( StepMeta.class ) ); doCallRealMethod().when( step ).init( any( StepMetaInterface.class ), any( StepDataInterface.class ) ); doReturn( stepMeta ).when( step ).getStepMeta(); doReturn( transMeta ).when( step ).getTransMeta(); doReturn( "120" ).when( step ).environmentSubstitute( "${commit.size}" ); step.setTransMeta( transMeta ); step.setStepMeta( stepMeta ); step.init( smi, sdi ); assertEquals( 120, sdi.commitSize ); }
Example #8
Source File: SwitchCase.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * @see StepInterface#init(org.pentaho.di.trans.step.StepMetaInterface , org.pentaho.di.trans.step.StepDataInterface) */ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; if ( !super.init( smi, sdi ) ) { return false; } data.outputMap = meta.isContains() ? new ContainsKeyToRowSetMap() : new KeyToRowSetMap(); if ( Utils.isEmpty( meta.getFieldname() ) ) { logError( BaseMessages.getString( PKG, "SwitchCase.Log.NoFieldSpecifiedToSwitchWith" ) ); return false; } try { data.valueMeta = ValueMetaFactory.createValueMeta( meta.getFieldname(), meta.getCaseValueType() ); data.valueMeta.setConversionMask( meta.getCaseValueFormat() ); data.valueMeta.setGroupingSymbol( meta.getCaseValueGroup() ); data.valueMeta.setDecimalSymbol( meta.getCaseValueDecimal() ); data.stringValueMeta = ValueMetaFactory.cloneValueMeta( data.valueMeta, ValueMetaInterface.TYPE_STRING ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "SwitchCase.Log.UnexpectedError", e ) ); } return true; }
Example #9
Source File: DetectEmptyStream.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { data = (DetectEmptyStreamData) sdi; Object[] r = getRow(); // get row, set busy! if ( r == null ) { // no more input to be expected... if ( first ) { // input stream is empty ! data.outputRowMeta = getTransMeta().getPrevStepFields( getStepMeta() ); putRow( data.outputRowMeta, buildOneRow() ); // copy row to possible alternate rowset(s). if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "DetectEmptyStream.Log.LineNumber" ) + getLinesRead() ); } } } setOutputDone(); return false; } if ( first ) { first = false; } return true; }
Example #10
Source File: GraphOutput.java From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 | 5 votes |
@Override public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { data = (GraphOutputData) sdi; wrapUpTransaction(); if ( data.session != null ) { data.session.close(); } if ( data.cypherMap != null ) { data.cypherMap.clear(); } super.dispose( smi, sdi ); }
Example #11
Source File: OpenERPObjectInputMeta.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public StepDataInterface getStepData() { try { return new OpenERPObjectInputData( this.databaseMeta ); } catch ( Exception e ) { return null; } }
Example #12
Source File: MonetDBBulkLoader.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MonetDBBulkLoaderMeta) smi; data = (MonetDBBulkLoaderData) sdi; super.dispose( smi, sdi ); }
Example #13
Source File: Janino.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JaninoMeta) smi; data = (JaninoData) sdi; return super.init( smi, sdi ); }
Example #14
Source File: AccessInput.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] r = null; boolean sendToErrorRow = false; String errorMessage = null; try { // Grab one row Object[] outputRowData = getOneRow(); if ( outputRowData == null ) { setOutputDone(); // signal end to receiver(s) return false; // end of data or error. } putRow( data.outputRowMeta, outputRowData ); // copy row to output rowset(s); if ( meta.getRowLimit() > 0 && data.rownr > meta.getRowLimit() ) { // limit has been reached: stop now. setOutputDone(); return false; } } catch ( KettleException e ) { if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "AccessInput.ErrorInStepRunning", e.getMessage() ) ); setErrors( 1 ); stopAll(); setOutputDone(); // signal end to receiver(s) return false; } if ( sendToErrorRow ) { // Simply add this row to the error row putError( getInputRowMeta(), r, 1, errorMessage, null, "AccessInput001" ); } } return true; }
Example #15
Source File: DummyPlugin.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (DummyPluginMeta) smi; data = (DummyPluginData) sdi; return super.init( smi, sdi ); }
Example #16
Source File: RowGenerator.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { try { meta = (RowGeneratorMeta) smi; data = (RowGeneratorData) sdi; if ( super.init( smi, sdi ) ) { // Determine the number of rows to generate... data.rowLimit = Const.toLong( environmentSubstitute( meta.getRowLimit() ), -1L ); data.rowsWritten = 0L; data.delay = Const.toLong( environmentSubstitute( meta.getIntervalInMs() ), -1L ); if ( data.rowLimit < 0L ) { // Unable to parse logError( BaseMessages.getString( PKG, "RowGenerator.Wrong.RowLimit.Number" ) ); return false; // fail } // Create a row (constants) with all the values in it... List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>(); // stores the errors... RowMetaAndData outputRow = buildRow( meta, remarks, getStepname() ); if ( !remarks.isEmpty() ) { for ( int i = 0; i < remarks.size(); i++ ) { CheckResult cr = (CheckResult) remarks.get( i ); logError( cr.getText() ); } return false; } data.outputRowData = outputRow.getData(); data.outputRowMeta = outputRow.getRowMeta(); return true; } return false; } catch ( Exception e ) { setErrors( 1L ); logError( "Error initializing step", e ); return false; } }
Example #17
Source File: OlapInput.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { try { if ( first ) { // we just got started first = false; meta.initData( this ); data.rowNumber = 0; } for ( ; data.rowNumber < data.olapHelper.getRows().length; data.rowNumber++ ) { String[] row = data.olapHelper.getRows()[data.rowNumber]; Object[] outputRowData = RowDataUtil.allocateRowData( row.length ); outputRowData = row; putRow( data.outputRowMeta, outputRowData ); } setOutputDone(); // signal end to receiver(s) return false; // end of data or error. } catch ( Exception e ) { logError( "An error occurred, processing will be stopped", e ); setErrors( 1 ); stopAll(); return false; } }
Example #18
Source File: SocketReader.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (SocketReaderMeta) smi; data = (SocketReaderData) sdi; if ( super.init( smi, sdi ) ) { return true; } return false; }
Example #19
Source File: XMLInputSax.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { if ( first ) { first = false; data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // For String to <type> conversions, we allocate a conversion meta data row as well... // data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } Object[] outputRowData = getRowFromXML(); if ( outputRowData == null ) { setOutputDone(); // signal end to receiver(s) return false; // This is the end of this step. } if ( log.isRowLevel() ) { logRowlevel( "Read row: " + data.outputRowMeta.getString( outputRowData ) ); } putRow( data.outputRowMeta, outputRowData ); // limit has been reached: stop now. // if ( meta.getRowLimit() > 0 && data.rownr >= meta.getRowLimit() ) { setOutputDone(); return false; } return true; }
Example #20
Source File: RowsToResult.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (RowsToResultMeta) smi; data = (RowsToResultData) sdi; if ( super.init( smi, sdi ) ) { // Add init code here. return true; } return false; }
Example #21
Source File: ExecProcess.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ExecProcessMeta) smi; data = (ExecProcessData) sdi; super.dispose( smi, sdi ); }
Example #22
Source File: CubeInput.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (CubeInputMeta) smi; data = (CubeInputData) sdi; if ( super.init( smi, sdi ) ) { try { String filename = environmentSubstitute( meta.getFilename() ); // Add filename to result filenames ? if ( meta.isAddResultFile() ) { ResultFile resultFile = new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( filename, getTransMeta() ), getTransMeta().getName(), toString() ); resultFile.setComment( "File was read by a Cube Input step" ); addResultFile( resultFile ); } data.fis = KettleVFS.getInputStream( filename, this ); data.zip = new GZIPInputStream( data.fis ); data.dis = new DataInputStream( data.zip ); try { data.meta = new RowMeta( data.dis ); return true; } catch ( KettleFileException kfe ) { logError( BaseMessages.getString( PKG, "CubeInput.Log.UnableToReadMetadata" ), kfe ); return false; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "CubeInput.Log.ErrorReadingFromDataCube" ), e ); } } return false; }
Example #23
Source File: TableExists.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (TableExistsMeta) smi; data = (TableExistsData) sdi; if ( data.db != null ) { data.db.disconnect(); } super.dispose( smi, sdi ); }
Example #24
Source File: SystemData.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (SystemDataMeta) smi; data = (SystemDataData) sdi; if ( super.init( smi, sdi ) ) { data.readsRows = getStepMeta().getRemoteInputSteps().size() > 0; List<StepMeta> previous = getTransMeta().findPreviousSteps( getStepMeta() ); if ( previous != null && previous.size() > 0 ) { data.readsRows = true; } return true; } return false; }
Example #25
Source File: AggregateRows.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (AggregateRowsMeta) smi; data = (AggregateRowsData) sdi; if ( super.init( smi, sdi ) ) { int nrfields = meta.getFieldName().length; data.fieldnrs = new int[nrfields]; data.values = new Object[nrfields]; data.counts = new long[nrfields]; return true; } return false; }
Example #26
Source File: PropertyInput.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public PropertyInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ) { super( stepMeta, stepDataInterface, copyNr, transMeta, trans ); }
Example #27
Source File: SingleThreaderMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ) { return new SingleThreader( stepMeta, stepDataInterface, cnr, tr, trans ); }
Example #28
Source File: JmsProducerMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public StepDataInterface getStepData() { return new GenericStepData(); }
Example #29
Source File: SwitchCase.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public SwitchCase( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ) { super( stepMeta, stepDataInterface, copyNr, transMeta, trans ); }
Example #30
Source File: SortedMergeMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public StepDataInterface getStepData() { return new SortedMergeData(); }