Package nexj.core.meta.integration.format.xml

Examples of nexj.core.meta.integration.format.xml.RootXMLMessagePartMapping


      {
         if (obj != null)
         {
            CompositeMessagePart composite = (CompositeMessagePart)part;
            TransferObject tobj = (TransferObject)obj;
            RootXMLMessagePartMapping rootMapping = null;
            MessagePart headersPart = null;
            boolean bEnvelopeStarted = false;

            // append the namespace and the schema
            if (parentPart == null)
            {
               rootMapping = (RootXMLMessagePartMapping)derivedMapping;
               headersPart = rootMapping.getHeaderPart();
               bEnvelopeStarted = appendEnvelopeStart(rootMapping, tobj);
               m_writer.setNamespace(sNamespace);
               m_writer.openElement(sNodeName);
               appendNamespaces(rootMapping, false, !bEnvelopeStarted && bAppendType);
               appendSchemaLocation(rootMapping);
            }
            else
            {
               m_writer.setNamespace(sNamespace);
               m_writer.openElement(sNodeName);

               // Top-level elements of the header need to declare the root
               // namespaces, because they are not under the root element.

               rootMapping = (RootXMLMessagePartMapping)parentPart.getRoot().getMapping();

               if (rootMapping.getHeaderPart() == parentPart)
               {
                  appendNamespaces(rootMapping, false, false);
               }
               else
               {
View Full Code Here


      {
         s_logger.debug("Parsing XML message \"" + message.getName() + "\"");
         s_logger.dump(in);
      }

      RootXMLMessagePartMapping mapping = (RootXMLMessagePartMapping)message.getRoot().getMapping();
      boolean bRestartable = (message.getDerivation() != Message.DERIVATION_FINAL && message.getDerivedMessageCount() > 0) || // is polymorphic?
         ((mapping.getEnvelope() & RootXMLMessagePartMapping.ENVELOPE_SOAP12) != 0)// SOAP 1.2 requires restartable parse (Fault headers)

      m_messageMap = null;
      m_headerPart = (bRestartable) ? null : mapping.getHeaderPart();

      return parse(in, message.getRoot(), bRestartable, mapping.getEnvelope(), mapping.getSchemaResourceMap());
   }
View Full Code Here

      byte nAcceptedEnvelopes = 0;

      for (Iterator itr = table.getMessageIterator(); itr.hasNext();)
      {
         Message message = (Message)itr.next();
         RootXMLMessagePartMapping mapping = (RootXMLMessagePartMapping)message.getRoot().getMapping();
         Message old = (Message)map.put((mapping.getNamespace() != null) ? mapping.getNamespace().getURI() : "",
            mapping.getNodeName(), message);

         if (old != null)
         {
            if (old.isUpcast(message) && old.getDerivation() != Message.DERIVATION_FINAL)
            {
               // Re-put old
               map.put((mapping.getNamespace() != null) ? mapping.getNamespace().getURI() : "",
                  mapping.getNodeName(), old);
            }
            else if (message.isUpcast(old) && message.getDerivation() != Message.DERIVATION_FINAL)
            {
               // base message "message" is already in table
            }
            else
            {
               throw new MetadataException("err.meta.integration.xml.dupMessageElement",
                  new Object[]{mapping.getNodeName(), old.getName(), message.getName()});
            }
         }

         nAcceptedEnvelopes |= mapping.getEnvelope();

         if (mapping.getSchemaResourceMap() != null || mapping.getHeaderPart() != null)
         {
            bRestartable = true;
         }
      }
View Full Code Here

                        CompositeMessagePartRef ref = (CompositeMessagePartRef)composite2;
                        CompositeMessagePart referencedPart = ref.getRefPart();

                        tobj.setClassName(referencedPart.getName());

                        RootXMLMessagePartMapping refRootMapping = (RootXMLMessagePartMapping)referencedPart.getMapping();
                        Message derivedMessage = getDerivedMessage(attributes, refRootMapping, part.getFullPath());

                        if (derivedMessage != null)
                        {
                           Message referencedMessage = refRootMapping.getRootMessage();

                           Message.validatePolymorphism(referencedMessage, derivedMessage, part);
                           tobj.setClassName(derivedMessage.getName());
                           part = derivedMessage.getRoot();
                           valuePart = ((XMLMessagePartMapping)part.getMapping()).getValuePart();
View Full Code Here

    * @return True if the document root is accepted; false if it is not accepted.
    */
   public boolean acceptRootElement(String sURI, String sLocalName, Attributes attributes, boolean bError)
   {
      MessagePart part = m_stack.getTopMessagePart();
      RootXMLMessagePartMapping rootMapping;

      if (part == null)
      {
         // Identify the XML message being parsed
         Message msg = (Message)m_messageMap.get(sURI, sLocalName);

         if (msg != null)
         {
            part = msg.getRoot();
         }

         if (part == null)
         {
            if (bError)
            {
               throw new IntegrationException("err.integration.xml.unsupportedMessage",
                  new Object[]{sURI, sLocalName});
            }

            return false;
         }

         rootMapping = (RootXMLMessagePartMapping)part.getMapping();
         assert m_stack.getSize() == 1;
         m_stack.setTopMessagePart(part);
         m_stack.setTopBaseMessagePart(part);

         if (s_logger.isDebugEnabled())
         {
            s_logger.debug("Identified the XML message as \"" + part.getName() + "\"");
         }

         ((TransferObject)m_stack.getTopObject()).setClassName(part.getName());
         m_headerPart = rootMapping.getHeaderPart();
         m_bRestart = (rootMapping.getSchemaResourceMap() != null) || (m_headerPart != null);
         m_baseRootPart = part;
      }
      else
      {
         // Verify root element of message being parsed
         rootMapping = (RootXMLMessagePartMapping)part.getMapping();

         if (!matches(m_baseRootPart, sURI, sLocalName))
         {
            if (bError)
            {
               throw new IntegrationException("err.integration.xml.invalidDocRoot",
                  new Object[]{sURI, sLocalName});
            }

            return false;
         }

         if (m_headerPart != rootMapping.getHeaderPart())
         {
            m_headerPart = rootMapping.getHeaderPart();
            m_bRestart = true;
         }
      }

      TransferObject tobj = (TransferObject)m_stack.getTopObject();

      if (!m_bRestart)
      {
         parseAttributes(tobj, (CompositeMessagePart)part, attributes);
      }

      Message derivedMessage = getDerivedMessage(attributes, rootMapping, part.getFullPath());
      Message primaryMessage = rootMapping.getRootMessage();

      tobj.setClassName(primaryMessage.getName());

      if (derivedMessage != null)
      {
         CompositeMessagePart derivedMessageRoot = derivedMessage.getRoot();
         RootXMLMessagePartMapping derivedMessageRootMapping = (RootXMLMessagePartMapping)derivedMessageRoot.getMapping();

         Message.validatePolymorphism(primaryMessage, derivedMessage, derivedMessageRoot);
         m_stack.setTopBaseMessagePart(part);
         part = derivedMessageRoot;
         m_stack.setTopMessagePart(part);
         tobj.setClassName(derivedMessage.getName());

         MessagePart headerPart = derivedMessageRootMapping.getHeaderPart();

         if (m_headerPart != headerPart)
         {
            m_headerPart = headerPart;
            m_bRestart = true;
View Full Code Here

      Lookup envelopeHeaderMap = new HashTab();

      converter.setEnvelopeHeaderMap(envelopeHeaderMap);

      Element element = converter.add(msg);
      RootXMLMessagePartMapping rootMapping = (RootXMLMessagePartMapping)msg.getRoot().getMapping();
      Operation operation = new Operation((rootMapping.getOperation() == null) ? msg.getName() : rootMapping.getOperation());
      Message input = service.findMessage(msg.getName());

      if (input == null)
      {
         input = new Message(msg.getName());
         input.setRoot(element);
         input.addHeaders(envelopeHeaderMap);
         service.addMessage(input);
      }

      operation.setInput(input);
      operation.setAction(rootMapping.getAction());

      if (msg.getResponse() != null)
      {
         msg = msg.getResponse();
         element = converter.add(msg);
View Full Code Here

    */
   public void prepare(TransferObject raw, TransferObject tobj, Message message) throws IntegrationException
   {
      if (message.getRoot().getMapping() instanceof RootXMLMessagePartMapping)
      {
         RootXMLMessagePartMapping mapping = (RootXMLMessagePartMapping)message.getRoot().getMapping();

         if (mapping.getEnvelope() != RootXMLMessagePartMapping.ENVELOPE_NONE)
         {
            TransferObject headers = (TransferObject)raw.findValue(HEADERS);

            if (headers == null)
            {
               headers = new TransferObject(2);
               raw.setValue(HEADERS, headers);
            }

            if (headers.findValue("content-type") == null)
            {
               switch (mapping.getEnvelope())
               {
                  case RootXMLMessagePartMapping.ENVELOPE_SOAP:
                     headers.setValue("content-type", "text/xml; charset=UTF-8");
                     break;

                  case RootXMLMessagePartMapping.ENVELOPE_SOAP12:
                     headers.setValue("content-type", "application/soap+xml; charset=UTF-8");
                     break;
               }
            }

            if (headers.findValue("soapaction") == null)
            {
               String sAction = (mapping.getAction() == null) ? "" : mapping.getAction();
               StringBuilder buf = new StringBuilder(sAction.length() + 2);
              
               buf.append('"');
               buf.append(sAction);
               buf.append('"');
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.format.xml.RootXMLMessagePartMapping

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.