Package net.sf.xbus.application

Examples of net.sf.xbus.application.Adapter


              } // The content of the request.
              // Subclasses may define their own request content.
              Object requestContent = getRequestContent();

              // call application layer
              Adapter adapter = new Adapter();
              adapter.callApplication(xbusSystem, requestContent,
                  getType());
              // check the Adapter return code
              // in case of "not success" throw new XException
              if (Constants.RC_OK.equals(adapter.getReturncode()))
              {
                TAManager.getInstance().commit();

                PostProcessor.start(xbusSystem, adapter
                    .getResponse(),
                    Constants.POSTPROCESSING_PERSYSTEM);

                Trace.info("End processing "
                    + xbusSystem.getCompleteName());
                Trace
                    .info("----------------------------------------");
                successful = true;
              } // then
              // (Constants.RC_OK.equals(adapter.getReturncode()))
              else
              {
                TAManager.getInstance().rollback();

                NotifyError.notifyError(this, xbusSystem,
                    adapter.getErrormessage(),
                    requestContent, null);

                Trace.info("Error while processing "
                    + xbusSystem.getCompleteName());
                Trace
View Full Code Here


      if (requestContent != null)
      {
        Trace.info("Receiving data from " + getAddress());

        // call application layer
        Adapter adapter = new Adapter();
        adapter.callApplication(xbusSystem, requestContent, getType());
        mReturncode = adapter.getReturncode();

        // check the Adapter return code
        // in case of "not success" throw new XException
        if (Constants.RC_OK.equals(adapter.getReturncode()))
        {
          mailReceived = true;
          taManager.commit();
          PostProcessor.start(xbusSystem, adapter.getResponse(),
              Constants.POSTPROCESSING_PERSYSTEM);
          Trace
              .info("End processing "
                  + xbusSystem.getCompleteName());
          Trace.info("----------------------------------------");
View Full Code Here

        textString.append(line);
        textString.append(Constants.LINE_SEPERATOR);
      }
      String requestText = textString.toString();

      Adapter adapter = new Adapter();
      adapter.callApplication(mSource, requestText, getType());
      String responseText = (String) adapter.getResponse();

      if (Constants.RC_OK.equals(adapter.getReturncode()))
      {
        TAManager.getInstance().commit();

        initializeAmountErrors();

        PostProcessor.start(mSource, responseText,
            Constants.POSTPROCESSING_PERSYSTEM);

        res.setStatus(HttpServletResponse.SC_OK);
        if ((responseText != null) && (responseText.length() > 0))
        {
          res.setContentType(contentType);
          PrintWriter writer = res.getWriter();
          writer.print(responseText);
          writer.close();
        }
      }
      else
      {
        TAManager.getInstance().rollback();
        handleError(res, null, requestText, adapter.getErrormessage());
      }
    }
    catch (Exception e)
    {
      if (e instanceof XException)
View Full Code Here

    {
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_HTTP, "0", e);
    }
    Adapter adapter = new Adapter();
    adapter.callApplication(mSource, inStream, getType());

    if (Constants.RC_OK.equals(adapter.getReturncode()))
    {
      TAManager.getInstance().commit();

      initializeAmountErrors();

      PostProcessor.start(mSource, adapter.getResponse(),
          Constants.POSTPROCESSING_PERSYSTEM);

      res.setStatus(HttpServletResponse.SC_OK);
    }
    else
    {
      TAManager.getInstance().rollback();
      handleError(res, null, null, adapter.getErrormessage());
    }
  }
