- java.lang.Object
-
- com.pervasive.datarush.operators.AbstractLogicalOperator
-
- com.pervasive.datarush.operators.CompositeOperator
-
- com.pervasive.datarush.operators.io.AbstractReader
-
- com.pervasive.datarush.operators.io.mdf.ReadMDF
-
- All Implemented Interfaces:
LogicalOperator,RecordSourceOperator,SourceOperator<RecordPort>
public class ReadMDF extends AbstractReader
Reads data previously written using MDF format. Currently only supports MDF version 4.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReadMDF.ExtractionMode
-
Field Summary
-
Fields inherited from class com.pervasive.datarush.operators.io.AbstractReader
options, output
-
-
Constructor Summary
Constructors Constructor Description ReadMDF()Reads an empty source with default settings.ReadMDF(Path path)Reads the file specified by the path.ReadMDF(ByteSource source)Reads the specified data source using default options.ReadMDF(String pattern)Reads all paths matching the specified pattern using default options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DataFormatcomputeFormat(CompositionContext ctx)Determines the data format for the source.booleangetConvertRaw()Get whether the raw values should have any associated conversion rules applied.intgetDataGroup()Sets the data group to read.longgetRecordId()Gets the record ids to read within the specified data channel.RecordTextSchema<?>getRecordSchema(FileClient fileClient)ReadMDF.ExtractionModegetRunMode()Gets the mode that decides what will be extracted from the MDF file.MDFUtil.MDFVersiongetVersion()Sets the expected MDF versionvoidsetConvertRaw(boolean convertRaw)Set whether raw values should have any associated conversion rules applied.voidsetDataGroup(int dataGroup)Gets the data group to read.voidsetRecordId(long recordId)Sets the record ids to read within the specified data channel.voidsetRunMode(ReadMDF.ExtractionMode runMode)Sets the mode that will decide what will be extracted from the MDF file.voidsetVersion(MDFUtil.MDFVersion version)Get the expected MDF version-
Methods inherited from class com.pervasive.datarush.operators.io.AbstractReader
compose, getExtraFieldAction, getFieldErrorAction, getFieldLengthThreshold, getIncludeSourceInfo, getMissingFieldAction, getOutput, getParseOptions, getPessimisticSplitting, getReadBuffer, getReadOnClient, getRecordWarningThreshold, getSelectedFields, getSource, getSplitOptions, getUseMetadata, setExtraFieldAction, setFieldErrorAction, setFieldLengthThreshold, setIncludeSourceInfo, setMissingFieldAction, setParseErrorAction, setParseOptions, setPessimisticSplitting, setReadBuffer, setReadOnClient, setRecordWarningThreshold, setSelectedFields, setSelectedFields, setSource, setSource, setSource, setSplitOptions, setUseMetadata
-
Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.pervasive.datarush.operators.LogicalOperator
disableParallelism, getInputPorts, getOutputPorts
-
-
-
-
Constructor Detail
-
ReadMDF
public ReadMDF()
Reads an empty source with default settings. The source must be set before execution or an error will be raised.- See Also:
AbstractReader.setSource(ByteSource)
-
ReadMDF
public ReadMDF(String pattern)
Reads all paths matching the specified pattern using default options. Any matching path which is a directory is replaced with all files in the directory; this expansion is not recursive.- Parameters:
pattern- a path-matching pattern- See Also:
FileClient.matchPaths(String)
-
ReadMDF
public ReadMDF(Path path)
Reads the file specified by the path. If the path refers to a a directory, all files in the directory are read; this read is not recursive into sub-directories.- Parameters:
path- the path to read
-
ReadMDF
public ReadMDF(ByteSource source)
Reads the specified data source using default options.- Parameters:
source- the data source to read
-
-
Method Detail
-
getVersion
public MDFUtil.MDFVersion getVersion()
Sets the expected MDF version- Returns:
- version of the MDF source
-
setVersion
public void setVersion(MDFUtil.MDFVersion version)
Get the expected MDF version- Parameters:
version- the version of the MDF source
-
getDataGroup
public int getDataGroup()
Sets the data group to read.- Returns:
- data group to read
-
setDataGroup
public void setDataGroup(int dataGroup)
Gets the data group to read.- Parameters:
dataGroup- the data group to read
-
getRecordId
public long getRecordId()
Gets the record ids to read within the specified data channel. If the record id is unspecified will read the first channel group.- Returns:
- record ids to read
-
setRecordId
public void setRecordId(long recordId)
Sets the record ids to read within the specified data channel. If the record id is unspecified will read the first channel group.- Parameters:
recordId- the record id to read
-
getConvertRaw
public boolean getConvertRaw()
Get whether the raw values should have any associated conversion rules applied.- Returns:
- convert raw whether to apply conversion rules
-
setConvertRaw
public void setConvertRaw(boolean convertRaw)
Set whether raw values should have any associated conversion rules applied.- Parameters:
convertRaw- whether to apply conversion rules
-
getRunMode
public ReadMDF.ExtractionMode getRunMode()
Gets the mode that decides what will be extracted from the MDF file. DATA - Extracts the data for the specified record ATTACHMENT - Extracts the raw binary data for any attachments METADATA - Extracts the metadata from the file- Returns:
- the mode that will be run
-
setRunMode
public void setRunMode(ReadMDF.ExtractionMode runMode)
Sets the mode that will decide what will be extracted from the MDF file. DATA - Extracts the data for the specified record ATTACHMENT - Extracts the raw binary data for any attachments METADATA - Extracts the metadata from the file- Parameters:
runMode- the mode that will be run
-
getRecordSchema
public RecordTextSchema<?> getRecordSchema(FileClient fileClient) throws IOException
- Throws:
IOException
-
computeFormat
protected DataFormat computeFormat(CompositionContext ctx)
Description copied from class:AbstractReaderDetermines the data format for the source. The returned format is used during composition to construct aReadSourceoperator. If an implementation supports schema discovery, it must be performed in this method.- Specified by:
computeFormatin classAbstractReader- Parameters:
ctx- the composition context for the current invocation ofAbstractReader.compose(CompositionContext)- Returns:
- the source format to use
-
-