Package nexj.core.rpc

Examples of nexj.core.rpc.TransferObject$Iterator


            Sender sender = (Sender)channel.getSender().getInstance(m_context);
            ObjectOutput output = sender.createOutput();

            ((MessageFormatter)message.getFormat().getFormatter().getInstance(m_context)).format((TransferObject)value, message, output);
            TransferObject tobj = new TransferObject(1);
            tobj.setValue(Sender.BODY, output.getObject());
            value = tobj;
         }
      }

      if (channel != null)
View Full Code Here


       * @param lTTL The message time to live in milliseconds.
       * @return The message.
       */
      public TransferObject createMessage(TransferObject properties, int nPriority, long lTTL)
      {
         TransferObject tobj = new TransferObject(4);

         if (properties != null)
         {
            tobj.setValue(JMSSender.PROPERTIES, properties);
         }

         if (nPriority >= 0)
         {
            tobj.setValue(JMSSender.PRIORITY, Primitive.createInteger(nPriority));
         }

         if (lTTL >= 0)
         {
            tobj.setValue(JMSSender.TTL, Primitive.createLong(lTTL));
         }

         return tobj;
      }
View Full Code Here

      {
         GenericSerializablePropertyMap propertyMap = uow.m_propertyMap;

         if (propertyMap != null && propertyMap.getValueCount() != 0)
         {
            TransferObject properties = (TransferObject)tobj.findValue(JMSSender.PROPERTIES);

            if (properties == null || !properties.hasValue(JMSSender.STATE))
            {
               if (properties == null)
               {
                  properties = new TransferObject(1);
                  tobj.setValue(JMSSender.PROPERTIES, properties);
               }

               properties.setValue(JMSSender.STATE, propertyMap.serializeValues(uow.getInvocationContext()));
            }
         }
      }
View Full Code Here

       * @param lTTL The message time to live in milliseconds.
       * @return The message.
       */
      public TransferObject createMessage(TransferObject properties, int nPriority, long lTTL)
      {
         TransferObject tobj = new TransferObject(
            "ObjectQueueMessage", ((properties == null) ? 0 : properties.getValueCount()) + 3);

         if (properties != null)
         {
            for (PropertyIterator iter = properties.getIterator(); iter.hasNext();)
            {
               iter.next();
               tobj.setValue(iter.getName(), iter.getValue());
            }
         }

         if (nPriority >= 0)
         {
            tobj.setValue(ObjectSender.PRIORITY, Primitive.createInteger(nPriority));
         }

         if (lTTL >= 0)
         {
            tobj.setValue(ObjectSender.DELAY, Primitive.createLong(lTTL));
         }

         return tobj;
      }
