Package nexj.core.integration

Examples of nexj.core.integration.IntegrationException


         }
         else
         {
            if (fieldPart.isRequired())
            {
               throw new IntegrationException("err.integration.minPartCount",
                  new Object[]{fieldPart.getFullPath()});
            }
         }

         nOffset += fieldMapping.getWidth();
View Full Code Here


         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;
         }
      }
      else
      {
         if (primaryMessage.getDerivation() == Message.DERIVATION_ABSTRACT)
         {
            throw new IntegrationException("err.integration.abstractMessage",
               new Object[]{primaryMessage.getName(), part.getFullPath()});
         }
      }

      m_bProcessRoot = false;
View Full Code Here

                  {
                     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)
            {
               throw new IntegrationException("err.integration.missingPart",
                  new Object[]{composite.getFullPath()});
            }
         }

         if (!m_bNilElement || tobj.getValueCount() > 0)
View Full Code Here

            {
               if (((CompositeMessagePart)parentPart).getAggregation() != CompositeMessagePart.SEQUENTIAL)
               {
                  if (tobj.hasValue(sChildPartName))
                  {
                     throw new IntegrationException("err.integration.maxPartCount", new Object[]{childPart.getFullPath()});
                  }
               }

               tobj.setValue(sChildPartName, result);
               m_stack.setTopIndex(m_stack.getTopIndex() + 1);
View Full Code Here

      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()});
            }
         }
      }

View Full Code Here

         {
            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)
View Full Code Here

            nCount = 1;
         }

         if (nCount < part.getMinCount())
         {
            throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
         }

         if (nCount > part.getMaxCount())
         {
            throw new IntegrationException("err.integration.maxPartCount", new Object[]{part.getFullPath()});
         }
      }
   }
View Full Code Here

               {
                  value = SOAPUtil.parseDateTime(sValue, true, false, m_context.getTimeZone());
               }
               catch (Exception e)
               {
                  throw new IntegrationException("err.integration.xml.dateTime",
                     new Object[]{sValue, part.getFullPath()}, e);
               }

               break;

            case XMLMessagePartMapping.SUBTYPE_TIME:
               try
               {
                  value = SOAPUtil.parseDateTime(sValue, false, true, m_context.getTimeZone());
               }
               catch (Exception e)
               {
                  throw new IntegrationException("err.integration.xml.dateTime",
                     new Object[]{sValue, part.getFullPath()}, e);
               }

               break;

            case XMLMessagePartMapping.SUBTYPE_DATETIME:
               try
               {
                  value = SOAPUtil.parseDateTime(sValue, true, true, m_context.getTimeZone());
               }
               catch (Exception e)
               {
                  throw new IntegrationException("err.integration.xml.dateTime",
                     new Object[]{sValue, part.getFullPath()}, e);
               }

               break;

            case XMLMessagePartMapping.SUBTYPE_BASE64:
               try
               {
                  value = Binary.fromBase64(sValue);
               }
               catch (Exception e)
               {
                  throw new IntegrationException("err.integration.xml.base64",
                     new Object[]{sValue, part.getFullPath()}, e);
               }

               break;
View Full Code Here

         String sURI = getURILocalPart(sType);
         Message derivedMessage = mapping.getXSDTypeMessage(sURI, m_sLocalName);

         if (sLocation != null && derivedMessage == null)
         {
            throw new IntegrationException("err.integration.xml.unknownType",
               new Object[]{sType, sLocation});
         }

         return derivedMessage;
      }
View Full Code Here

         listResult = parseRecords(recordMapping);
      }
      catch (IOException innerEx)
      {
         throw new IntegrationException("err.integration.parseRecord",
            new Object[]{msg.getName(), Primitive.createInteger(m_nCurrentRecord)}, innerEx);
      }

      result = new TransferObject(msg.getName(), 1);
      result.setValue(recordPart.getName(), listResult);
View Full Code Here

TOP

Related Classes of nexj.core.integration.IntegrationException

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.