Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.Message


      if (sNamespaceURI == null)
      {
         sNamespaceURI = NO_NAMESPACE;
      }

      Message rootBaseMessage = m_message.getRootBaseMessage();
      RootXMLMessagePartMapping rsmMapping = (RootXMLMessagePartMapping)rootBaseMessage.getRoot().getMapping();

      return (Message)rsmMapping.m_xsdTypeMessageMap.get(sNamespaceURI, sXSDType);
   }
View Full Code Here


    */
   public void finish(MessagePart part)
   {
      verifyNotReadOnly();

      Message baseMessage = m_message.getBaseMessage();

      for (Iterator itr = m_namespaceMap.valueIterator(); itr.hasNext(); )
      {
         XMLNamespace namespace = (XMLNamespace)itr.next();

         // Resolve namespaces with no URI.
         if (namespace.getURI() == null)
         {
            String sName = namespace.getName();
            XMLNamespace uriNamespace = null;

            if (baseMessage != null)
            {
               uriNamespace = ((RootXMLMessagePartMapping)baseMessage.getRoot().getMapping()).findNamespace(
                     sName);
            }

            if (uriNamespace == null)
            {
               throw new MetadataException("err.meta.integration.xml.missingURI",
                  new Object[]{part.getFullPath()});
            }

            namespace.setURI(uriNamespace.getURI());
            namespace.setSchema(uriNamespace.getSchema());
         }

         if (namespace.getSchema() != null)
         {
            addNamespace(XMLNamespace.XSI_NAME, XMLNamespace.XSI, null, false);

            break;
         }
      }

      // Propagate namespaces from this mapping to the base recursively
      propagateNamespaces();

      super.finish(part);

      if (m_sXSDType != null)
      {
         String sURI = (m_namespace == null) ? null : m_namespace.getURI();

         addXSDTypeMessage(sURI, m_sXSDType, m_message);
      }

      if (baseMessage != null)
      {
         RootXMLMessagePartMapping baseRootMapping = (RootXMLMessagePartMapping)baseMessage.getRoot().getMapping();

         if (baseRootMapping.m_schemaResourceLookupDeque != null)
         {
            if (m_schemaResourceLookupDeque == null)
            {
View Full Code Here

    */
   public void resolveInheritance(MessagePartMapping baseMapping)
   {
      super.resolveInheritance(baseMapping);

      Message baseMessage = m_message.getBaseMessage();

      if (baseMessage != null)
      {
         RootXMLMessagePartMapping baseRootMapping = (RootXMLMessagePartMapping)baseMessage.getRoot().getMapping();

         for (Iterator itr = baseRootMapping.getNamespaceIterator(); itr.hasNext(); )
         {
            XMLNamespace namespace = (XMLNamespace)itr.next();

View Full Code Here

    * Propagate namespaces from this root mapping to root mappings of bases, referrers to bases, bases of
    * referrers and so on.
    */
   protected void propagateNamespaces()
   {
      Message baseMessage = m_message.getBaseMessage();

      if (baseMessage != null && baseMessage.getDerivation() != Message.DERIVATION_FINAL)
      {
         Set visitedSet = new IdentityHashHolder();

         visitedSet.add(this);
         ((RootXMLMessagePartMapping)baseMessage.getRoot().getMapping()).addNamespaces(m_namespaceMap,
               visitedSet);
      }
   }
View Full Code Here

         addNamespace(namespace.getName(), namespace.getURI(), namespace.getSchema(),
               namespace.isDeclaredByEnvelope());
      }

      Message baseMessage = m_message.getBaseMessage();

      if (baseMessage != null && baseMessage.getDerivation() != Message.DERIVATION_FINAL)
      {
         ((RootXMLMessagePartMapping)baseMessage.getRoot().getMapping()).addNamespaces(namespaceMap,
               visitedSet);
      }

      for (Iterator itr = m_message.getReferrerListIterator(); itr.hasNext(); )
      {
         Message message = (Message)itr.next();

         ((RootXMLMessagePartMapping)message.getRoot().getMapping()).addNamespaces(namespaceMap, visitedSet);
      }
   }
View Full Code Here

      // Add XSI namespace to referrer message if the reference is a polymorphic reference.
      if (part instanceof CompositeMessagePartRef)
      {
         CompositeMessagePartRef ref = (CompositeMessagePartRef)part;
         RootXMLMessagePartMapping referentMapping = (RootXMLMessagePartMapping)ref.getRefPart().getRoot().getMapping();
         Message referentMessage = referentMapping.getRootMessage();

         if (referentMessage.getDerivedMessageCount() > 0 && referentMessage.getDerivation() != Message.DERIVATION_FINAL)
         {
            ((RootXMLMessagePartMapping)part.getRoot().getMapping()).
               addNamespace(XMLNamespace.XSI_NAME, XMLNamespace.XSI, null, false);
         }
      }
View Full Code Here

    */
   protected void loadMessage(Element messageElement, String sName)
   {
      XMLMetadataHelper.verifyRootElement(messageElement, "Message");

      final Message message = new Message(sName);

      message.setMetadata(m_metadata);
      message.setResourceName(m_helper.getCurResourceName());

      String sFormat = XMLUtil.getStringAttr(messageElement, "format");

      if (sFormat != null)
      {
         message.setFormat(m_metadata.getFormat(sFormat));
      }

      final String sResponse = XMLUtil.getStringAttr(messageElement, "response");

      if (sResponse != null)
      {
         addPreInheritanceMessageFixup(new ContextFixup(getHelper())
         {
            public void fixup()
            {
               message.setResponse(m_metadata.getMessage(sResponse));
            }
         });
      }

      String sDerivation = XMLUtil.getStringAttr(messageElement, "derivation", "virtual");

      if (sDerivation.equals("virtual"))
      {
         message.setDerivation(Message.DERIVATION_VIRTUAL);
      }
      else if (sDerivation.equals("final"))
      {
         message.setDerivation(Message.DERIVATION_FINAL);
      }
      else if (sDerivation.equals("abstract"))
      {
         message.setDerivation(Message.DERIVATION_ABSTRACT);
      }
      else
      {
         throw new MetadataException("err.meta.integration.messageDerivation",
            new Object[] {sDerivation, message.getName()});
      }

      final String sBaseMessage = XMLUtil.getStringAttr(messageElement, "base");

      if (!loadMessageRef(null, message, messageElement, sName))
      {
         CompositeMessagePart compMsgPart = new CompositeMessagePartInstance(sName);

         message.setRoot(compMsgPart);
         loadCompositeMessagePart(messageElement, compMsgPart, message);
      }

      m_metadata.addMessage(message);

      if (sBaseMessage != null)
      {
         addPreInheritanceMessageFixup(new ContextFixup(m_helper)
         {
            public void fixup()
            {
               Message baseMessage = m_metadata.getMessage(sBaseMessage);

               message.setBaseMessage(baseMessage);
               baseMessage.addDerivedMessage(message);
            }
         });
      }
   }
View Full Code Here

   {
      MetadataCompoundValidationException comp = null;

      while (iterator.hasNext())
      {
         Message message = (Message)iterator.next();
         CompositeMessagePart root = message.getRoot();
         MessagePartMapping mapping = root.getMapping();

         if (mapping != null)
         {
            try
            {
               mapping.finish(root);
            }
            catch (UncheckedException ex)
            {
               if (comp == null)
               {
                  comp = new MetadataCompoundValidationException();
               }

               message.addException(comp, ex);
            }
         }
      }

      if (comp != null)
View Full Code Here

         s_logger.debug("Identifying and parsing an object message");
         s_logger.dump(in);
      }

      Object obj = in.getObject();
      Message message = null;
     
      if (obj instanceof Instance)
      {
         Metaclass metaclass = ((Instance)obj).getMetaclass();
         List messageList = (List)table.getParserTable();

         for (int i = 0, n = messageList.size(); i != n; ++i)
         {
            Message msg = (Message)messageList.get(i);

            if (((ObjectMessagePartMapping)msg.getRoot().getMapping()).getMetaclass().isUpcast(metaclass))
            {
               message = msg;

               break;
            }
View Full Code Here

      ArrayList messageList = new ArrayList(table.getMessageCount());

      for (int i = 0, n = table.getMessageCount(); i < n; i++)
      {
         boolean bFound = false;
         Message candidate = table.getMessage(i);

         for (int k = 0, m = messageList.size(); k < m && !bFound; k++)
         {
            Message msg = (Message)messageList.get(k);
            Metaclass candidateClass = ((ObjectMessagePartMapping)candidate.getRoot().getMapping()).getMetaclass();
            Metaclass msgClass = ((ObjectMessagePartMapping)msg.getRoot().getMapping()).getMetaclass();

            if (msgClass == candidateClass)
            {
               throw new IntegrationException("err.integration.object.ambiguousTable",
                  new Object[]{candidate.getName(), msg.getName()});
            }

            // Optimization: reduce table size when a base message is added
            if (msg.isUpcast(candidate) && msg.getDerivation() != Message.DERIVATION_FINAL)
            {
               bFound = true;
            }
            else if (candidate.isUpcast(msg) && candidate.getDerivation() != Message.DERIVATION_FINAL)
            {
               bFound = true;
               messageList.set(k, candidate);
            }
         }

         if (!bFound)
         {
            messageList.add(candidate);
         }
      }

      // Table should be sorted with derived messages first
      Collections.sort(messageList, new Comparator()
      {
         public int compare(Object obj1, Object obj2)
         {
            Message msg1 = (Message)obj1;
            Message msg2 = (Message)obj2;
            Metaclass claz1 = ((ObjectMessagePartMapping)msg1.getRoot().getMapping()).getMetaclass();
            Metaclass claz2 = ((ObjectMessagePartMapping)msg2.getRoot().getMapping()).getMetaclass();

            if (claz1 == claz2)
            {
               return 0;
            }
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.Message

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.