View Full Code Here

            }
          }
        }
      }

      Adapter adapter = new Adapter();
      adapter.callApplication(mSource, requestDoc, getType());

      Object response = adapter.getResponse();
      String responseText = null;
      if (response != null)
      {
        responseText = XMLHelper
            .serializeXML((Document) response, null);
      }

      if (Constants.RC_OK.equals(adapter.getReturncode()))
      {
        TAManager.getInstance().commit();

        initializeAmountErrors();

        PostProcessor.start(mSource, null,
            Constants.POSTPROCESSING_PERSYSTEM);

        res.setStatus(HttpServletResponse.SC_OK);
        if ((responseText != null) && (responseText.length() > 0))
        {
          res.setContentType(contentType);
          PrintWriter writer = res.getWriter();
          writer.print(responseText);
          writer.close();
        }
      }
      else
      {
        TAManager.getInstance().rollback();
        handleError(res, null, requestDoc, adapter.getErrormessage());
      }
    }
    catch (Exception e)
    {
      if (e instanceof XException)
View Full Code Here

        if (message != null)
        {
          Trace.info("Receiving data from " + getAddress());

          Adapter adapter = new Adapter();
          adapter.callApplication(getSource(), message, getType());

          if (Constants.RC_OK.equals(adapter.getReturncode()))
          {
            initializeErrorCounter();
            taManager.commit();
            PostProcessor.start(getSource(), adapter.getResponse(),
                Constants.POSTPROCESSING_PERSYSTEM);
            Trace.info("End processing "
                + getSource().getCompleteName());
            Trace.info("------------------------------");
          }
          else
          {
            handleError(taManager, message, adapter
                .getErrormessage());
          }
        }
        else
        {
View Full Code Here

    try
    {
      taManager.clearManager();
      taManager.begin();

      Adapter adapter = new Adapter();
      adapter.callApplication(source, request, getType());
      responseObject = adapter.getResponse();
      if (Constants.RC_OK.equals(adapter.getReturncode()))
      {
        taManager.commit();
        PostProcessor.start(source, responseObject,
            Constants.POSTPROCESSING_PERSYSTEM);
        Trace.info("End processing " + source.getCompleteName());
        Trace.info("-----------------------------");
      }
      else
      {
        errormessage = adapter.getErrormessage();
        taManager.rollback();
        NotifyError.notifyError(this, source, errormessage, request,
            null);
        Trace
            .info("Error while processing "
View Full Code Here

          return true;
        }
        else
        {
          // call application layer
          Adapter adapter = new Adapter();
          adapter.callApplication(xbusSystem, requestContent,
              getType());

          // check the Adapter return code
          // in case of not success, throw new XException
          if (Constants.RC_OK.equals(adapter.getReturncode()))
          {
            successful = true;
          }
        }
      }
View Full Code Here

       */
      taManager = TAManager.getInstance();
      taManager.clearManager();
      taManager.begin();

      Adapter adapter = new Adapter();
      adapter.callApplication(source, request, Constants.TYPE_TEXT);
      Object responseObject = adapter.getResponse();
      if (Constants.RC_OK.equals(adapter.getReturncode()))
      {
        taManager.commit();
        PostProcessor.start(source, responseObject,
            Constants.POSTPROCESSING_PERSYSTEM);
        Trace.info("End resending " + source.getCompleteName());
        Trace.info("-----------------------------");
        retString.append("Message from ").append(
            source.getCompleteName()).append(
            " successfully resent!");

        File messageFile = new File(getDirectory()
            + Constants.FILE_SEPERATOR + filename);
        if (messageFile.delete())
        {
          retString.append("<br>");
          retString.append("File ").append(filename).append(
              " has been deleted.");
        }
        else
        {
          retString.append("<br />");
          retString.append("File ").append(filename).append(
              " cannot be deleted.");
        }
      }
      else
      {
        taManager.rollback();
        Trace.info("Error while resending " + source.getCompleteName());
        Trace.info("-----------------------------");
        retString.append("Error while resending ").append(
            source.getCompleteName()).append("<br>").append(
            "Reason: ").append(adapter.getErrormessage()).append(
            "<br>").append("File ").append(filename).append(
            " has not been deleted.");
      }
    }
    catch (Exception t)
View Full Code Here

        request = getRequestContent();

        /*
         * Process data
         */
        Adapter adapter = new Adapter();
        adapter.callApplication(source, request, getType());
        Object responseObject = adapter.getResponse();
        if (Constants.RC_OK.equals(adapter.getReturncode()))
        {
          taManager.commit();
          PostProcessor.start(source, responseObject,
              Constants.POSTPROCESSING_PERSYSTEM);
          Trace.info("End processing " + source.getCompleteName());
          Trace.info("----------------------------");
          return true;
        }
        else
        {
          taManager.rollback();

          NotifyError.notifyError(this, source, adapter
              .getErrormessage(), request, null);

          Trace.info("Error while processing "
              + source.getCompleteName());
          Trace.info("----------------------------");
View Full Code Here

TOP

Related Classes of net.sf.xbus.application.Adapter

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.