Interface ConnectMessage

All Superinterfaces:
Serializable
All Known Implementing Classes:
ConnectMessageImpl

public interface ConnectMessage extends Serializable
ConnectMessage is the object transferred between ConnectAgent components. Its main purpose is to couple the input and output of two ConnectAgent components with each other. Basically it is the interface between two ConnectAgent components.

A ConnectMessage contains Properties and one or more ConnectMessageParts. The Properties are used to register all kinds of Properties regarding this ConnectMessage like ConnectMessageID, timestamp and correllationId. The ConnectMessageParts contain the actual data to be transferred between components.

A new ConnectMessage automatically gets a unique connectmessageID and a connectmessageTimestamp property.

Author:
kgarstman
  • Method Details

    • getProperties

      Properties getProperties()
      Gets the Properties of this ConnectMessage
      Returns:
      The Properties of this ConnectMessage
    • setProperties

      void setProperties(Properties properties)
      Sets (and replaces!) the Properties of this ConnectMessage.
      Parameters:
      properties - The Properties object to insert into this ConnectMessage.
    • getParts

      Map<String,ConnectMessagePart<?>> getParts()
      Gets all ConnectMessageParts of this ConnectMessage.
      Returns:
      a map of all ConnectMessageParts indexed by part id.
    • setParts

      void setParts(Map<String,ConnectMessagePart<?>> parts)
      Sets (and replaces!) the ConnectMessageParts of this ConnectMessage.
      Parameters:
      parts - A Map of ConnectMessageParts
    • getPropertyValue

      @Deprecated Object getPropertyValue(Object key)
      Deprecated.
      Gets the value of a property as an Object. Property key will be searched in ConnectMessage properties. When not found the search will be extended to the properties of the contained ConnectMessageParts.
      Parameters:
      key - Name of the property to find
      Returns:
      The found value as an Object or null if not found
    • getMessagePropertyValue

      Object getMessagePropertyValue(Object key)
      Gets the value of a property as an Object. Property key will be searched in ConnectMessage properties only.
      Parameters:
      key - Name of the property to find
      Returns:
      The found value as an Object or null if not found
    • getStringPropertyValue

      @Deprecated String getStringPropertyValue(Object key)
      Deprecated.
      Gets the value of a property as a String.
      Parameters:
      key - Name of the property to find
      Returns:
      The found value as a String or an empty String if not found or value cannot be cast to String
      See Also:
    • getStringMessagePropertyValue

      String getStringMessagePropertyValue(Object key)
      Gets the value of a property as a String.
      Parameters:
      key - Name of the property to find
      Returns:
      The found value as a String or an empty String if not found or value cannot be cast to String
      See Also:
    • getPartById

      ConnectMessagePart<?> getPartById(String id)
      Gets the ConnectMessagePart identified by id in this ConnectMessage.
      Parameters:
      id - Name or id of the wanted ConnectMessagePart
      Returns:
      The requested ConnectMessagePart or null if not found.
    • getPartByPartNumber

      ConnectMessagePart<?> getPartByPartNumber(int partNumber)
      Gets the ConnectMessagePart with a certain partNumber. Each ConnectMessagePart gets a subsequent partNumber when it is stored in a ConnectMessage. PartNumbers start at 0 for the first ConnectMessagePart stored.
      Parameters:
      partNumber - The number of the part to retrieve.
      Returns:
      The ConnectMessagePart with partNumer or null when not found
    • addPart

      void addPart(String id, ConnectMessagePart<?> part)
      Parameters:
      id - PartId to store this ConnectMessagePart
      part - The ConnectMessagePart to add.
    • addPart

      void addPart(String id, ConnectMessagePart<?> part, boolean overwrite)
      Adds a ConnectMessagePart to this ConnectMessage. The ConnectMessagePart is mapped with the id into the ConnectMessage. The boolean defines if the ConnectMessagePart will be overwritten if it already exists.
      Parameters:
      id - PartId to store this ConnectMessagePart
      part - The ConnectMessagePart to add.
      overwrite - Defines the overwrite mode.
    • movePart

      void movePart(String oldId, String newId, boolean overwrite)
      Moves a ConnectMessagePart to another partId. The partId of a ConnectMessagePart is renamed. If the new partId already exists the overwrite boolean decides if the rename will actually occur.
      Parameters:
      oldId - partid of the existing ConnectMessagePart
      newId - new partId to rename the oldId
      overwrite - Defines the overwrite mode.
    • copyPart

      void copyPart(String oldId, String newId, boolean clone, boolean overwrite)
      Copies a ConnectMessagePart. The new ConnectMessagePart is stored under the newId. The copy of the part is NOT a clone but just a reference copy. The boolean decides if the copy will overwrite an existing ConnectMessagePart.
      Parameters:
      oldId - partid of the existing ConnectMessagePart
      newId - new partId to copy the exiting ConnectMessagePart to.
      clone - Defines if the content of the ConnectMessagePart will be cloned.
      overwrite - Defines the overwrite mode.
    • addProperty

      void addProperty(Object key, Object value)
      Adds a property to this ConnectMessage properties. If the property key already exists the old value will be overwritten.
      Parameters:
      key - Key name of the property
      value - Value of the property to add
    • addProperties

      void addProperties(Properties props)
      Adds all properties in props to this ConnectMessage properties. Any existing properties in ConnectMessage will be kept unless overwritten by the new properties in props.
      Parameters:
      props - Properties to add
    • addProperties

      void addProperties(Map<Object,Object> props)
      Adds all properties in a map to this ConnectMessage properties. Any existing properties in ConnectMessage will be kept unless overwritten by the new proprties in the map.
      Parameters:
      props - Map of properties to add
    • getNumberOfParts

      int getNumberOfParts()
      Gets the number of ConnectMessageParts in this ConnectMessage.
      Returns:
      The number of parts.
    • containsProperty

      @Deprecated boolean containsProperty(Object key)
      Deprecated.
      Tests if the specified key is a property in this ConnectMessage or any of its ConnectMessageParts.
      Parameters:
      key - The property key to test
      Returns:
      True if the property is found, false otherwise
    • containsMessageProperty

      boolean containsMessageProperty(Object key)
      Tests if the specified key is a property in this ConnectMessage.
      Parameters:
      key - The property key to test
      Returns:
      True if the property is found, false otherwise
    • getFirstPart

      ConnectMessagePart<?> getFirstPart()
      Gets the first (oldest) ConnectMessagePart. The part with partnumber 0 is the first part that was added to this ConnectMessage. Because parts can be removed and partnumbers can not be changed on ConnectMessageParts the first part will not automatically be part with partnumber 0.
      Returns:
      The ConnectMessagePart with the lowest partNumber
    • getLastPart

      ConnectMessagePart<?> getLastPart()
      Gets the last (newest) ConnectMessagePart.
      Returns:
      The ConnectMessagePart with the highest partNumber
    • toXML

      String toXML()
      Gets a simplified XML message of this ConnectMessage. Must only be used for logging purposes. The returned XML does not reflect the actual (JABX) XML reference of this ConnectMessage.
      Returns:
      The simplified XML message as a String