/** * Declare fields for test. * * TODO: move to BaseParsingTest after CSV moving to BaseFileInput */ protected void setFields( BaseFileField... fields ) throws Exception { meta.inputFields = fields; meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } }
/** * Prepare to process. Executed only first time row processing. It can't be possible to prepare to process in the * init() phrase, because files can be in fields from previous step. */ protected void prepareToRowProcessing() throws KettleException { data.outputRowMeta = new RowMeta(); RowMetaInterface[] infoStep = null; if ( meta.inputFiles.acceptingFilenames ) { // input files from previous step infoStep = filesFromPreviousStep(); } // get the metadata populated. Simple and easy. meta.getFields( data.outputRowMeta, getStepname(), infoStep, null, this, repository, metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); BaseFileInputStepUtils.handleMissingFiles( data.files, log, meta.errorHandling.errorIgnored, data.dataErrorLineHandler ); // Count the number of repeat fields... for ( int i = 0; i < meta.inputFields.length; i++ ) { if ( meta.inputFields[i].isRepeated() ) { data.nr_repeats++; } } }
/** * Declare fields for test. */ protected void setFields( PropertyInputField... fields ) throws Exception { meta.setInputFields( fields ); meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); }
/** * Declare fields for test. */ protected void setFields( TextFileInputField... fields ) throws Exception { meta.setInputFields( fields ); meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); }
/** * Declare fields for test. */ protected void setFields( FixedFileInputField... fields ) throws Exception { meta.setFieldDefinition( fields ); meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (LoadFileInputMeta) smi; data = (LoadFileInputData) sdi; if ( super.init( smi, sdi ) ) { if ( !meta.getIsInFields() ) { try { data.files = meta.getFiles( this ); handleMissingFiles(); // Create the output row meta-data data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // get the // metadata // populated // Create convert meta-data objects that will contain Date & Number formatters // All non binary content is handled as a String. It would be converted to the target type after the processing. data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } catch ( Exception e ) { logError( "Error at step initialization: " + e.toString() ); logError( Const.getStackTracker( e ) ); return false; } } data.rownr = 1L; data.nrInputFields = meta.getInputFields().length; return true; } return false; }
data.convertMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (LDIFInputMeta) smi; data = (LDIFInputData) sdi; if ( super.init( smi, sdi ) ) { if ( !meta.isFileField() ) { data.files = meta.getFiles( this ); if ( data.files.nrOfFiles() == 0 && data.files.nrOfMissingFiles() == 0 ) { logError( BaseMessages.getString( PKG, "LDIFInput.Log.NoFiles" ) ); return false; } try { // Create the output row meta-data data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // Create convert meta-data objects that will contain Date & Number formatters data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); data.nrInputFields = meta.getInputFields().length; data.multiValueSeparator = environmentSubstitute( meta.getMultiValuedSeparator() ); } catch ( Exception e ) { logError( "Error initializing step: " + e.toString() ); logError( Const.getStackTracker( e ) ); return false; } } data.rownr = 1L; data.totalpreviousfields = 0; return true; } return false; }
data.conversionMeta = data.outputMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } catch ( Exception e ) { logError( "Error initializing step: " + e.toString() );
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { if ( first && !meta.isInFields() ) { first = false; data.files = meta.getFiles( this ); if ( !meta.isdoNotFailIfNoFile() && data.files.nrOfFiles() == 0 ) { throw new KettleException( BaseMessages.getString( PKG, "GetXMLData.Log.NoFiles" ) ); } handleMissingFiles(); // Create the output row meta-data data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // For String to <type> conversions, we allocate a conversion meta data row as well... // data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } // Grab a row Object[] r = getXMLRow(); if ( data.errorInRowButContinue ) { return true; // continue without putting the row out } if ( r == null ) { setOutputDone(); // signal end to receiver(s) return false; // end of data or error. } return putRowOut( r ); }
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.setConvertRowMeta( data.getOutputRowMeta().cloneToType( ValueMetaInterface.TYPE_STRING ) );
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.conversionMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );
data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); data.inputs = new InputsReader( this, meta, data, new InputErrorHandler() ).iterator();