Class JmsMessagePropertyIntercepter


  • public class JmsMessagePropertyIntercepter
    extends Object
    Utility class used to intercept calls to Message property gets and sets and map the correct fields in the underlying JmsMessageFacade to the property name being operated on.
    • Constructor Detail

      • JmsMessagePropertyIntercepter

        public JmsMessagePropertyIntercepter()
    • Method Detail

      • getProperty

        public static Object getProperty​(JmsMessage message,
                                         String name)
                                  throws javax.jms.JMSException
        Static get method that takes a property name and gets the value either via a registered property get object or through the JmsMessageFacade getProperty method.
        Parameters:
        message - the JmsMessage instance to read from
        name - the property name that is being requested.
        Returns:
        the correct value either mapped to an Message attribute of a Message property.
        Throws:
        javax.jms.JMSException - if an error occurs while reading the defined property.
      • setProperty

        public static void setProperty​(JmsMessage message,
                                       String name,
                                       Object value)
                                throws javax.jms.JMSException
        Static set method that takes a property name and sets the value either via a registered property set object or through the JmsMessageFacade setProperty method.
        Parameters:
        message - the JmsMessage instance to write to.
        name - the property name that is being written.
        value - the new value to assign for the named property.
        Throws:
        javax.jms.JMSException - if an error occurs while writing the defined property.
      • propertyExists

        public static boolean propertyExists​(JmsMessage message,
                                             String name)
                                      throws javax.jms.JMSException
        Static inspection method to determine if a named property exists for a given message.
        Parameters:
        message - the JmsMessage instance to read from
        name - the property name that is being inspected.
        Returns:
        true if the message contains the given property.
        Throws:
        javax.jms.JMSException - if an error occurs while validating the defined property.
      • clearProperties

        public static void clearProperties​(JmsMessage message,
                                           boolean excludeStandardJMSHeaders)
                                    throws javax.jms.JMSException
        For each of the currently configured message property intercepter instances clear or reset the value to its default. Once complete the method will direct the given provider message facade to clear any message properties that might have been set.
        Parameters:
        message - the JmsMessage instance to read from
        excludeStandardJMSHeaders - whether the standard JMS header names should be excluded from the returned set
        Throws:
        javax.jms.JMSException - if an error occurs while validating the defined property.
      • getAllPropertyNames

        public static Set<String> getAllPropertyNames​(JmsMessage message)
                                               throws javax.jms.JMSException
        For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned.
        Parameters:
        message - the JmsMessage instance to read property names from.
        Returns:
        a Set<String> containing the names of all intercepted properties.
        Throws:
        javax.jms.JMSException - if an error occurs while gathering the message property names.
      • getPropertyNames

        public static Set<String> getPropertyNames​(JmsMessage message,
                                                   boolean excludeStandardJMSHeaders)
                                            throws javax.jms.JMSException
        For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned if the property has a value and is available for a read operation. The Set returned may be manipulated by the receiver without impacting the facade, and an empty set will be returned if there are no matching properties.
        Parameters:
        message - the JmsMessage instance to read from
        excludeStandardJMSHeaders - whether the standard JMS header names should be excluded from the returned set
        Returns:
        a Set<String> containing the names of all intercepted properties with a value.
        Throws:
        javax.jms.JMSException - if an error occurs while gathering the message property names.