FileDocCategorySizeDatePackage
InboundSequence.javaAPI DocExample7577Tue May 29 16:56:42 BST 2007com.sun.xml.ws.rm.jaxws.runtime

InboundSequence

public abstract class InboundSequence extends com.sun.xml.ws.rm.Sequence
An InboundSequence represents a sequence of incoming messages. For an RMDestination, an InboundSequnce consists of all the requests to a service from a particular proxy. For an RMSource, an InboundSequence contains all the response messages to requests in the companion OutboundSequence.

Fields Summary
protected SequenceConfig
config
Configuration for this sequence.
protected URI
acksTo
AcksTo URI. Assigned by ctor.
protected OutboundSequence
outboundSequence
Companion OutboundSequence
private String
strId
The SecurityTokenReference obtained from the CreateSequence
Constructors Summary
public InboundSequence()

public InboundSequence(URI acksTo, SequenceConfig config)

        
        this.acksTo = acksTo;
        this.config = config;
        this.rmConstants = config.getRMConstants();
    
Methods Summary
public synchronized com.sun.xml.ws.rm.protocol.SequenceAcknowledgementElementgenerateSequenceAcknowledgement(com.sun.xml.ws.rm.protocol.AckRequestedElement reqElement, javax.xml.bind.Marshaller marshaller)
Construct a SequenceAcknowlegementElement based on the contents of this sequence.

param
reqElement The AckRequestedElement to process. May be null. It is only used to determine its (optional) LastMessage element. If missing, LastMessage is assumed to be nextIndex - 1. marshaller The marshaller to be used for construction of the return value. TODO - decide whether this needs to be synchronized. It does not need to be if concurrent modifications only cause messages that have indeed arrived to be unacknowledged

        
        
        SequenceAcknowledgementElement ackElement= 
                new SequenceAcknowledgementElement();
       
 	Identifier id = new Identifier();
        id.setValue(getId());
        ackElement.setIdentifier(id);
        
        
        if (config != null && config.flowControl) {
            ackElement.setBufferRemaining(maxMessages - storedMessages);
        }
        
        int maxMessageNumber = 0;
        
        if (reqElement != null) {
            maxMessageNumber = (int)(reqElement.getMaxMessageNumber());
        }
        
        //if max message number element is not present, use the last
        //index we know of. 
        if (maxMessageNumber == 0) {
            maxMessageNumber = nextIndex - 1;
        }
        
        int lower = 1;
        int current = 1;
        boolean gap = (get(current) == null);
       	
        while (current <= maxMessageNumber) {
            if (gap) {
                if (get(current) != null) {
                    lower = current;
                    gap = false;
                }
            } else {
                if (get(current) == null) {
                    ackElement.addAckRange(lower, current - 1);
                    gap = true;
                }
            }
            current++;
        }
        
        if (!gap) {
            ackElement.addAckRange(lower, current - 1);
        }
        
        return ackElement;
    
public OutboundSequencegetOutboundSequence()
Accessor for the companion OutboundSequence

return
The OutboundSequence.

        return outboundSequence;
        
    
public SequenceConfiggetSequenceConfig()

        return config;
    
public java.lang.StringgetSessionId()

        return strId != null ? strId : getId();
    
public java.lang.StringgetStrId()

        return strId;
    
public synchronized voidhandleAckRequested(com.sun.xml.ws.rm.protocol.AckRequestedElement reqElement, javax.xml.bind.Marshaller marshaller)
Queue up a SequenceAcknowledgement element on companion OutboundSequence for delivery on next outbound application message. TODO Currently only works for replyTo = AcksTo scenarios. Expand functionality to allow AcksTo to different destination.

param
reqElement The AckRequestedElement to process. marshaller The marshaller to be used for construction of the return value.

        
        SequenceAcknowledgementElement ackElement = 
                generateSequenceAcknowledgement(reqElement,
                                                marshaller);
        outboundSequence.setSequenceAcknowledgement(ackElement);
    
public voidsetStrId(java.lang.String strId)

        this.strId = strId;