Package hermes.xml

Examples of hermes.xml.MessageSet


        log.error(ex.getMessage(), ex);
      }
    }

    if (xmlMessages == null) {
      xmlMessages = new MessageSet();
    }

  }
View Full Code Here


    try {
      if (xmlMessages == null) {
        read();
      }

      MessageSet newMessages = xmlSupport.toMessageSet(messages);

      xmlMessages.getEntry().addAll(newMessages.getEntry());

      save();
    } catch (JMSException e) {
      throw e; // Ugh.
    } catch (Exception e) {
View Full Code Here

      // ikky but whatever.
     
      if (xmlMessage != null) {
        if (message.getJMSMessageID().equals(xmlMessage.getJMSMessageID())) {
          xmlMessages.getEntry().remove(i) ;
          MessageSet messageSet = xmlSupport.toMessageSet(Arrays.asList(message)) ;
          xmlMessages.getEntry().add(i, messageSet.getEntry().get(0)) ;
        }
      }
    }

    save();
View Full Code Here

  }

  @Override
  public void toXML(Collection messages, OutputStream ostream) throws JMSException, IOException {
    try {
      MessageSet messageSet = toMessageSet(messages);
      saveContent(messageSet, ostream);
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);

      throw new HermesException(ex);
View Full Code Here

  @Override
  public String toXML(Collection messages) throws JMSException {
    try {

      StringWriter writer = new StringWriter();
      MessageSet messageSet = toMessageSet(messages);

      saveContent(messageSet, writer);

      return writer.getBuffer().toString();
    } catch (Exception ex) {
View Full Code Here

    return rval;
  }

  public MessageSet toMessageSet(Collection messages) throws JMSException {
    try {
      MessageSet messageSet = factory.createMessageSet();

      for (Iterator iter = messages.iterator(); iter.hasNext();) {
        Message jmsMessage = (Message) iter.next();
        Entry entry = factory.createEntry();
        XMLMessage xmlMessage = createXMLMessage(factory, jmsMessage);

        if (xmlMessage instanceof XMLTextMessage) {
          entry.setType(XML_TEXT_MESSAGE);
          entry.setTextMessage((XMLTextMessage) xmlMessage);

        } else if (xmlMessage instanceof XMLMapMessage) {
          entry.setType(XML_MAP_MESSAGE);
          entry.setMapMessage((XMLMapMessage) xmlMessage);

        } else if (xmlMessage instanceof XMLObjectMessage) {
          entry.setType(XML_OBJECT_MESSAGE);
          entry.setObjectMessage((XMLObjectMessage) xmlMessage);
        } else if (xmlMessage instanceof XMLBytesMessage) {
          entry.setType(XML_BYTES_MESSGAE);
          entry.setBytesMessage((XMLBytesMessage) xmlMessage);

        }

        messageSet.getEntry().add(entry);
      }

      return messageSet;
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);
View Full Code Here

TOP

Related Classes of hermes.xml.MessageSet

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.