You can implement a custom class containing the splitting logic. The adapter provides a Java™ interface for the class. WebSphere® Adapter for FTP, version 7.5 supports additional splitting methods for the inbound process. Hence, there are two different interfaces available for the inbound and outbound process.
Use the com.ibm.j2ca.utils.filesplit.SplittingFunctionalityInterface interface for the outbound operations.
Following are the details of the interface:
public interface SplittingFunctionalityInterface extends Iterator{
public int getTotalBOs(String filename) throws SplittingException;
public void setBODetails(String filename, int currentPosition, int totalBOs,
boolean includeEndBODelimiter) throws SplittingException;
public void setSplitCriteria(String splitCriteria);
public void setEncoding(String encoding);
public void setLogUtils(LogUtils logUtils);
public boolean isSplitBySize()
}
This method returns the total number of business objects present in the event file specified in the filename.
This method is used to set the splitCriteria based on the number of business objects present in the event file. Each business object is returned during the next() call.
This method is used to set the LogUtils object, which is used to write trace and log messages to the files.
This method is used to set the encoding for the content of the event file. This encoding is used while reading the file content and for the splitCriteria.
This method is used to set the details for the business object to be returned during the next() call. The currentPosition parameter specifies the position of the business object to be returned. If the includeEndBODelimiter parameter is set to true, the business object content is retrieved based on the splitCriteria. Run this method before every next() call to retrieve the business object content as set in this method.
In addition, the iterator contains three methods, hasNext(), next(), and remove(), which must be implemented. The next() method returns the business object content (as a byte[]) for the business object position set in the setBODetails() method. If the position of the business object is not set, it fails. The hasNext() method indicates if the business object position set in the setBODetails() exists or not. Before a hasNext() call, the setBODetails() method must be called. The remove() method is called for each of the business object entries being deleted from the Event persistence table. Ensure not to delete the event file and only clean up the resources that are being used.
This method returns the value True if the event file is parsed based on the size. And returns the value False if the event file is parsed based on any other criteria, such as, delimiter.
Following are the details of the interface:
public interface InboundSplittingFunctionalityInterface{
public Hashtable getBOs(String filename,int quantity, long lastBO,long lastBOPos,boolean withDelim) throws SplittingException,MissingDataException;
public void setBODetails(String filename, long currentBO, long startPos, long endPos) throws SplittingException;
public Object getBOContent();
public boolean hasMoreBO();
public void remove();
public void setSplitCriteria(String splitCriteria);
public void setEncoding(String encoding);
public void setLogUtils(LogUtils logUtils);
public boolean isSplitBySize();
}
This method returns the business objects retrieved from the file specified in the filename in the form a hashtable. The hashtable that is returned contains the business object count (key) and the start/end positions of that business object (a long array of two elements). The quantity parameter specifies the number of business objects to be retrieved. The lastBOCount parameter specifies the number of business objects retrieved until when the file was previously read. The lastBOPos parameter specifies the end position of the business object when the file was previously read. The includeEndBODelimiter parameter specifies if the split criteria is included in the content returned for the business object. If the parameter is set to True the delimiter is included in the business object data.
This method is used to set the details for the current business object. Thereafter, the getBOContent() method retrieves the content of the business object specified in the currentBO. The startPosition and endPosition parameters specifie the start and end position for the business object in the file.
The getBOContent() method returns the business object content (as a byte[]) for the details set in setBODetails() method. If the start and end position of the business object is not set in the setBODetails() method then the getBOContent() method fails.
This method returns the value True if there are unread business objects existing in the file after the last call to the getBOs() method.
The remove() method is called for each of the business object entry being deleted from the Event persistence table. Ensure that you do not delete the event file and only clean up the resources that are being used.
This method returns the splitCriteria set based on the number of business objects in the event file. Each business object is returned during the getBOContent() call.
This method is used to set the LogUtils object, which is the class used to write trace and log messages to the files.
This method is used to set the encoding for the content of the event file. This encoding is used while reading the file content and for the splitCriteria.
This method returns the value True if the event file is parsed based on the size. And returns the value False if the event file is parsed based on any other criteria, such as, delimiter.