com.bea.alsb.financial.api
Class BatchAPI

java.lang.Object
  extended by com.bea.alsb.financial.api.BatchAPI

public final class BatchAPI
extends Object

This class provides an API for dealing with message batches - splitting a batch into multiple individual messages, and aggregating multiple messages into a batch.

The relevant methods are all public static so that they can be used from ALSB Java Callouts. The class is not designed to be instantiated, and cannot be as it has a private constructor.


Method Summary
static StringMessageAggregator addStringMessage(String message, StringMessageAggregator aggregator)
          Adds a string message to a string message batch.
static StringMessageAggregator createStringMessageAggregator(String separator, boolean appendAtTheEnd)
          Creates a message aggregator for String messages.
static String getAggregatedStringMessageBatch(StringMessageAggregator aggregator)
          Constructs the batch from a collection of messages stored in an aggregator.
static XmlTextMessageWrappersDocument parseStringBatch(String messageBatch, String separator)
          Parses and splits a string batch into multiple messages.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addStringMessage

public static StringMessageAggregator addStringMessage(String message,
                                                       StringMessageAggregator aggregator)
Adds a string message to a string message batch.

Parameters:
message - the message to be added.
aggregator - the aggregator to add to.
Returns:
the aggregator after adding the message.
See Also:
com.bea.alsb.financial.services.BatchService#addStringMessage(java.lang.String, com.bea.alsb.financial.api.StringMessageAggregator)

createStringMessageAggregator

public static StringMessageAggregator createStringMessageAggregator(String separator,
                                                                    boolean appendAtTheEnd)
Creates a message aggregator for String messages.

Parameters:
separator - the separator to insert between messages.
appendAtTheEnd - true to append a separator after a new message, false otherwise.
Returns:
the newly-created aggregator.
See Also:
com.bea.alsb.financial.services.BatchService#createStringMessageAggregator(java.lang.String, boolean)

getAggregatedStringMessageBatch

public static String getAggregatedStringMessageBatch(StringMessageAggregator aggregator)
                                              throws AggregationException
Constructs the batch from a collection of messages stored in an aggregator.

Parameters:
aggregator - the aggregator containing the messages and that is supposed to construct the batch. The batch will look like this:
<message1><separator><message2><separator>...<separator> <messageN>[<separator>]
, where the last <separator> is present if and only if the appendAtTheEnd flag was set upon creating the aggregator.
Returns:
the batched message as a String.
Throws:
AggregationException - for aggregation problems.
See Also:
com.bea.alsb.financial.services.BatchService#getAggregatedStringMessageBatch( com.bea.alsb.financial.api.StringMessageAggregator)

parseStringBatch

public static XmlTextMessageWrappersDocument parseStringBatch(String messageBatch,
                                                              String separator)
Parses and splits a string batch into multiple messages. Extracted messages are wrapped into a XML document. For more details about the xml structure refers to the schemas provided with the facade Jar file.

Parameters:
messageBatch -
separator -
Returns:
See Also:
com.bea.alsb.financial.services.BatchService#parseStringBatch(java.lang.String, java.lang.String)