com.univocity.api.data
Class DatasetProducer

java.lang.Object
  extended by com.univocity.api.data.DatasetProducer

public abstract class DatasetProducer
extends Object

A producer of datasets. Used to process values of a data entity and store the results in one or more datasets. Use DataIntegrationEngine.addDatasetProducer(EngineScope, DatasetProducer) to configure your dataset producer.

The datasets generated can be used by different entity mappings and their values are bound to a scope. The datasets will only be regenerated by the producer if their scope was destroyed.

Author:
uniVocity Software Pty Ltd - dev@univocity.com
See Also:
DataIntegrationEngine, DatasetProducerSetup

Constructor Summary
DatasetProducer(String... datasetNames)
           
 
Method Summary
abstract  Dataset getDataset(String name)
          Returns one of the datasets produced by this DatasetProducer as a result of processing records of a data entity.
 String[] getDatasetNames()
          Returns the names of the datasets produced by this object.
protected  int getFieldPosition(String fieldName)
          Returns the position of a given field in each record passed by uniVocity into processNext(Object[]).
protected  String[] getInputFields()
           
 void processEnded()
          used by uniVocity to notify this DatasetProducer that all records from the data entity have bean read.
abstract  void processNext(Object[] row)
          used by uniVocity to provide the next record extracted from the entity
 void processStarted()
          invoked after processStarted(String[]) is called by uniVocity and the positions of each field name in the input were populated.
 void processStarted(String[] fieldNames)
          used by uniVocity to inform this DatasetProducer a reading process has been started on the data entity it is bound to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatasetProducer

public DatasetProducer(String... datasetNames)
Method Detail

processStarted

public final void processStarted(String[] fieldNames)
used by uniVocity to inform this DatasetProducer a reading process has been started on the data entity it is bound to.

Parameters:
fieldNames - the field names of the records in an entity being loaded by uniVocity

getFieldPosition

protected final int getFieldPosition(String fieldName)
Returns the position of a given field in each record passed by uniVocity into processNext(Object[]).

Parameters:
fieldName - the name of the field to whose position in the input should be returned
Returns:
the position of the given field name in the input rows sent to this dataset producer.

getInputFields

protected final String[] getInputFields()

processStarted

public void processStarted()
invoked after processStarted(String[]) is called by uniVocity and the positions of each field name in the input were populated. Override this method to get the indexes of fields that will be read in each input row sent by uniVocity to processNext(Object[]).


processEnded

public void processEnded()
used by uniVocity to notify this DatasetProducer that all records from the data entity have bean read.


processNext

public abstract void processNext(Object[] row)
used by uniVocity to provide the next record extracted from the entity

Parameters:
row - the values of the entity record

getDataset

public abstract Dataset getDataset(String name)
Returns one of the datasets produced by this DatasetProducer as a result of processing records of a data entity.

Parameters:
name - the dataset name declared when configuring this DatasetProducer
Returns:
the dataset generated after processing records of a data entity.

getDatasetNames

public final String[] getDatasetNames()
Returns the names of the datasets produced by this object.

Returns:
the names of produced datasets


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.