View Full Code Here

      // operations

      public TransferObject getMessage()
      {
         Lookup identityMap = new HashTab();
         TransferObject tobj;

         if (m_accessor instanceof Metaclass)
         {
            tobj = new TransferObject(((Metaclass)m_accessor).getName(), 0);
         }
         else
         {
            tobj = (TransferObject)RPCUtil.transferState(m_accessor, null, identityMap, RPCUtil.TF_ALL);
         }

         tobj.setEventName(m_event.getName());

         TransferObject correlator;

         if (m_correlator != null)
         {
            if (m_correlator instanceof Metaclass)
            {
               correlator = new TransferObject(((Metaclass)m_correlator).getName(), 0);
            }
            else
            {
               correlator = (TransferObject)RPCUtil.transferState(m_correlator, null, identityMap, RPCUtil.TF_TOP);
            }

            correlator.setEventName(m_corEvent.getName());
         }
         else
         {
            correlator = null;
         }
View Full Code Here

    */
   protected MessageFactory getSecureMessageFactory(Channel channel, boolean bNoLocal, TransferObject properties)
   {
      if (properties == null)
      {
         properties = new TransferObject(1);
      }

      if (channel instanceof MessageQueue)
      {
         MessageQueue mq = (MessageQueue)channel;
View Full Code Here

      if (correlator != null)
      {
         correlator.getMetaclass().getSelector(corEvent).getMember(0);
      }

      TransferObject clonedProperties = (properties == null) ? new TransferObject(3) : (TransferObject)properties.clone();

      if (m_context.getPrincipal() != InvocationContext.ANONYMOUS_PRINCIPAL)
      {
         clonedProperties.setValue(ObjectSender.USER, m_context.getPrincipal().getName());
      }

      clonedProperties.setValue(ObjectSender.PROTECTED, Boolean.FALSE);

      Channel channel = m_context.getMetadata().getChannel(sChannel);
      MessageFactory mf = getSecureMessageFactory(channel, bNoLocal, clonedProperties);

      addMessage(channel, new AccessorEnvelope(mf, accessor, event, args,
View Full Code Here

    * @param lTTL The message time to live in ms, or -1 to use the default value.
    * @param bNoLocal True to exclude the local node from the broadcast.
    */
   public void addMessage(Channel channel, Object obj, TransferObject properties, int nPriority, long lTTL, boolean bNoLocal)
   {
      TransferObject clonedProperties = (properties == null) ? new TransferObject(3) : (TransferObject)properties.clone();

      MessageFactory mf = getSecureMessageFactory(channel, bNoLocal, clonedProperties);

      addMessage(channel, new ObjectEnvelope(mf, obj, clonedProperties, nPriority, lTTL));
   }
View Full Code Here

      }
      else if (value instanceof TransferObject)
      {
         buf.append('<');

         TransferObject tobj = (TransferObject)value;

         if (bClassName)
         {
            buf.append(tobj.getClassName());
            buf.append(": ");
         }

         if (tobj.getOID() == null)
         {
            buf.append("OID");
         }
         else
         {
            buf.append(tobj.getOID());
         }

         buf.append('>');
      }
      else if (value instanceof Collection)
View Full Code Here

    * @param tobj The transfer object to send.
    * @return The transfer object containing the response.
    */
   public TransferObject respond(TransferObject tobj) throws IntegrationException
   {
      TransferObject response;
      TCPConnection con = null;

      try
      {
         InetSocketAddress remoteAddr = getRemoteAddress(tobj);

         con = open(remoteAddr, getLocalAddress(tobj, remoteAddr), getTrust(tobj),
            getCertificate(tobj), getPassword(tobj), getConnectionTimeout(tobj));
         con.setTOS(getTOS(tobj));
         send(tobj, con, null);

         // Get the input channel
         MessageInputStream mis = m_channel.getMessageStreamFactory(null).createMessageInputStream(con.getInputStream());

         con.setReadTimeout(m_channel.getReadTimeout());
         remoteAddr = con.getRemoteAddress();

         InetSocketAddress localAddr = con.getLocalAddress();

         // Create the TransferObject
         response = new TransferObject("TCP", 6);
         response.setValue(TCPSender.REMOTE_HOST, remoteAddr.getAddress().getHostAddress());
         response.setValue(TCPSender.REMOTE_PORT, Primitive.createInteger(remoteAddr.getPort()));
         response.setValue(TCPSender.LOCAL_HOST, localAddr.getAddress().getHostAddress());
         response.setValue(TCPSender.LOCAL_PORT, Primitive.createInteger(localAddr.getPort()));
         response.setValue(TCPSender.CHANNEL, m_channel.getName());

         if (mis.next(response))
         {
            // get body
            BufferedInputStream bufStream = new BufferedInputStream(new NoCloseInputStream(mis));
            Object body;

            if (m_channel.getEncoding() != null)
            {
               String sEncoding = m_channel.getEncoding().toLowerCase(Locale.ENGLISH);
               Reader ireader = new BufferedReader(new InputStreamReader(
                  UTF8BOMIgnoreInputStream.wrap(bufStream, sEncoding), sEncoding));

               body = new ReaderInput(ireader);
            }
            else
            {
               body = new StreamInput(bufStream);
            }

            response.setValue(TCPSender.BODY, body);
         }
      }
      catch (RPCException e)
      {
         // don't wrap RPC exception
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.