Package nexj.core.rpc

Examples of nexj.core.rpc.TransferObject$Iterator


   /**
    * @see nexj.core.meta.integration.EndpointPart#createObject()
    */
   public TransferObject createObject()
   {
      return new TransferObject(m_refPart.getName());
   }
View Full Code Here


    */
   public TransferObject transform(PropertyMap obj, Transformation transformation, Pair arguments) throws IntegrationException
   {
      Logger logger = transformation.getLogger();

      m_output = new TransferObject();
      m_listMap = new HashTab();

      try
      {
         if (logger.isDebugEnabled())
View Full Code Here

    * @param source The transformation source.
    * @param value The value to assign.
    */
   protected void setDestination(TransformationMapping mapping, TransformationSource source, Object value)
   {
      TransferObject tobj = m_output;
      int nList = -1;

      value = convert(value, source, mapping);

      for (int i = 0, n = mapping.getDestinationCount() - 1; i <= n; ++i)
      {
         EndpointPart destinationPart = mapping.getDestination(i);
         String sDestinationName = destinationPart.getName();

         if (destinationPart.isCollection())
         {
            List list = (List)tobj.findValue(sDestinationName);

            if (list == null)
            {
               list = new ArrayList(4);
               destinationPart.setValue(tobj, list);
            }

            if (destinationPart.isPrimitive())
            {
               if (value instanceof List)
               {
                  list.addAll((List)value);
               }
               else
               {
                  list.add(value);
               }
            }
            else if (mapping.isFixedDestination(i))
            {
               if (list.isEmpty())
               {
                  tobj = destinationPart.createObject();
                  list.add(tobj);
               }
               else
               {
                  tobj = (TransferObject)list.get(0);
               }
            }
            else if (i == n && value instanceof List)
            {
               list.addAll((List)value);
            }
            else
            {
               int nLastCollection = mapping.getLastCollectionDestinationOrdinal();
               int nParentLevel = (mapping.getCollectionParent() == null) ? 0 : mapping.getCollectionParent().getLevel();
               boolean bListKey = false;

               tobj = null;
              
               while (++nList <= source.getLevel())
               {
                  TransformationSource path = source.getPath(nList);

                  if (!mapping.isFixedSource(path))
                  {
                     EndpointPart sourcePart = path.getPart();

                     if (sourcePart.isCollection())
                     {
                        if (m_listKey == null)
                        {
                           m_listKey = new ListKey();
                        }

                        if (i == nLastCollection)
                        {
                           nList = nParentLevel;
                        }

                        m_listKey.set(list, getSourceList(nList), getSourceIndex(nList), sourcePart);
                        tobj = (TransferObject)m_listMap.get(m_listKey);
                        bListKey = true;

                        break;
                     }
                     else if (i == nLastCollection && nList > nParentLevel)
                     {
                        Object sourceObject = getSourceObject(nList);

                        if (sourcePart.isPrimitive() ||
                           sourceObject == null ||
                           sourceObject == Undefined.VALUE)
                        {
                           sourceObject = getSourceObject(nList - 1);
                        }

                        if (m_listKey == null)
                        {
                           m_listKey = new ListKey();
                        }

                        m_listKey.set(list, sourceObject, 0, sourcePart);
                        tobj = (TransferObject)m_listMap.get(m_listKey);
                        bListKey = true;

                        break;
                     }
                  }
               }

               if (tobj == null)
               {
                  if (i == n)
                  {
                     tobj = (TransferObject)value;
                     list.add(tobj);
                  }
                  else
                  {
                     tobj = destinationPart.createObject();
                     list.add(tobj);
                  }

                  if (bListKey)
                  {
                     m_listMap.put(m_listKey, tobj);
                     m_listKey = null;
                  }
               }
            }
         }
         else
         {
            if (i == n)
            {
               destinationPart.setValue(tobj, value);
            }
            else
            {
               TransferObject obj = (TransferObject)tobj.findValue(sDestinationName);
              
               if (obj == null)
               {
                  obj = destinationPart.createObject();
                  destinationPart.setValue(tobj, obj);
View Full Code Here

    * @throws IntegrationException If a transformation error occurs.
    */
   public TransferObject transformNested(PropertyMap tobj, String sTransformationName, Pair arguments) throws IntegrationException
   {
      Transformation transformation = m_context.getMetadata().getTransformation(sTransformationName);
      TransferObject outputSaved = m_output;
      Object[] sourceArraySaved = m_sourceArray;
      Lookup listMapSaved = m_listMap;
      ListKey listKeySaved = m_listKey;
      Object[] scriptArraySaved = m_scriptArray;

View Full Code Here

         return;
      }

      if (obj instanceof TransferObject)
      {
         TransferObject tobj = (TransferObject)obj;

         tobj.setOID(null);
        
         for (PropertyIterator itr = tobj.getIterator(); itr.hasNext();)
         {
            itr.next();
            removeOIDs(itr.getValue(), identitySet);
         }
      }
View Full Code Here

    * @throws Exception If an error occurs.
    */
   public void testParametrize() throws Exception
   {
      Pair result;
      TransferObject params = new TransferObject(2);
      MIMEHeaderMap emptyHeaderMap = new MIMEHeaderMap();
      MIMEHeaderMap formHeaderMap = new MIMEHeaderMap();

      params.setValue("a", "x");
      params.setValue("b", "y");

      formHeaderMap.add("Content-Type", "application/x-www-form-urlencoded");

      // Parameters go in URL (with or without ? on end of input URL)
      result = HTTPAdapter.parametrize("http://www.example.com/test1", null, params, emptyHeaderMap);
View Full Code Here

      instance.setValue("next", tmStart);
      instance.setValue("principal", sUser);
     
      if (accessor instanceof Metaclass)
      {
         TransferObject tobj = new TransferObject(((Metaclass)accessor).getName(), 0);
         Request request = new Request();

         tobj.setEventName(event.getName());
         request.addInvocation(tobj);

         try
         {
            instance.setValue("data", Binary.fromObject(request));
View Full Code Here

         {
            public void handleCharacterStream(Reader reader, String sName) throws IOException
            {
               try
               {
                  TransferObject tobj = parser.parse(new ReaderInput(reader), (Message)transformation.getSource());

                  tobj.setValue("name", sName);

                  if (enabled != null && !Intrinsic.isTrue(m_context.getMachine().invoke(enabled, tobj, (Object[])null)))
                  {
                     return;
                  }
View Full Code Here

      });

      int nReqCount = Integer.parseInt(getProperty("req.count", "1"));

      final Request request = new Request();
      TransferObject tobj = new TransferObject();
     
      tobj.setClassName("TestMessage");
      tobj.setEventName("runTest");
     
      request.addInvocation(tobj);
      request.setAsync(StringUtil.parseBoolean(getProperty("async", "0")));

      for (int nReq = 0; nReq < nReqCount; ++ nReq)
View Full Code Here

      StringReader reader = new StringReader(
         "<User xmlns=\"" + XML.NS_URI_TNS + "\">" +
         "<fullName>fullname</fullName>" +
         "<names>name1</names><names>name2</names><names>name3</names>" +
         "</User>");
      TransferObject tobj = (TransferObject)unmarshaller.deserialize(reader, metaclass);

      assertEquals("User", tobj.getClassName());
      assertNull(tobj.getEventName());
      assertNull(tobj.getOID());
      assertEquals(2, tobj.getValueCount());
      assertEquals("fullname", tobj.findValue("fullName"));

      Object list = tobj.findValue("names");

      assertTrue(list instanceof List);
      assertEquals(3, ((List)list).size());
      assertEquals("name1", ((List)list).get(0));
      assertEquals("name2", ((List)list).get(1));
View Full Code Here

TOP

Related Classes of nexj.core.rpc.TransferObject$Iterator

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.