Package net.sf.xbus.base.core

Examples of net.sf.xbus.base.core.XException


          {
            sendMessage = true;
          }
          else if (onEmpty.equals(Constants.READ_ERROR))
          {
            throw new XException(Constants.LOCATION_EXTERN,
                Constants.LAYER_APPLICATION,
                Constants.PACKAGE_APPLICATION_ADAPTER, "4");
          }
        }

        if (sendMessage)
        {
          // Send the message to the destination system
          // The message is already transformed and must only be
          // retrieved.
          // Structure information for message serialisation is due to
          // the
          // destination system.
          TextSender textsender = (TextSender) sender;

          String resData = textsender.execute(message.getFunction(),
              request);

          ((TextMessage) message).setResponseText(resData,
              destination);
          message.setResponseTimestamp(new Date());
        }
      }
      else if (Constants.TYPE_OBJECT.equals(senderType))
      {
        boolean sendMessage = true;
        Object request = ((ObjectMessage) message)
            .getRequestObject(destination);
        if (isEmpty(request))
        {
          String onEmpty = retrieveOnEmpty(destination.getName(),
              true);
          if (onEmpty.equals(Constants.READ_IGNORE))
          {
            sendMessage = false;
          }
          else if (onEmpty.equals(Constants.READ_PROCESS))
          {
            sendMessage = true;
          }
          else if (onEmpty.equals(Constants.READ_ERROR))
          {
            throw new XException(Constants.LOCATION_EXTERN,
                Constants.LAYER_APPLICATION,
                Constants.PACKAGE_APPLICATION_ADAPTER, "4");
          }
        }

        if (sendMessage)
        {
          // Send the message to the destination system
          // The message is already transformed and must only be
          // retrieved.
          // Structure information for message serialisation is due to
          // the
          // destination system.
          ObjectSender objectsender = (ObjectSender) sender;

          Object resData = objectsender.execute(
              message.getFunction(), ((ObjectMessage) message)
                  .getRequestObject(destination));

          ((ObjectMessage) message).setResponseObject(resData,
              destination);
          message.setResponseTimestamp(new Date());
        }
      }
      else if (Constants.TYPE_XML.equals(senderType))
      {
        boolean sendMessage = true;
        Object request = ((ObjectMessage) message)
            .getRequestObject(destination);
        if (isEmpty(request))
        {
          String onEmpty = retrieveOnEmpty(destination.getName(),
              true);
          if (onEmpty.equals(Constants.READ_IGNORE))
          {
            sendMessage = false;
          }
          else if (onEmpty.equals(Constants.READ_PROCESS))
          {
            sendMessage = true;
          }
          else if (onEmpty.equals(Constants.READ_ERROR))
          {
            throw new XException(Constants.LOCATION_EXTERN,
                Constants.LAYER_APPLICATION,
                Constants.PACKAGE_APPLICATION_ADAPTER, "4");
          }
        }

        if (sendMessage)
        {
          // Send the message to the destination system
          // The message is already transformed and must only be
          // retrieved.
          ObjectSender objectsender = (ObjectSender) sender;

          Document resData = (Document) objectsender.execute(message
              .getFunction(), ((XMLMessage) message)
              .getRequestDocument(destination));

          ((XMLMessage) message).setResponseDocument(resData,
              destination);
          message.setResponseTimestamp(new Date());
        }
      }
      else
      {
        List params = new Vector();
        params.add(sender.getType());
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_APPLICATION,
            Constants.PACKAGE_APPLICATION_ADAPTER, "1", params);
      }
    }
    catch (Exception t)
    {
      message.setResponseTimestamp(new Date());
      message.setReturncode(Constants.RC_NOK);
      message.setErrortext(t.getMessage());
      Trace.error(t);
    }

    /* Logging of the sending-activity into the journal. */
    try
    {
      new Journal().log('S', destination, message);
    }
    catch (Exception t)
    {
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_APPLICATION,
          Constants.PACKAGE_APPLICATION_ADAPTER, "0", t);
    }
  }
View Full Code Here


        {
          throw (XException) t;
        }
        else
        {
          throw new XException(Constants.LOCATION_INTERN,
              Constants.LAYER_APPLICATION,
              Constants.PACKAGE_APPLICATION_ADAPTER, "0", t);
        }
      }
    }
