de.phleisch.app.itsucks.processing
Interface DataProcessor

All Known Implementing Classes:
AbstractDataParser, AbstractDataProcessor, ContentParser, FilterFileSizeProcessor, HtmlParser, HttpRedirectorProcessor, PersistenceProcessor, SeekDataProcessorWrapper

public interface DataProcessor

A data processor is a single component in a processing chain which processes the data which is lead through.

Author:
olli

Method Summary
 void abort()
          Will be called when the chain is aborted.
 boolean canResume()
          Supports this data processor resuming?
 void finish()
          Shutdown the data processor.
 void init()
          Initializes the data processor.
 boolean isConsumer()
          'Consumes' (saves, parses etc.) this processor to the data or is it only an filter?
 boolean needsDataAsWholeChunk()
          Asks the processor if it needs the data from the data retriever in one chunk and not in multiple pieces.
 DataChunk process(DataChunk pDataChunk)
          Processes the given data chunk.
 void resumeAt(long pByteOffset)
          Resumes the processing at the given position.
 void rollback()
          Will be called when the chain is unexpectly aborted.
 void setProcessorChain(DataProcessorChain pChain)
          Sets the processor chain the processor is a part of.
 boolean supports(Job pJob)
          Returns true if this processor supports the given type of job.
 

Method Detail

supports

boolean supports(Job pJob)
Returns true if this processor supports the given type of job.

Parameters:
pJob -
Returns:

init

void init()
          throws ProcessingException
Initializes the data processor. (Create buffers, open file handles etc.)

Throws:
ProcessingException

finish

void finish()
Shutdown the data processor. (Release buffers, file handles etc.)

Throws:
java.lang.Exception

abort

void abort()
Will be called when the chain is aborted. After calling abort, finish is also called.


rollback

void rollback()
Will be called when the chain is unexpectly aborted. After calling rollback, finish is also called.


canResume

boolean canResume()
Supports this data processor resuming?

Returns:
true == yes

isConsumer

boolean isConsumer()
'Consumes' (saves, parses etc.) this processor to the data or is it only an filter? If an chain contains no consumer, the data is not processed.

Returns:
true == yes

resumeAt

void resumeAt(long pByteOffset)
Resumes the processing at the given position.

Parameters:
pByteOffset - The offset position in bytes.

process

DataChunk process(DataChunk pDataChunk)
                  throws ProcessingException
Processes the given data chunk.

Parameters:
pDataChunk -
Returns:
The pDataChunk pointer or a new pointer to changed data.
Throws:
ProcessingException

needsDataAsWholeChunk

boolean needsDataAsWholeChunk()
Asks the processor if it needs the data from the data retriever in one chunk and not in multiple pieces.

Returns:

setProcessorChain

void setProcessorChain(DataProcessorChain pChain)
Sets the processor chain the processor is a part of.

Parameters:
pChain -


Copyright © 2008. All Rights Reserved.