FileParser Interface
This section provides the source code of the FileParser interface used by the Java class delivered with the Java package described earlier in this section.
package com.splwg.d1.sgg.osb.common;
import java.io.IOException;
import java.io.InputStream;
/** <p>
* FileParser component is responsible for processing the input
* stream and returning a Plain XML containing all data from
* incoming transaction in a shape expected by the following
* Oracle Service Bus message flow.
* </p>
*/
public interface FileParser {
/**
* Returns the next message in Plain XML format
* or null if there are no more messages
* @return next message as InputStream
*/
InputStream getNextStream() throws IOException;
/**
* Returns the current position in the currently
* parsed source input stream
* @return the position in source input stream after
* last incoming row was read and parsed
*/
long getPosition();
/**
* Sets source stream
* @param input the Input Stream that should be parsed
*/
void setInputStream(InputStream input);
/**
* Sets "owner" FileProcessor
* @param owner the Instance of FileProcessor that will
* be notified about current processing via call to
* utility methods (saveInvalidRow and setParseFinishNote)
*/
void setProcessor(FileProcessor owner);
/**
* Sets the position from which the parsing of source
* stream should be started.
* It is necessary if last time the processing of
* current file has been interrupted
* @param position the starting position
*/
void setStartPosition(long position);
/**
* Returns the byte array that contains a portion of an incoming
* file that most recently has been read and converted to Plain XML.
* It should be in the same format as incoming file. The header and
* tail records, if there are, should be included and updated according
* to the content
*/
byte[] getCurrentInputPortion();
/**
* Returns type of currently generated transaction - USAGE or EVENT
*/
FileProcessor.TransactionType getCurrentTransactionType();
/**
* Returns the number of successfully generated transactions of given type
*/
int getTransactionCount(FileProcessor.TransactionType type);
/**
* Returns the number of expected transactions in input stream
* Returns -1 if information not available
*/
int getTotalExpected();
}
Parent topic