com.ibm.mq.headers

Class MQHeaderRegistry

  1. java.lang.Object
  2. extended bycom.ibm.mq.jmqi.JmqiObject
  3. extended bycom.ibm.mq.headers.MQHeaderRegistry
All implemented interfaces:
MQHeaderFactory.Registry

  1. public class MQHeaderRegistry
  2. extends com.ibm.mq.jmqi.JmqiObject
  3. implements MQHeaderFactory.Registry
The MQHeaderRegistry provides resources for decoding or instantiating header instances. The registry associates message formats and header types with MQHeaderFactories that can decode or create headers. Most applications will not have to use this class directly. The MQHeaderIterator and MQHeaderList classes use the default header registry as the basis for their capabilities, and this is pre-registered with the standard MQ message formats and header types. The default header registry can be obtained directly using the getDefault method on this class.

Applications may register additional MQHeaderFactory instances in the default registry, for example, if new MQ or application header types are devised. As a convenience, new MQHeader types can be registered directly without supplying an MQHeaderFactory instance, as long as each header type is associated one-to-one with a format. (For most existing headers, this is the case; but it is not true of PCF, for example.)

As an alternative to updating the default registry, applications can create their own MQHeaderRegistry instances and customize their contents, for example to handle custom application-defined formats. An MQHeaderIterator can be created from any MQHeaderRegistry using the createIterator method.

See Also:
MQHeaderIterator, MQHeaderList, MQHeaderFactory

Field Summary

Fields inherited from class com.ibm.mq.jmqi.JmqiObject
COMP_JM, COMP_JN, COMP_JO

Method Summary

Modifier and Type Method and Description
  1. MQHeaderIterator
createIterator(java.io.DataInput message)
Returns an MQHeaderIterator capable of decoding messages of formats known to this registry.
  1. MQHeaderIterator
createIterator(java.io.DataInput message,java.lang.String format,int encoding,int characterSet)
Returns an MQHeaderIterator capable of decoding messages of formats known to this registry.
  1. static
  2. MQHeaderRegistry
getDefault()
Returns the default (singleton) MQHeaderRegistry instance.
  1. MQHeaderFactory
getFactoryForFormat(java.lang.String format)
  1. MQHeaderFactory
getFactoryForType(java.lang.String type)
  1. java.util.Collection
getRegisteredFormats()
Returns the set of formats registered in this registry instance.
  1. java.util.Collection
getRegisteredTypes()
Returns the set of header types supported by this registry instance.
  1. void
register(MQHeaderFactory factory)
  1. void
register(java.lang.String format,java.lang.String type,java.lang.Class headerClass)
Registers a new header type associated with a particular format.
  1. void
register(java.lang.String format,java.lang.String type,java.lang.String className)
Registers a new header type associated with a particular format.
  1. java.lang.String
toString()
Returns the string representation of the class instance
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Method Detail

getDefault

  1. public static MQHeaderRegistry getDefault( )
Returns the default (singleton) MQHeaderRegistry instance.

getFactoryForFormat

  1. public MQHeaderFactory getFactoryForFormat( java.lang.String format)
Description copied from interface: MQHeaderFactory.Registry
Returns an MQHeaderFactory associated with the specified format.
Specified by:

getFactoryForType

  1. public MQHeaderFactory getFactoryForType( java.lang.String type)
Description copied from interface: MQHeaderFactory.Registry
Returns an MQHeaderFactory that supports the specified header type.
Specified by:

register

  1. public void register(MQHeaderFactory factory)
Description copied from interface: MQHeaderFactory.Registry
Registers an MQHeaderFactory.
Specified by:

register

  1. public void register(java.lang.String format,
  2. java.lang.String type,
  3. java.lang.Class headerClass)
Registers a new header type associated with a particular format. The header class must implement MQHeader. If multiple registrations with the same format or type are made, the last one wins.

register

  1. public void register(java.lang.String format,
  2. java.lang.String type,
  3. java.lang.String className)
  4. throws java.lang.ClassNotFoundException
Registers a new header type associated with a particular format. The named class must implement MQHeader. If multiple registrations with the same format or type are made, the last one wins.
Parameters:
className - the name of the class which implements the header.
Throws:
java.lang.ClassNotFoundException

getRegisteredFormats

  1. public java.util.Collection getRegisteredFormats( )
Returns the set of formats registered in this registry instance.
Specified by:

getRegisteredTypes

  1. public java.util.Collection getRegisteredTypes( )
Returns the set of header types supported by this registry instance.
Specified by:

createIterator

  1. public MQHeaderIterator createIterator( java.io.DataInput message)
Returns an MQHeaderIterator capable of decoding messages of formats known to this registry.
Parameters:
message - the message.

createIterator

  1. public MQHeaderIterator createIterator( java.io.DataInput message,
  2. java.lang.String format,
  3. int encoding,
  4. int characterSet)
Returns an MQHeaderIterator capable of decoding messages of formats known to this registry.
Parameters:
message - the message.
encoding - the numeric encoding. see (CMQC.MQENC_* for values).
characterSet - the Coded Character Set Identifier.

toString

  1. public java.lang.String toString( )
Returns the string representation of the class instance
Overrides:
toString in class java.lang.Object
Returns:
The string representation
See Also:
Object.toString()