Package nexj.core.rpc

Examples of nexj.core.rpc.RPCException


         {
            instance.setValue("data", Binary.fromObject(request));
         }
         catch (IOException e)
         {
            throw new RPCException("err.rpc.requestSerialization", e);
         }
      }
      else
      {
         instance.setValue("object", accessor);
View Full Code Here


      // set all previously supported headers as key->value pairs in msg
      for (Pair props = properties; props != null; props = props.getNext())
      {
         if (!(props.getHead() instanceof Pair))
         {
            throw new RPCException("err.rpc.mailPropertyFormat");
         }

         Pair pair = (Pair)props.getHead();
         Object name = pair.getHead();

         if (!(name instanceof Symbol) && !(name instanceof String))
         {
            throw new RPCException("err.rpc.mailPropertyFormat");
         }

         String sName = name.toString();

         if (sName.equals("CC"))
         {
            msg.setValue(Mail.CC, toAddress(pair.getNext()));
         }
         else if (sName.equals("BCC"))
         {
            msg.setValue(Mail.BCC, toAddress(pair.getNext()));
         }
         else if (sName.equals("Reply-To"))
         {
            msg.setValue(Mail.REPLY, toAddress(pair.getNext()));
         }
         else
         {
            throw new RPCException("err.rpc.mailProperty", new Object[]{sName});
         }

         if (props.getTail() != null && !(props.getTail() instanceof Pair))
         {
            throw new RPCException("err.rpc.mailPropertyFormat");
         }
      }

      m_sender.send(msg);
   }
View Full Code Here

         if (channel != null && message != null)
         {
            if (channel.getSender() == null)
            {
               throw new RPCException("err.rpc.notSender", new Object[]{channel.getName()});
            }

            Sender sender = (Sender)channel.getSender().getInstance(m_context);
            ObjectOutput output = sender.createOutput();
View Full Code Here

      {
         return OBJECT_MESSAGE_FACTORY;
      }
      else
      {
         throw new RPCException("err.rpc.msg.channel", new Object[]{channel.getName()});
      }
   }
View Full Code Here

    */
   protected void addMessage(Channel channel, Object msg) throws RPCException, WorkStateException
   {
      if (channel.getSender() == null)
      {
         throw new RPCException("err.rpc.notSender", new Object[]{channel.getName()});
      }

      if (m_nCommitStage == COMMIT_CACHE)
      {
         throw new WorkStateException("err.runtime.committing");
View Full Code Here

      Integer port = (Integer)tobj.findValue(REMOTE_PORT);
      final int nPort = (port == null) ? m_channel.getRemotePort() : port.intValue();

      if (sHost == null)
      {
         throw new RPCException("err.rpc.tcp.unspecifiedRemoteHost");
      }

      try
      {
         return (InetSocketAddress)AccessController.doPrivileged(new PrivilegedExceptionAction()
View Full Code Here

   {
      // validate ports
      if (remoteAddr.getPort() < TCPResourceAdapter.MIN_PORT
         || remoteAddr.getPort() > TCPResourceAdapter.MAX_PORT)
      {
         throw new RPCException("err.rpc.tcp.invalidRemotePort",
            new Object[] { "" + TCPResourceAdapter.MIN_PORT, "" + TCPResourceAdapter.MAX_PORT });
      }

      if (localAddr != null && (localAddr.getPort() < TCPResourceAdapter.MIN_PORT
         || localAddr.getPort() > TCPResourceAdapter.MAX_PORT))
      {
         throw new RPCException("err.rpc.tcp.invalidLocalPort",
            new Object[] { "" + TCPResourceAdapter.MIN_PORT, "" + TCPResourceAdapter.MAX_PORT });
      }

      // get connection object
      if (m_channel.isSecure())
View Full Code Here

    */
   public void send(TransferObject tobj, TCPConnection con, MessageOutputStream out) throws IOException
   {
      if (!m_channel.isSendable())
      {
         throw new RPCException("err.rpc.notSender", new Object[]{m_channel.getName()});
      }

      if (s_logger.isDebugEnabled())
      {
         s_logger.debug("Sending a message on channel \"" + m_channel.getName() + "\"");
         s_logger.dump(tobj);
      }

      Object body = tobj.findValue(BODY);
      InputStream dataStream;

      if (body == null)
      {
         dataStream = new ByteArrayInputStream(new byte[0]);
      }
      else if (body instanceof String)
      {
         dataStream = new ByteArrayInputStream(((String)body).getBytes((m_channel.getEncoding() == null) ?
            XMLUtil.ENCODING : m_channel.getEncoding()));
      }
      else
      {
         dataStream = ((Binary)body).getInputStream();
      }

      // get message output stream
      if (out == null)
      {
         out = m_channel.getMessageStreamFactory(null).createMessageOutputStream(con.getOutputStream());
      }

      if (out.start(tobj))
      {
         // write data
         IOUtil.copy(out, dataStream);
         out.end(tobj);
      }
      else
      {
         con.invalidate();

         throw new RPCException("err.rpc.tcp.forciblyClosedConnection");
      }

      m_sentCounter.add(1);
   }
View Full Code Here

         con.setTOS(getTOS(tobj));
         send(tobj, con, null);
      }
      catch (Throwable t)
      {
         throw new RPCException("err.rpc.tcp", t);
      }
      finally
      {
         if (con != null)
         {
View Full Code Here

         // don't wrap RPC exception
         throw e;
      }
      catch (Throwable t)
      {
         throw new RPCException("err.rpc.tcp", t);
      }
      finally
      {
         if (con != null)
         {
View Full Code Here

TOP

Related Classes of nexj.core.rpc.RPCException

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.