Package org.jboss.ws.extensions.wsrm.protocol

Examples of org.jboss.ws.extensions.wsrm.protocol.RMConstants


               if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false)
               {
                  Map<String, Object> wsrmResCtx = (Map<String, Object>)msgContext.get(RMConstant.RESPONSE_CONTEXT);
                  if (wsrmResCtx != null)
                  {
                     RMConstants wsrmConstants = RMProvider.get().getConstants();
                     Map<QName, RMSerializable> mapping = (Map<QName, RMSerializable>)wsrmResCtx.get(RMConstant.PROTOCOL_MESSAGES_MAPPING);
                     QName seq = wsrmConstants.getSequenceQName();
                     if (mapping.keySet().contains(seq))
                     {
                        RMHelper.handleSequenceHeader((RMSequence)mapping.get(seq), this.wsrmSequence);
                     }
                     QName seqAck = wsrmConstants.getSequenceAcknowledgementQName();
                     if (mapping.keySet().contains(seqAck))
                     {
                        RMHelper.handleSequenceAcknowledgementHeader((RMSequenceAcknowledgement)mapping.get(seqAck), this.wsrmSequence);
                     }
                     QName ackReq = wsrmConstants.getAckRequestedQName();
                     if (mapping.keySet().contains(ackReq))
                     {
                        RMHelper.handleAckRequestedHeader((RMAckRequested)mapping.get(ackReq), this.wsrmSequence);
                     }
                  }
View Full Code Here


   {
      RMCreateSequence o = (RMCreateSequence)object;
      try
      {
         SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:CreateSequence element
         QName createSequenceQName = wsrmConstants.getCreateSequenceQName();
         SOAPElement createSequenceElement = getRequiredElement(soapBody, createSequenceQName, "soap body");

         // read required wsrm:AcksTo element
         QName acksToQName = wsrmConstants.getAcksToQName();
         SOAPElement acksToElement = getRequiredElement(createSequenceElement, acksToQName, createSequenceQName);
         QName addressQName = ADDRESSING_CONSTANTS.getAddressQName();
         SOAPElement acksToAddressElement = getRequiredElement(acksToElement, addressQName, acksToQName);
         String acksToAddress = getRequiredTextContent(acksToAddressElement, addressQName);
         o.setAcksTo(acksToAddress);

         // read optional wsrm:Expires element
         QName expiresQName = wsrmConstants.getExpiresQName();
         SOAPElement expiresElement = getOptionalElement(createSequenceElement, expiresQName, createSequenceQName);
         if (expiresElement != null)
         {
            String duration = getRequiredTextContent(expiresElement, expiresQName);
            o.setExpires(RMHelper.stringToDuration(duration));
         }

         // read optional wsrm:Offer element
         QName offerQName = wsrmConstants.getOfferQName();
         SOAPElement offerElement = getOptionalElement(createSequenceElement, offerQName, createSequenceQName);
         if (offerElement != null)
         {
            RMCreateSequence.RMOffer offer = o.newOffer();

            // read required wsrm:Identifier element
            QName identifierQName = wsrmConstants.getIdentifierQName();
            SOAPElement identifierElement = getRequiredElement(offerElement, identifierQName, offerQName);
            String identifier = getRequiredTextContent(identifierElement, identifierQName);
            offer.setIdentifier(identifier);
           
            // read optional wsrm:Endpoint element
            QName endpointQName = wsrmConstants.getEndpointQName();
            SOAPElement endpointElement = getOptionalElement(offerElement, endpointQName, offerQName);
            if (endpointElement != null)
            {
               SOAPElement endpointAddressElement = getRequiredElement(endpointElement, addressQName, endpointQName);
               String endpointAddress = getRequiredTextContent(endpointAddressElement, addressQName);
               offer.setEndpoint(endpointAddress);
            }
           
            // read optional wsrm:Expires element
            SOAPElement offerExpiresElement = getOptionalElement(offerElement, expiresQName, offerQName);
            if (offerExpiresElement != null)
            {
               String duration = getRequiredTextContent(offerExpiresElement, expiresQName);
               offer.setExpires(duration);
            }
           
            // read optional wsrm:IncompleteSequenceBehavior element
            QName behaviorQName = wsrmConstants.getIncompleteSequenceBehaviorQName();
            SOAPElement behaviorElement = getOptionalElement(offerElement, behaviorQName, offerQName);
            if (behaviorElement != null)
            {
               String behaviorString = getRequiredTextContent(behaviorElement, behaviorQName);
               offer.setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior.getValue(behaviorString));
View Full Code Here

   {
      RMCreateSequence o = (RMCreateSequence)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:CreateSequence element
         QName createSequenceQName = wsrmConstants.getCreateSequenceQName();
         SOAPElement createSequenceElement = soapEnvelope.getBody().addChildElement(createSequenceQName);
        
         // write required wsrm:AcksTo element
         QName acksToQName = wsrmConstants.getAcksToQName();
         QName addressQName = ADDRESSING_CONSTANTS.getAddressQName();
         createSequenceElement.addChildElement(acksToQName)
            .addChildElement(addressQName)
               .setValue(o.getAcksTo());
        
         if (o.getExpires() != null)
         {
            // write optional wsrm:Expires element
            QName expiresQName = wsrmConstants.getExpiresQName();
            createSequenceElement.addChildElement(expiresQName).setValue(RMHelper.durationToString(o.getExpires()));
         }
        
         if (o.getOffer() != null)
         {
            RMCreateSequence.RMOffer offer = o.getOffer();
           
            // write optional wsrm:Offer element
            QName offerQName = wsrmConstants.getOfferQName();
            SOAPElement offerElement = createSequenceElement.addChildElement(offerQName);

            // write required wsrm:Identifier element
            QName identifierQName = wsrmConstants.getIdentifierQName();
            offerElement.addChildElement(identifierQName).setValue(offer.getIdentifier());
           
            if (offer.getEndpoint() != null)
            {
               // write optional wsrm:Endpoint element
               QName endpointQName = wsrmConstants.getEndpointQName();
               offerElement.addChildElement(endpointQName)
                  .addChildElement(addressQName)
                     .setValue(offer.getEndpoint());
            }
           
            if (offer.getExpires() != null)
            {
               // write optional wsrm:Expires element
               QName expiresQName = wsrmConstants.getExpiresQName();
               offerElement.addChildElement(expiresQName).setValue(offer.getExpires());
            }
           
            if (offer.getIncompleteSequenceBehavior() != null)
            {
               // write optional wsrm:IncompleteSequenceBehavior element
               RMIncompleteSequenceBehavior behavior = offer.getIncompleteSequenceBehavior();
               QName behaviorQName = wsrmConstants.getIncompleteSequenceBehaviorQName();
               SOAPElement behaviorElement = offerElement.addChildElement(behaviorQName);
               behaviorElement.setValue(behavior.toString());
            }
         }
      }
View Full Code Here

   {
      RMSequence o = (RMSequence)object;
      try
      {
         SOAPHeader soapHeader = soapMessage.getSOAPPart().getEnvelope().getHeader();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:Sequence element
         QName sequenceQName = wsrmConstants.getSequenceQName();
         SOAPElement sequenceElement = getRequiredElement(soapHeader, sequenceQName, "soap header");

         // read required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         SOAPElement identifierElement = getRequiredElement(sequenceElement, identifierQName, sequenceQName);
         String identifier = getRequiredTextContent(identifierElement, identifierQName);
         o.setIdentifier(identifier);
        
         // read required wsrm:MessageNumber element
         QName messageNumberQName = wsrmConstants.getMessageNumberQName();
         SOAPElement messageNumberElement = getRequiredElement(sequenceElement, messageNumberQName, sequenceQName);
         String messageNumberString = getRequiredTextContent(messageNumberElement, messageNumberQName);
         long messageNumberValue = stringToLong(messageNumberString, "Unable to parse MessageNumber element text content");
         o.setMessageNumber(messageNumberValue);
        
         // read optional wsrm:LastMessage element
         QName lastMessageQName = wsrmConstants.getLastMessageQName();
         SOAPElement lastMessageElement = getOptionalElement(sequenceElement, lastMessageQName, sequenceQName);
         if (lastMessageElement != null)
         {
            o.setLastMessage();
         }
View Full Code Here

   {
      RMSequence o = (RMSequence)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:Sequence element
         QName sequenceQName = wsrmConstants.getSequenceQName();
         SOAPElement sequenceElement = soapEnvelope.getHeader().addChildElement(sequenceQName);

         // write required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         sequenceElement.addChildElement(identifierQName).setValue(o.getIdentifier());
        
         // write required wsrm:MessageNumber element
         QName messageNumberQName = wsrmConstants.getMessageNumberQName();
         SOAPElement messageNumberElement = sequenceElement.addChildElement(messageNumberQName);
         messageNumberElement.setValue(String.valueOf(o.getMessageNumber()));
        
         if (o.isLastMessage())
         {
            // write optional wsrm:LastMessage element
            QName lastMessageQName = wsrmConstants.getLastMessageQName();
            sequenceElement.addChildElement(lastMessageQName);
         }
      }
      catch (SOAPException se)
      {
View Full Code Here

   {
      RMAckRequested o = (RMAckRequested)object;
      try
      {
         SOAPHeader soapHeader = soapMessage.getSOAPPart().getEnvelope().getHeader();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:AckRequested element
         QName ackRequestedQName = wsrmConstants.getAckRequestedQName();
         SOAPElement ackRequestedElement = getRequiredElement(soapHeader, ackRequestedQName, "soap header");

         // read required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         SOAPElement identifierElement = getRequiredElement(ackRequestedElement, identifierQName, ackRequestedQName);
         String identifier = getRequiredTextContent(identifierElement, identifierQName);
         o.setIdentifier(identifier);
        
         // read optional wsrm:MessageNumber element
         QName messageNumberQName = wsrmConstants.getMessageNumberQName();
         SOAPElement messageNumberElement = getOptionalElement(ackRequestedElement, messageNumberQName, ackRequestedQName);
         if (messageNumberElement != null)
         {
            String messageNumberString = getRequiredTextContent(messageNumberElement, messageNumberQName);
            long messageNumberValue = stringToLong(messageNumberString, "Unable to parse MessageNumber element text content");
View Full Code Here

   {
      RMAckRequested o = (RMAckRequested)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:AckRequested element
         QName ackRequestedQName = wsrmConstants.getAckRequestedQName();
         SOAPElement ackRequestedElement = soapEnvelope.getHeader().addChildElement(ackRequestedQName);

         // write required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         ackRequestedElement.addChildElement(identifierQName).setValue(o.getIdentifier());
        
         if (o.getMessageNumber() != 0)
         {
            // write optional wsrm:MessageNumber element
            QName messageNumberQName = wsrmConstants.getMessageNumberQName();
            SOAPElement messageNumberElement = ackRequestedElement.addChildElement(messageNumberQName);
            messageNumberElement.setValue(String.valueOf(o.getMessageNumber()));
         }
      }
      catch (SOAPException se)
View Full Code Here

   {
      RMTerminateSequence o = (RMTerminateSequence)object;
      try
      {
         SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:TerminateSequence element
         QName terminateSequenceQName = wsrmConstants.getTerminateSequenceQName();
         SOAPElement terminateSequenceElement = getRequiredElement(soapBody, terminateSequenceQName, "soap body");

         // read required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         SOAPElement identifierElement = getRequiredElement(terminateSequenceElement, identifierQName, terminateSequenceQName);
         String identifier = getRequiredTextContent(identifierElement, identifierQName);
         o.setIdentifier(identifier);
        
         // read optional wsrm:LastMsgNumber element
         QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName();
         SOAPElement lastMsgNumberElement = getOptionalElement(terminateSequenceElement, lastMsgNumberQName, terminateSequenceQName);
         if (lastMsgNumberElement != null)
         {
            String lastMsgNumberString = getRequiredTextContent(lastMsgNumberElement, lastMsgNumberQName);
            long lastMsgNumberValue = stringToLong(lastMsgNumberString, "Unable to parse LastMsgNumber element text content");
View Full Code Here

   {
      RMTerminateSequence o = (RMTerminateSequence)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:TerminateSequence element
         QName terminateSequenceQName = wsrmConstants.getTerminateSequenceQName();
         SOAPElement terminateSequenceElement = soapEnvelope.getBody().addChildElement(terminateSequenceQName);

         // write required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         terminateSequenceElement.addChildElement(identifierQName).setValue(o.getIdentifier());
        
         if (o.getLastMsgNumber() != 0)
         {
            // write optional wsrm:LastMsgNumber element
            QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName();
            SOAPElement lastMsgNumberElement = terminateSequenceElement.addChildElement(lastMsgNumberQName);
            lastMsgNumberElement.setValue(String.valueOf(o.getLastMsgNumber()));
         }
      }
      catch (SOAPException se)
View Full Code Here

         if (false == isSoap11)
         {
            throw new NotImplementedException("TODO: implement SOAP 12 serialization");
         }
        
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:SequenceFault element
         QName sequenceFaultQName = wsrmConstants.getSequenceFaultQName();
         SOAPElement sequenceFaultElement = soapEnvelope.getHeader().addChildElement(sequenceFaultQName);

         // write required wsrm:FaultCode element
         RMFault rmFault = (RMFault)o.getDetail();
         QName faultCodeQName = wsrmConstants.getFaultCodeQName();
         String subcode = wsrmConstants.getPrefix() + ":" + rmFault.getFaultCode().getSubcode().getValue();
         sequenceFaultElement.addChildElement(faultCodeQName).setValue(subcode);

         Map<String, Object> details = rmFault.getDetails()
         if (details.size() > 0)
         {
            for (Iterator<String> i = details.keySet().iterator(); i.hasNext(); )
            {
               // write optional wsrm:Detail elements
               QName detailQName = wsrmConstants.getDetailQName();
               SOAPElement detailElement = sequenceFaultElement.addChildElement(detailQName);

               String key = i.next();
               if (RMFaultConstant.IDENTIFIER.equals(key))
               {
                  // write optional wsrm:Identifier element
                  String sequenceId = (String)details.get(key);
                  QName identifierQName = wsrmConstants.getIdentifierQName();
                  detailElement.addChildElement(identifierQName).setValue(sequenceId);
               }
               else if (RMFaultConstant.ACKNOWLEDGEMENT.equals(key))
               {
                  // write optional wsrm:AcknowledgementRange element
                  RMSequenceAcknowledgement.RMAcknowledgementRange ackRange = (RMSequenceAcknowledgement.RMAcknowledgementRange)details.get(key);
                  QName acknowledgementRangeQName = wsrmConstants.getAcknowledgementRangeQName();
                  QName upperQName = wsrmConstants.getUpperQName();
                  QName lowerQName = wsrmConstants.getLowerQName();

                  SOAPElement acknowledgementRangeElement = detailElement.addChildElement(acknowledgementRangeQName);
                  // write required wsrm:Lower attribute
                  acknowledgementRangeElement.addAttribute(lowerQName, String.valueOf(ackRange.getLower()));
                  // write required wsrm:Upper attribute
                  acknowledgementRangeElement.addAttribute(upperQName, String.valueOf(ackRange.getUpper()));
               }
               else if (RMFaultConstant.MAX_MESSAGE_NUMBER.equals(key))
               {
                  // write optional wsrm:MaxMessageNumber element
                  Long maxMessageNumber = (Long)details.get(key);
                  QName maxMessageNumberQName = wsrmConstants.getMaxMessageNumberQName();
                  detailElement.addChildElement(maxMessageNumberQName).setValue(maxMessageNumber.toString());
               }
               else throw new IllegalArgumentException("Can't serialize detail with key " + key);
            }
         }
View Full Code Here

TOP

Related Classes of org.jboss.ws.extensions.wsrm.protocol.RMConstants

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.