View Full Code Here

    if (isEmpty(request))
    {
      String onEmpty = retrieveOnEmpty(source.getName(), false);
      if (onEmpty.equals(Constants.READ_ERROR))
      {
        throw new XException(Constants.LOCATION_EXTERN,
            Constants.LAYER_APPLICATION,
            Constants.PACKAGE_APPLICATION_ADAPTER, "4");
      }
      else if (onEmpty.equals(Constants.READ_IGNORE))
      {
View Full Code Here

        && !onEmpty.equals(Constants.READ_IGNORE)
        && !onEmpty.equals(Constants.READ_PROCESS))
    {
      List params = new Vector();
      params.add(onEmpty);
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_APPLICATION,
          Constants.PACKAGE_APPLICATION_ADAPTER, "3", params);
    }
    return onEmpty;
  }
View Full Code Here

    {
      return dealers;
    }
    else
    {
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_SAMPLE, Constants.PACKAGE_SAMPLE_SAMPLE,
          "1");
    }
  }
View Full Code Here

      }
      else
      {
        List params = new Vector(1);
        params.add(sourceMessage.getShortname());
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_PROTOCOL,
            Constants.PACKAGE_PROTOCOL_PROTOCOL, "9", params);
      }
    } // if (receiverType==null) - no specific type declared for system
View Full Code Here

              request.getContext(), request.toString());
        }
      }
      catch (NamingException e)
      {
        throw new XException(Constants.LOCATION_EXTERN,
            Constants.LAYER_TECHNICAL,
            Constants.PACKAGE_TECHNICAL_LDAP, "0", e);
      }
    }
    return retDocument;
View Full Code Here

    if ((convertFrom != TRANSFORM_FROM_REQUEST)
        && (convertFrom != TRANSFORM_FROM_RESPONSE))
    {
      List params = new Vector();
      params.add(String.valueOf(convertFrom));
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_PROTOCOL,
          Constants.PACKAGE_PROTOCOL_PROTOCOL, "7", params);
    }

    Message destinationMessage = createMessage(sourceMessage, destination);

    XBUSSystem source = sourceMessage.getSource();

    String receiverType = Configuration.getInstance().getValueOptional(
        "TransformInput", source.getName(), destination.getName());

    if (receiverType == null)
    {
      if (sourceMessage instanceof XMLMessage)
      {
        receiverType = Constants.TYPE_XML;
      }
      else if (sourceMessage instanceof ObjectMessage)
      {
        receiverType = Constants.TYPE_OBJECT;
      }
      else if (sourceMessage instanceof TextMessage)
      {
        receiverType = Constants.TYPE_TEXT;
      }
      else
      {
        List params = new Vector(1);
        params.add(sourceMessage.getShortname());
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_PROTOCOL,
            Constants.PACKAGE_PROTOCOL_PROTOCOL, "9", params);
      }
    } // if (receiverType==null) - no specific type declared for system
View Full Code Here

        if (requestNode.getNodeName().equals(SEARCH_STRING))
        {
          requestString = XMLHelper.getNodeText(requestNode);
          if (requestString == null)
          {
            throw new XException(Constants.LOCATION_EXTERN,
                Constants.LAYER_TECHNICAL,
                Constants.PACKAGE_TECHNICAL_LDAP, "1");
          }
          else
          {
            request = new RequestContainer(SEARCH_STRING,
                getContext(requestNode), requestString);
            retVector.add(request);
          }
        }
        else if (requestNode.getNodeName().equals(SEARCH_ATTRIBUTES))
        {
          children = requestNode.getChildNodes();
          attrs = new BasicAttributes();
          for (int j = 0; j < children.getLength(); j++)
          {
            child = children.item(j);
            if (child.getNodeType() == Element.ELEMENT_NODE)
            {
              String attributeName = child.getNodeName();
              String attributeValue = XMLHelper
                  .getNodeText(child);
              attrs.put(attributeName, attributeValue);
            }
          }
          request = new RequestContainer(SEARCH_ATTRIBUTES,
              getContext(requestNode), attrs);
          retVector.add(request);
        }
        else
        {
          Vector params = new Vector(1);
          params.add(requestNode.getNodeName());
          throw new XException(Constants.LOCATION_EXTERN,
              Constants.LAYER_TECHNICAL,
              Constants.PACKAGE_TECHNICAL_LDAP, "2", params);
        }
      }
    }
View Full Code Here

        resultElement.appendChild(record);
      }
    }
    catch (NamingException e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_LDAP, "0", e);
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.xbus.base.core.XException

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.