Class ImaJmsObject


  • public class ImaJmsObject
    extends Object
    Utilities for IBM MessageSight JMS client objects. These static methods are designed to be used for problem determination when working with IBM MessageSight JMS client applications. JMS applications should normally avoid using provider specific methods, but it might be necessary to use these when developing IBM MessageSight JMS client applications or when doing provider specific error handling.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String COPYRIGHT  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImaJmsObject()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int bodySize​(javax.jms.Message msg)
      Return the size in bytes of the message body.
      static String getClientVerstion()
      Gets the IBM MessageSight JMS client version.
      static ImaProperties getProperties​(Object obj)
      Gets the properties for an IBM MessageSight JMS client object.
      static String toString​(Object obj, String details)
      Return a string form of an IBM MessageSight JMS client object with details.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImaJmsObject

        public ImaJmsObject()
    • Method Detail

      • toString

        public static String toString​(Object obj,
                                      String details)
        Return a string form of an IBM MessageSight JMS client object with details. This method is designed to be used for problem determination on IBM MessageSight JMS client object and allows the level of detail to be specified. This can be called on any object and returns the normal toString() for other objects.

        These detailed strings are designed to be viewed by humans to help in problem determination and might not be fully parsable. They are also not guaranteed to remain the same over time. All information in the detailed string is available using the public interfaces to the IBM MessageSight JMS client but show implementation details which are not part of the JMS interfaces and which are likely to change from release to release.

        The detailed strings are in the form:

             class@hashcode info=value details=value links=value properties=value
         
        The class name is the implementation class name for the object which is commonly the JMS interface name with the string "Ima" prepended. These classes commonly implement both the Topic and Queue messaging domains. The hashcode is shown to allow the unique object to be determined.

        Each of the sections info, details, and links consists of a set of key=value pairs. If an item is not set or has a default value the key=value is not shown and the entire section can be missing. Not all sections are available for all objects.

        The properties sections consists of the keyword properties and the value which is the toString() of a Java properties object.

        Newlines may be added to the string to increase readability.

        The details string is a set of characters each of which define the presence of one of the sections. All sections are optional. Additional codes are reserved for future use but are not checked. The following codes can be set:

        c
        The class name of the implementation class
        h
        The hashCode in hex starting with an at sign (@)
        i
        The info section contains common information
        d
        The details section contains more detailed information
        l
        The links section contains links to other objects
        p
        The properties sections contains the properties of the object
        *
        Show all sections
        Parameters:
        obj - The object to show.
        details - The details string
        Returns:
        A string representing detailed information about the object.
      • bodySize

        public static int bodySize​(javax.jms.Message msg)
        Return the size in bytes of the message body. Not all JMS message types can return the size of the body. This allows the body size to be returned for all IBM MessageSight JMS client messages. The size is the number of bytes used to send the body of the message and does not include the size of the header or properties. This is designed to be used for problem determination.

        If the body is null a size of -1 is returned.

        Parameters:
        msg - The message which must be an IBM MessageSight JMS client message
        Returns:
        The size in bytes of the payload or -1 if the payload is null.
        Throws:
        ClassCastException - If the message is not an IBM MessageSight message
      • getProperties

        public static ImaProperties getProperties​(Object obj)
        Gets the properties for an IBM MessageSight JMS client object.

        This method works for objects which implement the ImaProperties interface. The objects with properties which are not administered objects (including the IBM MessageSight JMS client implementations of Connection, Session, MessageConsumer, and MessageProducer) return read only properties. Only user properties can be modified in these objects.

        This is just a convenience method as it simply casts the object to ImaProperties. The invoker should make sure that the object is an instance of ImaProperties before using this method.

        Parameters:
        obj - The object from which to return the properties.
        Returns:
        The properties for the object
        Throws:
        ClassCastException - if the object does not implement ImaProperties (RuntimeException)
      • getClientVerstion

        public static String getClientVerstion()
        Gets the IBM MessageSight JMS client version.

        This method returns the IBM MessageSight client version.

        Returns:
        The client version