Examples of MessagePart


Examples of nexj.core.meta.integration.MessagePart

      if (anyPart.getType() == Primitive.ANY)
      {
         Interface iface = ((XMLMessagePartMapping)anyPart.getMapping()).getInterface();
         XMLMessageParserTable table = (XMLMessageParserTable)iface.getRequestTable().getParserTable();
         Message msg = (Message)table.getMessageMap().get(sURI, sLocalName);
         MessagePart part = null;

         if (msg == null)
         {
            table = (XMLMessageParserTable)iface.getResponseTable().getParserTable();
            msg = (Message)table.getMessageMap().get(sURI, sLocalName);
         }

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

         if (part == null)
         {
            return false;
         }

         Message derivedMessage = getDerivedMessage(attributes, (RootXMLMessagePartMapping)part.getMapping(), null);
         MessagePart basePart = part;

         if (derivedMessage != null)
         {
            if (s_logger.isDebugEnabled())
            {
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

   /**
    * @see nexj.core.integration.format.xml.ParseEventAcceptor#acceptEndElement(java.lang.String, java.lang.String, java.lang.String)
    */
   public boolean acceptEndElement(String sURI, String sLocalName, String sQualName) throws SAXException
   {
      MessagePart part = m_stack.getTopMessagePart();
      MessagePart basePart = m_stack.getTopBaseMessagePart();
      Object obj;

      assert basePart == null || basePart.getName() != null;

      if (part instanceof PrimitiveMessagePart)
      {
         PrimitiveMessagePart primitivePart = (PrimitiveMessagePart)part;

         if (primitivePart.getType() == Primitive.ANY)
         {
            if ((obj = getAnyTypeValue()) == null)
            {
               // An element-mapped part with an interface
               obj = m_stack.getTopObject();
            }
         }
         else
         {
            String sValue;

            if (m_bNilElement)
            {
               sValue = null;
            }
            else
            {
               obj = m_stack.getTopObject();
               sValue = (obj == null) ? null : obj.toString();
            }

            obj = convert(primitivePart, sValue);
         }
      }
      else if (part == LAX_PART)
      {
         obj = Undefined.VALUE;
      }
      else
      {
         CompositeMessagePart composite = (CompositeMessagePart)part;
         TransferObject tobj = (TransferObject)m_stack.getTopObject();
         int nPartCount = composite.getPartCount();
         boolean bMatch = false;
         boolean bRequired = false;

         if (tobj != null)
         {
            for (int nIndex = 0; nIndex < nPartCount; ++nIndex)
            {
               MessagePart child = composite.getPart(nIndex);
               int nNodeType = ((XMLMessagePartMapping)child.getMapping()).getNodeType();

               if (!m_bNilElement && nNodeType == XMLMessagePartMapping.ELEMENT// ignore counts for nil elements
               {
                  if (composite.getAggregation() == CompositeMessagePart.SINGLE)
                  {
                     if (tobj.hasValue(child.getName()))
                     {
                        if (bMatch)
                        {
                           throw new IntegrationException("err.integration.multipleParts",
                              new Object[]{composite.getFullPath()});
                        }

                        validatePartCount(child);
                        bMatch = true;
                     }

                     bRequired |= child.isRequired();
                  }
                  else
                  {
                     validatePartCount(child);
                  }
               }
               else if (nNodeType == XMLMessagePartMapping.VALUE)
               {
                  Object value = null;

                  if ((value = getAnyTypeValue()) != null)
                  {
                     // Value-mapped part for literal XML will have just one element when collection
                     if (child.isCollection())
                     {
                        ArrayList list = new ArrayList(1);

                        list.add(value);
                        value = list;
                     }
                  }
                  else
                  {
                     value = m_stack.getTopValue();

                     if (value instanceof StringBuilder)
                     {
                        value = value.toString();
                     }

                     if (value instanceof String)
                     {
                        value = convert((PrimitiveMessagePart)child, (String)value);
                     }
                  }

                  tobj.setValue(child.getName(), value);
                  validatePartCount(child);
               }
            }

            if (bRequired && !bMatch)
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      m_stack.pop();

      if (!m_stack.isEmpty() && result != Undefined.VALUE)
      {
         TransferObject tobj = (TransferObject)m_stack.getTopObject();
         MessagePart parentPart = m_stack.getTopMessagePart();

         /* If parent is a referenced message part: should use mapping from referrer,
          * but value part must be taken from referenced message part mapping.
          */
         PrimitiveMessagePart valuePart = ((XMLMessagePartMapping)parentPart.getMapping()).getValuePart();

         if (valuePart != null && childPart.getParent() == null)
         {
            // Handle type=any, value-mapped, with interface.
            //
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      if (m_stack.isEmpty())
      {
         return false;
      }

      MessagePart part = m_stack.getTopMessagePart();

      if (m_bNilElement)
      {
         throw new IntegrationException("err.integration.xml.nilElementNotEmpty",
            new Object[] {part.getFullPath()});
      }

      // Do not process contents of a lax part.
      if (part == LAX_PART)
      {
         return true;
      }

      /*
       * Process character data if the part type is not "any". Otherwise, reject the data.
       * e.g. Reject this: <anyTypePartWithInterface>A<x>...</x>B</anyTypePartWithInterface> (because of A and B)
       */
      boolean bVerifyWhitespace = false;

      if (part instanceof CompositeMessagePart)
      {
         PrimitiveMessagePart valuePart = ((XMLMessagePartMapping)part.getMapping()).getValuePart();

         if (valuePart == null || valuePart.getType() == Primitive.ANY)
         {
            if (!((CompositeMessagePart)part).isLax())
            {
               bVerifyWhitespace = true;
            }
         }
         else
         {
            m_stack.setTopValue(concat(m_stack.getTopValue(), cbuf, nOffset, nLength));
         }
      }
      else
      {
         if (((PrimitiveMessagePart)part).getType() == Primitive.ANY)
         {
            bVerifyWhitespace = true;
         }
         else
         {
            m_stack.setTopObject(concat(m_stack.getTopObject(), cbuf, nOffset, nLength));
         }
      }

      if (bVerifyWhitespace)
      {
         while (nLength-- != 0)
         {
            if (!Character.isWhitespace(cbuf[nOffset++]))
            {
               throw new IntegrationException("err.integration.xml.misplacedCharacterData",
                  new Object[]{part.getFullPath()});
            }
         }
      }

      return true;
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

   {
      int nPartCount = composite.getPartCount();

      for (int i = 0; i < nPartCount; ++i)
      {
         MessagePart part = composite.getPart(i);
         XMLMessagePartMapping mapping = (XMLMessagePartMapping)part.getMapping();

         if (mapping.getNodeType() == XMLMessagePartMapping.ATTRIBUTE)
         {
            String sValue = attributes.getValue((mapping.getNamespace() != null) ? mapping.getNamespace().getURI() : "", mapping.getNodeName());

            if (part.isRequired() && StringUtil.isEmpty(sValue))
            {
               throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
            }

            if (sValue != null)
            {
               if (sValue.length() == 0)
               {
                  tobj.setValue(part.getName(), null);
               }
               else
               {
                  tobj.setValue(part.getName(), convert((PrimitiveMessagePart)part, sValue));
               }
            }
         }
      }
   }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      CompositeMessagePart composite = (CompositeMessagePart)part;
      Pair attributes = null;

      for (int i = composite.getPartCount() - 1; i >= 0; --i)
      {
         MessagePart childPart = composite.getPart(i);
         ObjectMessagePartMapping childMapping = (ObjectMessagePartMapping)childPart.getMapping();
         Object childAttributes = childMapping.getAttributes(childPart, currPathSet, message);

         if (childAttributes != null)
         {
            attributes = new Pair(childAttributes, attributes);
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

    */
   protected void buildDependentMsgPartsMap(CompositeMessagePart composite, Set currPathSet)
   {
      for (int i = 0, n = composite.getPartCount(); i != n; ++i)
      {
         MessagePart msgPart = composite.getPart(i);

         if (msgPart instanceof CompositeMessagePart)
         {
            CompositeMessagePart part = (CompositeMessagePart)msgPart;
            ObjectMessagePartMapping partMapping = (ObjectMessagePartMapping)part.getMapping();
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      {
         if (mapping.m_systemPartArray != null)
         {
            for (int i = 0; i < SYSTEM_ATTRIBUTES.length; ++i)
            {
               MessagePart part = mapping.getSystemPart(i);

               if (part != null)
               {
                  setSystemPart(part);
               }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

   /**
    * @see nexj.core.meta.integration.MessagePartMapping#finish(nexj.core.meta.integration.MessagePart)
    */
   public void finish(MessagePart part)
   {
      MessagePart parent = part.getParent();

      if (m_attribute != null)
      {
         if (m_attribute.isStatic())
         {
            throw new MetadataException("err.meta.integration.object.mapping.staticAttribute",
               new Object[]{part.getFullPath()});
         }

         if ((part instanceof PrimitiveMessagePart) != m_attribute.getType().isPrimitive())
         {
            throw new MetadataException("err.meta.integration.object.mapping.attributeTypeMismatch",
               new Object[]{part.getFullPath()});
         }

         if (m_bLocal && part instanceof CompositeMessagePart && m_attribute.getReverse() == null)
         {
            throw new MetadataException("err.meta.integration.object.mapping.missingLocalReverseAssoc",
               new Object[]{m_attribute.getName(), part.getFullPath()});
         }
      }

      if (m_metaclass != null)
      {
         if (part instanceof PrimitiveMessagePart)
         {
            throw new MetadataException("err.meta.integration.object.mapping.misplacedClass");
         }
        
         if (m_attribute != null && !((Metaclass)m_attribute.getType()).isUpcast(m_metaclass))
         {
            throw new MetadataException("err.meta.integration.object.mapping.classTypeMismatch",
               new Object[]{m_metaclass.getName()});
         }
      }
      else
      {
         if (parent == null)
         {
            if (m_message.getDerivation() != Message.DERIVATION_ABSTRACT)
            {
               throw new MetadataException("err.meta.integration.object.mapping.missingClass");
            }
         }
        
         if (m_attribute != null && !m_attribute.getType().isPrimitive())
         {
            m_metaclass = (Metaclass)m_attribute.getType();
         }
      }

      if (part instanceof PrimitiveMessagePart)
      {
         if (part.isCollection())
         {
            throw new MetadataException("err.meta.integration.object.mapping.primitiveCollection");
         }

         if (m_where != Boolean.TRUE)
         {
            throw new MetadataException("err.meta.integration.object.mapping.primitivePartWhere",
               new Object[]{part.getFullPath()});
         }
      }

      if (parent == null)
      {
         m_bLocal = false;
      }
      else
      {
         ObjectMessagePartMapping mapping = (ObjectMessagePartMapping)parent.getMapping();

         if (mapping != null)
         {
            mapping.setSystemPart(part);
         }
      }

      if (m_bSubKey)
      {
         ObjectMessagePartMapping mapping = (parent == null) ? null : (ObjectMessagePartMapping)parent.getMapping();

         if (mapping != null)
         {
            mapping.m_bSubKeyParent = true;
         }
      }

      if (m_accessAttribute != null && m_accessAttribute.getType() != Primitive.BOOLEAN)
      {
         throw new MetadataException("err.meta.integration.object.mapping.accessAttributeType",
            new Object[]{m_accessAttribute.getName()});
      }

      if (parent == null && m_metaclass != null &&
         (m_message.getBaseMessage() != null || m_message.getDerivedMessageCount() > 0))
      {
         addClassMessage(m_metaclass, m_message);
      }

      if (part instanceof CompositeMessagePartInstance)
      {
         CompositeMessagePart composite = (CompositeMessagePartInstance)part;

         for (int i = 0, nCount = composite.getPartCount(); i < nCount; i++)
         {
            MessagePart child = composite.getPart(i);
            MessagePartMapping mapping = child.getMapping();

            if (mapping != null)
            {
               mapping.finish(child);
            }
         }
      }

      if (part.equals(part.getRoot()) && part instanceof CompositeMessagePart)
      {
         CompositeMessagePart rootComposite = (CompositeMessagePart)part;
         ObjectMessagePartMapping rootMapping = (ObjectMessagePartMapping)rootComposite.getMapping();
         MessagePart syncKeyPart = rootMapping.getSystemPart(ATTR_SYNC_KEY);

         if (syncKeyPart != null)
         {
            for (int i = 0, nCount = rootComposite.getPartCount(); i < nCount; i++)
            {
               MessagePart childPart = rootComposite.getPart(i);

               if (syncKeyPart != childPart)
               {
                  ObjectMessagePartMapping childMapping = (ObjectMessagePartMapping)childPart.getMapping();

                  if (childMapping.isKey())
                  {
                     rootMapping.m_bAlternativeSyncKey = true;
                  }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

            addChildParts(parentPart, modelGroupParticles, childParticle, baseType, (XSModelGroup)term, aggregation);
            break;

         case XSConstants.ELEMENT_DECLARATION:
            final XSElementDeclaration chldElemDecl = (XSElementDeclaration)term;
            MessagePart childPart;
           
            if (m_bReuseRootMessages && isRootElementDeclaration(chldElemDecl))
            {
               String sName = generateDefaultMessageName(chldElemDecl.getName(),
                  new INameConflictChecker()
                  {
                     public boolean conflicts(String sName)
                     {
                        return parentPart.hasPart(sName);
                     }
                  });

               childPart = createRef(parentPart, chldElemDecl, sName);
            }
            else
            {
               childPart = createMessagePart(parentPart, chldElemDecl, null);
            }

            if (childPart == null)
            {
               break;
            }
           
            setMinMaxCount(modelGroupParticles, childPart, childParticle, chldElemDecl);
           
            if (!addPart(parentPart, childPart))
            {
               if (parentPart.getAggregation() == CompositeMessagePart.SEQUENTIAL)
               {
                  MessagePart lastPart = parentPart.getPart(parentPart.getPartCount() - 1);

                  if (lastPart.getName().equals(childPart.getName()))
                  {
                     if (lastPart.getMaxCount() != Integer.MAX_VALUE)
                     {
                        if (childPart.getMaxCount() == Integer.MAX_VALUE)
                        {
                           lastPart.setMaxCount(0);
                        }
                        else
                        {
                           lastPart.setMaxCount(lastPart.getMaxCount() + childPart.getMaxCount());
                        }
                     }

                     return;
                  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.