FileDocCategorySizeDatePackage
ProtocolMessageReceiver.javaAPI DocExample6405Tue May 29 16:56:42 BST 2007com.sun.xml.ws.rm.jaxws.runtime.client

ProtocolMessageReceiver

public class ProtocolMessageReceiver extends Object
Handles the contents of responses to RM Protocol requests with non-anonymous AcksTo.

Fields Summary
public static final String
anonymous
private static String
acksTo
AcksTo URI used for non-anonymous responses... Currently one per process. Set using the start method. Defaults to anonymous. When start is called with non-anonymous argument, an HTTP listener is started to process the messages.
private static HashMap
knownIds
Map of messageId String / CreateSequenceElement pairs that have beeen passed to setCreateSequenceResponse.
Constructors Summary
private ProtocolMessageReceiver()
Everything is static

    
    
    
            
      
    
Methods Summary
public static java.lang.StringgetAcksTo()
Accessor for the AcksTo field.

        return acksTo;
    
public static com.sun.xml.ws.rm.protocol.CreateSequenceResponseElementgetCreateSequenceResponse(java.lang.String messageId)

        
        CreateSequenceResponseElement ret = null;
        synchronized (knownIds) {
            if (!knownIds.keySet().contains(messageId)) {
                knownIds.put(messageId, null);
            }
           
            
            while (null == (ret =  knownIds.get(messageId))) {
                try {
                    knownIds.wait();
                } catch (InterruptedException e){}
            }
        }
        return ret;
    
public static voidhandleAcknowledgement(com.sun.xml.ws.rm.protocol.SequenceAcknowledgementElement el)

       //probably no need for synchronization here.  The element was initialized at the 
       //endpoint using a sequenceid generated by the endpoint that made it back to
       //the client.  That means that getCreateSequenceResponse has returned long ago.
        String id = el.getId();
        ClientOutboundSequence seq = RMSource.getRMSource().getOutboundSequence(id);
        if (id == null) {
            throw new InvalidSequenceException(String.format(Constants.UNKNOWN_SEQUENCE_TEXT,id),id);
        }
        
        seq.handleAckResponse(el);
        
    
public static voidsetCreateSequenceResponse(java.lang.String messageId, com.sun.xml.ws.rm.protocol.CreateSequenceResponseElement csrElement)

        
        synchronized (knownIds) {
            knownIds.put(messageId, csrElement);
            knownIds.notifyAll();
        }
    
public static voidstart(java.lang.String newAcksTo)

 /*       
        if (!acksTo.equals(anonymous) && !newAcksTo.equals(acksTo)) {
            throw new UnsupportedOperationException("Cannot change non-anonymous acksTo");
        }
        
        if (acksTo.equals(anonymous)) {
            acksTo = newAcksTo;      
            //start our endpoint listening on the given URI
            BindingID binding = BindingID.parse(SOAPBinding.SOAP12HTTP_BINDING) ;
            endpoint = new EndpointImpl(binding, new DummyProvider());
            endpoint.publish(acksTo);

        }
*/
    
public static voidstop()

/*
        if (endpoint != null) {
            endpoint.stop();
        }
*/