Package nexj.core.integration

Examples of nexj.core.integration.IntegrationException


    */
   public TransferObject parse(Input in, MessageTable table) throws IntegrationException
   {
      if (!(table.getParserTable() instanceof Message))
      {
         throw new IntegrationException("err.integration.messageTableUninitialized");
      }

      return parse(in, (Message)table.getParserTable());
   }
View Full Code Here


      if (StringUtil.isEmpty(sField))
      {
         if (fieldPart.isRequired())
         {
            throw new IntegrationException("err.integration.parse.noDataForRequiredPart",
               new Object[]{fieldPart.getFullPath(), Primitive.createInteger(m_nCurrentRecord)});
         }
         else
         {
            return null// no data in field
View Full Code Here

    */
   public void initializeMessageTable(MessageTable table) throws IntegrationException
   {
      if (table.getMessageCount() > 1)
      {
         throw new IntegrationException("err.integration.fixed.onlyOneMessageAllowedInTable");
      }

      // only supporting one message, so stick it in the parser table
      table.setParserTable((table.getMessageCount() == 0) ? null : table.getMessage(0));
   }
View Full Code Here

         return tobj;
      }
      catch (Exception e)
      {
         throw new IntegrationException("err.integration.object.graph",
            new Object[]{message.getName()}, e);
      }
   }
View Full Code Here

         }
      }

      if (message == null)
      {
         throw new IntegrationException("err.integration.object.unsupportedMessage",
            new Object[]{(obj == null) ? "null" : (obj instanceof Instance) ?
               ((Instance)obj).getLazyMetaclass().getName() : obj.getClass().getName()});
      }

      if (s_logger.isDebugEnabled())
      {
         s_logger.debug("Identified the object message as \"" + message.getName() + "\"");
      }
     
      try
      {
         m_instanceMap = new HashTab();
         m_processedSet = new HashTab2D();
        
         TransferObject tobj = (TransferObject)transfer(in.getObject(), message.getRoot());

         GenericServer.auditResponse(m_instanceMap, m_context);

         if (s_logger.isDumpEnabled())
         {
            s_logger.dump("Parse result");
            s_logger.dump(tobj);
         }

         return tobj;
      }
      catch (Exception e)
      {
         throw new IntegrationException("err.integration.object.graph",
            new Object[]{message.getName()}, e);
      }
   }
