/** * Converts the message implementation into a String representation * * @param encoding The encoding to use when transforming the message (if necessary). The parameter * is used when converting from a byte array * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ public String getPayloadAsString(String encoding) throws Exception { if (encoding == null) { return adapter.getPayloadAsString(); } else { return adapter.getPayloadAsString(encoding); } }
public MuleMessage(Object message, UMOMessageAdapter previous) { if (message instanceof UMOMessageAdapter) { adapter = (UMOMessageAdapter) message; } else { adapter = new DefaultMessageAdapter(message, previous); } if (previous.getExceptionPayload() != null) { setExceptionPayload(previous.getExceptionPayload()); } setEncoding(previous.getEncoding()); if (previous.getAttachmentNames().size() > 0) { Set attNames = adapter.getAttachmentNames(); synchronized (attNames) { for (Iterator iterator = attNames.iterator(); iterator.hasNext(); ) { String s = (String) iterator.next(); try { addAttachment(s, adapter.getAttachment(s)); } catch (Exception e) { throw new MuleRuntimeException(new Message(Messages.FAILED_TO_READ_ATTACHMENT_X, s), e); } } } } }
/** * Determines how many messages are in the correlation group * * @param size the total messages in this group or -1 if the size is not known */ public void setCorrelationGroupSize(int size) { adapter.setCorrelationGroupSize(size); }
/** * Sets a double property on the event * * @param name the property name or key * @param value the property value */ public void setDoubleProperty(String name, double value) { adapter.setDoubleProperty(name, value); }
/** * Determines how many messages are in the correlation group * * @return total messages in this group or -1 if the size is not known */ public int getCorrelationGroupSize() { return adapter.getCorrelationGroupSize(); }
/** * Sets the encoding for this message * * @param encoding the encoding to use */ public void setEncoding(String encoding) { adapter.setEncoding(encoding); }
/** * Sets a String property on the event * * @param name the property name or key * @param value the property value */ public void setStringProperty(String name, String value) { adapter.setStringProperty(name, value); }
public void removeAttachment(String name) throws Exception { adapter.removeAttachment(name); }
public Set getAttachmentNames() { return adapter.getAttachmentNames(); }
public void setIntProperty(String name, int value) { adapter.setIntProperty(name, value); }
/** * Sets a correlationId for this message. The correlation Id can be used by components in the * system to manage message relations * * <p>transport protocol. As such not all messages will support the notion of a correlationId i.e. * tcp or file. In this situation the correlation Id is set as a property of the message where * it's up to developer to keep the association with the message. For example if the message is * serialised to xml the correlationId will be available in the message. * * @param id the Id reference for this relationship */ public void setCorrelationId(String id) { adapter.setCorrelationId(id); }
public boolean getBooleanProperty(String name, boolean defaultValue) { return adapter.getBooleanProperty(name, defaultValue); }
public void setBooleanProperty(String name, boolean value) { adapter.setBooleanProperty(name, value); }
public int getIntProperty(String name, int defaultValue) { return adapter.getIntProperty(name, defaultValue); }
public Object getProperty(String name, Object defaultValue) { return adapter.getProperty(name, defaultValue); }
public String getUniqueId() throws UniqueIdNotSupportedException { return adapter.getUniqueId(); }
public String toString() { return adapter.toString(); }
/** * Sets a correlationId for this message. The correlation Id can be used by components in the * system to manage message relations. * * <p>The correlationId is associated with the message using the underlying transport protocol. As * such not all messages will support the notion of a correlationId i.e. tcp or file. In this * situation the correlation Id is set as a property of the message where it's up to developer to * keep the association with the message. For example if the message is serialised to xml the * correlationId will be available in the message. * * @return the correlationId for this message or null if one hasn't been set */ public String getCorrelationId() { return adapter.getCorrelationId(); }
public void addAttachment(String name, DataHandler dataHandler) throws Exception { adapter.addAttachment(name, dataHandler); }
/** * Sets a replyTo address for this message. This is useful in an asynchronous environment where * the caller doesn't wait for a response and the response needs to be routed somewhere for * further processing. The value of this field can be any valid endpointUri url. * * @param replyTo the endpointUri url to reply to */ public void setReplyTo(Object replyTo) { adapter.setReplyTo(replyTo); }
public DataHandler getAttachment(String name) { return adapter.getAttachment(name); }
/** * Sets a replyTo address for this message. This is useful in an asynchronous environment where * the caller doesn't wait for a response and the response needs to be routed somewhere for * further processing. The value of this field can be any valid endpointUri url. * * @return the endpointUri url to reply to or null if one has not been set */ public Object getReplyTo() { return adapter.getReplyTo(); }
/** * Gets the encoding for the current message. For potocols that send encoding Information with the * message, this method should be overriden to expose the transport encoding, otherwise the * default encoding in the Mule configuration will be used * * @return the encoding for this message. This method must never return null */ public String getEncoding() { return adapter.getEncoding(); }
/** * Gets a property of the payload implementation * * @param key the key on which to lookup the property value * @return the property value or null if the property does not exist */ public Object getProperty(Object key) { return adapter.getProperty(key.toString()); }
/** * Gets a String property from the event * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ public String getStringProperty(String name, String defaultValue) { return adapter.getStringProperty(name, defaultValue); }
public void clearProperties() { adapter.clearProperties(); }
/** * Gets the sequence or ordering number for this message in the the correlation group (as defined * by the correlationId) * * @return the sequence number or -1 if the sequence is not important */ public int getCorrelationSequence() { return adapter.getCorrelationSequence(); }
/** * Gets a double property from the event * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ public double getDoubleProperty(String name, double defaultValue) { return adapter.getDoubleProperty(name, defaultValue); }
public Object removeProperty(Object key) { return adapter.removeProperty(key); }
/** * Gets the sequence or ordering number for this message in the the correlation group (as defined * by the correlationId) * * @param sequence the sequence number or -1 if the sequence is not important */ public void setCorrelationSequence(int sequence) { adapter.setCorrelationSequence(sequence); }