Sun Adapter for Batch/FTP

com.stc.eways.batchext
Class BatchSingleRecordParser

java.lang.Object
  extended by com.stc.eways.batchext.BatchSingleRecordParser
All Implemented Interfaces:
BatchRecordParser

public class BatchSingleRecordParser
extends java.lang.Object
implements BatchRecordParser

This class is the implementation of the e*Way-supplied record parser for the Single record type.

See Also:
BatchRecordParser

Field Summary
protected  boolean recordProcessed
           
 
Constructor Summary
BatchSingleRecordParser()
           
 
Method Summary
 void finish(java.io.OutputStream output, java.io.InputStream input)
          You must call this method when you are done with a transfer, to clean up resources, finish processing, and so on.
 byte[] get(java.io.InputStream input)
          The get() method in the ETD calls this method to do the desired task.
 void initialize(BatchRecordConfiguration conf)
          This method is called by the underlying implementation immediately after the instance of the class is created.
 void put(java.io.OutputStream output, byte[] data)
          The put() method in the ETD calls this method to do the desired task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recordProcessed

protected boolean recordProcessed
Constructor Detail

BatchSingleRecordParser

public BatchSingleRecordParser()
Method Detail

initialize

public void initialize(BatchRecordConfiguration conf)
                throws java.lang.Exception
Description copied from interface: BatchRecordParser
This method is called by the underlying implementation immediately after the instance of the class is created. Aside from the constructor, it is guaranteed to be the first method called on this object. This method allows to configure your own internals.

Specified by:
initialize in interface BatchRecordParser
Parameters:
conf - An instance of the BatchRecordConfiguration class, which contains configuration-specific information for the parser.
Throws:
java.lang.Exception - If there is a problem with the properties passed in. The e*Way-supplied parsers can throw an exception if the configuration properties are incorrect.

get

public byte[] get(java.io.InputStream input)
           throws java.lang.Exception
Description copied from interface: BatchRecordParser
The get() method in the ETD calls this method to do the desired task. The semantics of the method mean, "Get the next record whatever that might be." For example, for fixed-sized records, this method returns the next record in the input of that size. This usage means that you have already dragged and dropped the data payload onto the Payload node in the ETD or set up a data-streaming link with another ETD. Also, the semantics of this method mean that it can, and usually is, called multiple times to extract records one by one from the data payload. No destructive actions are performed on the input data.

Specified by:
get in interface BatchRecordParser
Parameters:
input - Specifies the input to get the next record from.
Returns:
Returns the extracted record or a null when the input has been "consumed." A consumed input means that get has been called multiple times, and there are no more records left to get. The e*Way-supplied parsers do not throw an exception in this case.
Throws:
java.lang.Exception - If there is an error in parsing the input.

put

public void put(java.io.OutputStream output,
                byte[] data)
         throws java.lang.Exception
Description copied from interface: BatchRecordParser
The put() method in the ETD calls this method to do the desired task. The semantics of this method mean, "Here is another record to be appended to the output file". For example, for fixed-sized records, the payload data is assumed to be a blob of data of that size, and that blob must be appended to the payload buffer. Also, the semantics of this method mean that it is the parser's responsibility to inspect the data being passed in, for validity. Ultimately, after you have called this method and built an output file, you then generally use the Payload ETD node to access that output. Alternatively, you can direct that output to another ETD using data streaming.

Specified by:
put in interface BatchRecordParser
Parameters:
output - Specifies the output file or ETD (for data streaming) where a given record goes.
data - The data to be included in the record.
Throws:
java.lang.Exception - If there is a problem processing the data. The e*Way-supplied parsers throw exceptions from this method if there is a problem with the data, for example, for the fixed-size record parser if the data is not the correct size.

finish

public void finish(java.io.OutputStream output,
                   java.io.InputStream input)
            throws java.lang.Exception
Description copied from interface: BatchRecordParser
You must call this method when you are done with a transfer, to clean up resources, finish processing, and so on. Once this method is called, the parser must not be used again.

Specified by:
finish in interface BatchRecordParser
Parameters:
output - Specifies the output where the records go.
input - Specifies the input where the records come from.
Throws:
java.lang.Exception - If there is a problem finishing.

Sun Adapter for Batch/FTP