View Full Code Here

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

      {
         if (obj == null)
         {
            if (msg.isRequired())
            {
               throw new IntegrationException("err.integration.minPartCount", new Object[]{msg.getFullPath()});
            }

            return new ArrayList(0);
         }
        
         List instanceList = (List)obj;
         int nCount = instanceList.size();
        
         if (nCount < msg.getMinCount())
         {
            throw new IntegrationException("err.integration.minPartCount", new Object[]{msg.getFullPath()});
         }
        
         if (nCount > msg.getMaxCount())
         {
            throw new IntegrationException("err.integration.maxPartCount", new Object[]{msg.getFullPath()});
         }
        
         List list = new ArrayList(instanceList.size());
        
         for (int i = 0; i < nCount; ++i)
View Full Code Here

         Message derivedMessage = findDerivedMessage(message, metaclass);

         if (derivedMessage == null)
         {
            throw new IntegrationException("err.integration.object.missingMapping",
               new Object[]{metaclass.getName(), message.getName(), msg.getFullPath()});
         }

         Message.validatePolymorphism(message, derivedMessage, msg);
         msg = derivedMessage.getRoot();
         message = derivedMessage;
         sMessageName = message.getName();
      }

      ObjectMessagePartMapping mapping = (ObjectMessagePartMapping)msg.getMapping();

      if (m_context.isSecure())
      {
         if (mapping.getAttribute() != null)
         {
            mapping.getAttribute().checkReadAccess(m_context.getPrivilegeSet());
         }
         else
         {
            mapping.getMetaclass().checkReadAccess(m_context.getPrivilegeSet());
         }
      }

      if (obj == null)
      {
         if (msg.isRequired())
         {
            throw new IntegrationException("err.integration.minPartCount", new Object[]{msg.getFullPath()});
         }
        
         return null;
      }
     
      if (msg instanceof PrimitiveMessagePart)
      {
         return ((PrimitiveMessagePart)msg).convertValue(obj);
      }

      CompositeMessagePart composite = (CompositeMessagePart)msg;
      int nCount = composite.getPartCount();
     
      if (obj instanceof TransferObject)
      {
         if (isFetchInstance())
         {
            instance = (Instance)RPCUtil.instantiateClean(srcTobj, new HashTab(), m_context);
         }
         else
         {
            TransferObject tobj = new TransferObject(sMessageName, composite.getPartCount());

            tobj.setEventName(srcTobj.getEventName());
            tobj.setOID(srcTobj.getOID());
  
            for (int i = 0; i < nCount; ++i)
            {
               MessagePart part = composite.getPart(i);
               ObjectMessagePartMapping objectMessagePartMapping = (ObjectMessagePartMapping)part.getMapping();
               Attribute attribute = objectMessagePartMapping.getAttribute();
               Object value = null;

               if (attribute != null)
               {
                  value = transfer(srcTobj.findValue(attribute.getName()), part);
               }
               else
               {
                  switch (objectMessagePartMapping.getSystemAttribute())
                  {
                     case ObjectMessagePartMapping.ATTR_OID:
                        value = srcTobj.getOID().toBinary();
                        break;

                     case ObjectMessagePartMapping.ATTR_CLASS:
                        value = srcTobj.getClassName();
                        break;

                     case ObjectMessagePartMapping.ATTR_EVENT:
                        value = srcTobj.getEventName();
                        break;
                  }
               }

               tobj.setValue(part.getName(), value);
            }
  
            return tobj;
         }
      }

      if (m_context.isSecure() && !instance.isReadable())
      {
         return null;
      }

      metaclass = instance.getMetaclass();

      TransferObject tobj = new TransferObject(sMessageName, composite.getPartCount());
     
      if (!mapping.getMetaclass().isUpcast(metaclass))
      {
         throw new IntegrationException("err.integration.object.partClass",
            new Object[]{mapping.getMetaclass().getName(), composite.getFullPath()});
      }

      String sEvent = null;
      boolean bProcessed = m_processedSet.put(instance, processedPart, Boolean.TRUE) != null;
     
      m_instanceMap.put(instance, tobj);
      tobj.setOID(instance.getOID());

      if (srcTobj != null)
      {
         sEvent = srcTobj.getEventName();
      }
      else
      {
         switch (instance.getState())
         {
            case Instance.NEW:
               sEvent = "create";
               break;

            case Instance.DIRTY:
               sEvent = "update";
               break;

            case Instance.DELETED:
               sEvent = "delete";
               break;
         }
      }

      tobj.setEventName(sEvent);

      for (int i = 0; i < nCount; ++i)
      {
         MessagePart part = composite.getPart(i);
         ObjectMessagePartMapping objectMessagePartMapping = (ObjectMessagePartMapping)part.getMapping();
         Attribute attribute = objectMessagePartMapping.getAttribute();
         Object value = null;

         if (attribute != null)
         {
            if (bProcessed && objectMessagePartMapping.isKey() && !(part instanceof PrimitiveMessagePart))
            {
               throw new IntegrationException("err.integration.object.recursive", new Object[]{msg.getName()});
            }
           
            if (!bProcessed || objectMessagePartMapping.isKey())
            {
               value = transfer(instance.getValue(attribute.getOrdinal()), part);
View Full Code Here

            {
               m_formatterStrategy = (ObjectMessageFormatterStrategy)Class.forName(sFormatterClassName).newInstance();
            }
            catch (Throwable t)
            {
               throw new IntegrationException("err.integration.format.classLoad", new Object[]{sFormatterClassName}, t);
            }
         }

         m_formatterStrategy.setInvocationContext(m_context);
         m_formatterStrategy.setSyncLink(syncLink);
View Full Code Here

         {
            formatRows((List)toFormat, partsInOrder, rowPart);
         }
         else
         {
            throw new IntegrationException("err.integration.invalidRowCollection",
               new Object[]{(toFormat != null) ? toFormat.getClass().getName() : null});
         }
      }
      catch (Exception innerEx)
      {
         throw new IntegrationException("err.integration.format",
            new Object[]{message.getName()}, innerEx);
      }
   }
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.