Package net.sf.xbus.protocol.simple

Examples of net.sf.xbus.protocol.simple.SimpleTextMessage


        if (!checkRequest(source, request))
        {
          /*
           * Request shall not be processed but ignored
           */
          call = new SimpleTextMessage(source);
          try
          {
            ((TextMessage) call).setRequestText(request.toString(),
                source);
          }
          catch (XException e)
          {
            // This problem has already been traced
          }
          call.setReturncode(Constants.RC_OK);
        }
        else
        {
          /*
           * Request shall be processed
           */

          // First: create the message obejct
          call = MessageFactory.createApplicationMessage(source);

          // Second: initialise the message object by pasting in the
          // request
          // as content,
          // then perfom the call the appropriate application object
          // and record the response
          if (Constants.TYPE_TEXT.equals(messageType))
          {
            ((TextMessage) call).setRequestText((String) request,
                source);
            ApplicationFactory.callApplication(call);
            // Get the response.
            // The message is already transformed and structure
            // information
            // for serialising is attached to the source system.
            mResponse = ((TextMessage) call).getResponseText();
          }
          else if (Constants.TYPE_OBJECT.equals(messageType))
          {
            ((ObjectMessage) call)
                .setRequestObject(request, source);
            ApplicationFactory.callApplication(call);
            // Get the response.
            // The message is already transformed and structure
            // information
            // for serialising is attached to the source system.
            mResponse = ((ObjectMessage) call).getResponseObject();
          }
        }
      }
      catch (Exception t)
      {
        /*
         * Inner try-catch block catches all exceptions and converts
         * them to XExceptions if necessary
         */
        if (t instanceof XException)
        {
          throw (XException) t;
        }
        else
        {
          throw new XException(Constants.LOCATION_INTERN,
              Constants.LAYER_APPLICATION,
              Constants.PACKAGE_APPLICATION_ADAPTER, "0", t);
        }
      }
    }
    catch (XException e)
    {
      /*
       * Outer try-catch block handles the XException
       */
      if (call == null)
      {
        if (request == null)
        {
          request = "<null>";
        }
        call = new SimpleTextMessage(source);
        try
        {
          ((TextMessage) call).setRequestText(request.toString(),
              source);
        }
View Full Code Here


  {
    try
    {
      Trace.info("Starting postprocessor ...");

      SimpleTextMessage message = new SimpleTextMessage(null);
      message.setRequestObject(mCallData, null);
      Adapter.callSender(message, mDestination);

      Trace.info("Postprocessor finished");
    }
    catch (XException e)
View Full Code Here

TOP

Related Classes of net.sf.xbus.protocol.simple.SimpleTextMessage

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.