com.ibm.mq.headers
Interface MQHeaderFactory
All known implementing classes:
- public interface MQHeaderFactory
An individual MQHeaderFactory may handle a single message format or more than one. MQHeaderFactories are registered with a Registry that allows them to be looked up by format or type. The default MQHeaderRegistry instance has pre-registered factories for the standard MQ header types and formats, including PCF.
See Also:
Nested Class Summary
Modifier and Type | Interface and Description |
---|---|
|
MQHeaderFactory.Registry
Interface representing a registry for MQHeaderFactories and their supported types and formats.
|
Method Summary
Modifier and Type | Method and Description |
---|---|
create(java.lang.String type)
Creates an MQHeader instance of the named type.
|
|
decode(MQHeaderContext message)
Decodes (parses) an MQHeader instance from a message.
|
|
|
getSupportedFormats()
Returns the set of format names associated with the header types supported by this
MQHeaderFactory.
|
|
getSupportedTypes()
Returns the set of header types supported by this MQHeaderFactory.
|
Method Detail
create
- MQHeader create(java.lang.String type)
- throws java.lang.InstantiationException
Creates an MQHeader instance of the named type. The types known the header factory can be
obtained from the getSupportedTypes method. These types correspond to the values returned by
the type method on MQHeader instances.
Throws:
java.lang.InstantiationException
decode
- MQHeader decode(MQHeaderContext message)
- throws java.lang.Exception
- MQDataException
- java.io.IOException
Decodes (parses) an MQHeader instance from a message. The message context object carries the
format, encoding and CCSID associated with the current position in the message or byte stream.
The operation of an MQHeaderFactory to fulfil this method is essentially:
- Identify the header type that occurs next in the message. This may be known by the factory directly, and associated with the format; or the MQHeaderFactory may need to peek at the message content to detect the type.
- Having identified the correct type, instantiate an MQHeader instance of that type.
- Invoke the header object's read method on the message.
- Optionally, update the format, encoding and characterSet members of the message context object.
- Return the header instance.
Parameters:
message
- the header context. Throws:
java.lang.Exception
- (to allow the com.ibm.pcf classes to throw MQException) java.io.IOException
getSupportedFormats
- java.util.Collection getSupportedFormats( )
Returns the set of format names associated with the header types supported by this
MQHeaderFactory. An MQHeaderFactory instance is capable of decoding messages of these formats.
getSupportedTypes
- java.util.Collection getSupportedTypes( )
Returns the set of header types supported by this MQHeaderFactory. An MQHeaderFactory instance
can create new instances of these types.