}
protected void handleOutbound(LogicalMessageContext context) throws SequenceFault {
LOG.entering(getClass().getName(), "handleOutbound");
AddressingPropertiesImpl maps =
ContextUtils.retrieveMAPs(context, false, true);
// ensure the appropriate version of WS-Addressing is used
maps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
String action = null;
if (maps != null && null != maps.getAction()) {
action = maps.getAction().getValue();
}
// nothing to do if this is a CreateSequence, TerminateSequence or
// SequenceInfo request
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Action: " + action);
}
boolean isApplicationMessage = true;
if (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)
|| RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action)
|| RMUtils.getRMConstants().getTerminateSequenceAction().equals(action)
|| RMUtils.getRMConstants().getLastMessageAction().equals(action)
|| RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)
|| RMUtils.getRMConstants().getSequenceInfoAction().equals(action)) {
isApplicationMessage = false;
}
RMPropertiesImpl rmpsOut = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, true);
if (null == rmpsOut) {
rmpsOut = new RMPropertiesImpl();
RMContextUtils.storeRMProperties(context, rmpsOut, true);
}
RMPropertiesImpl rmpsIn = null;
Identifier inSeqId = null;
BigInteger inMessageNumber = null;
if (isApplicationMessage) {
rmpsIn = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(context, false);
if (null != rmpsIn && null != rmpsIn.getSequence()) {
inSeqId = rmpsIn.getSequence().getIdentifier();
inMessageNumber = rmpsIn.getSequence().getMessageNumber();
}
LOG.fine("inbound sequence: " + (null == inSeqId ? "null" : inSeqId.getValue()));
// not for partial responses to oneway requests
if (!(isServerSide() && BindingContextUtils.isOnewayTransport(context))) {
if (!ContextUtils.isRequestor(context)) {
assert null != inSeqId;
}
// get the current sequence, requesting the creation of a new one if necessary
SourceSequence seq = getSequence(inSeqId, context, maps);
assert null != seq;
// increase message number and store a sequence type object in
// context
seq.nextMessageNumber(inSeqId, inMessageNumber);
rmpsOut.setSequence(seq);
// if this was the last message in the sequence, reset the
// current sequence so that a new one will be created next
// time the handler is invoked
if (seq.isLastMessage()) {
source.setCurrent(null);
}
}
}
// add Acknowledgements (to application messages or explicitly
// created Acknowledgement messages only)
if (isApplicationMessage
|| RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)) {
AttributedURI to = VersionTransformer.convert(maps.getTo());
assert null != to;
addAcknowledgements(rmpsOut, inSeqId, to);
}
// indicate to the binding that a response is expected from the transport although