com.ibm.mq.headers
Class MQHeaderRegistry
- java.lang.Object
-
- com.ibm.mq.jmqi.JmqiObject
-
- com.ibm.mq.headers.MQHeaderRegistry
-
- All Implemented Interfaces:
- MQHeaderFactory.Registry
public class MQHeaderRegistry extends com.ibm.mq.jmqi.JmqiObject 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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description MQHeaderIterator
createIterator(java.io.DataInput message)
MQHeaderIterator
createIterator(java.io.DataInput message, java.lang.String format, int encoding, int characterSet)
static MQHeaderRegistry
getDefault()
MQHeaderFactory
getFactoryForFormat(java.lang.String format)
MQHeaderFactory
getFactoryForType(java.lang.String type)
java.util.Collection<?>
getRegisteredFormats()
java.util.Collection<?>
getRegisteredTypes()
void
register(MQHeaderFactory factory)
Registers an MQHeaderFactory.void
register(java.lang.String format, java.lang.String type, java.lang.Class<?> headerClass)
void
register(java.lang.String format, java.lang.String type, java.lang.String className)
java.lang.String
toString()
-
-
-
Method Detail
-
getDefault
public static MQHeaderRegistry getDefault()
- Returns:
- the default (singleton) MQHeaderRegistry instance.
-
getFactoryForFormat
public MQHeaderFactory getFactoryForFormat(java.lang.String format)
- Specified by:
getFactoryForFormat
in interfaceMQHeaderFactory.Registry
- Returns:
- an MQHeaderFactory associated with the specified format.
- See Also:
MQHeaderFactory.Registry.getFactoryForFormat(java.lang.String)
-
getFactoryForType
public MQHeaderFactory getFactoryForType(java.lang.String type)
- Specified by:
getFactoryForType
in interfaceMQHeaderFactory.Registry
- Returns:
- an MQHeaderFactory that supports the specified header type.
- See Also:
MQHeaderFactory.Registry.getFactoryForType(java.lang.String)
-
register
public void register(MQHeaderFactory factory)
Description copied from interface:MQHeaderFactory.Registry
Registers an MQHeaderFactory.- Specified by:
register
in interfaceMQHeaderFactory.Registry
- See Also:
MQHeaderFactory.Registry.register(com.ibm.mq.headers.MQHeaderFactory)
-
register
public void register(java.lang.String format, java.lang.String type, java.lang.Class<?> headerClass)
- Parameters:
format
-type
-headerClass
-
-
register
public void register(java.lang.String format, java.lang.String type, java.lang.String className) throws java.lang.ClassNotFoundException
- Parameters:
format
-type
-className
-- Throws:
java.lang.ClassNotFoundException
-
getRegisteredFormats
public java.util.Collection<?> getRegisteredFormats()
- Specified by:
getRegisteredFormats
in interfaceMQHeaderFactory.Registry
- Returns:
- the set of formats supported by the registered MQHeaderFactories.
- See Also:
MQHeaderFactory.Registry.getRegisteredFormats()
-
getRegisteredTypes
public java.util.Collection<?> getRegisteredTypes()
- Specified by:
getRegisteredTypes
in interfaceMQHeaderFactory.Registry
- Returns:
- the set of header types supported by the registered MQHeaderFactories.
- See Also:
MQHeaderFactory.Registry.getRegisteredTypes()
-
createIterator
public MQHeaderIterator createIterator(java.io.DataInput message)
- Parameters:
message
- the message.- Returns:
- an MQHeaderIterator capable of decoding messages of formats known to this registry.
-
createIterator
public MQHeaderIterator createIterator(java.io.DataInput message, java.lang.String format, int encoding, int characterSet)
- Parameters:
message
- the message.format
-encoding
- the numeric encoding. see (CMQC.MQENC_* for values).characterSet
- the Coded Character Set Identifier.- Returns:
- an MQHeaderIterator capable of decoding messages of formats known to this registry.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation of the class instance
- See Also:
Object.toString()
-
-