com.ibm.mq.headers
Interface MQHeaderFactory
-
- All Known Implementing Classes:
- PCFHeaderFactory, PCFHeaderFactory
public interface MQHeaderFactoryAn MQHeaderFactory is used to create new MQHeader instances dynamically. This is used when decoding (parsing) header content in messages, or for tasks such as creating new header instances in tooling applications. A tooling application may, for example, offer a catalog of header types that can be used to compose a message. Most applications will not need to use the MQHeaderFactory interface directly; the MQHeaderRegistry encapsulates a set of MQHeaderFactory instances that cover the standard MQ header types, and new header types can be registered directly without needing to define a new MQHeaderFactory type.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:
MQHeaderRegistry,MQHeaderIterator
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static interfaceMQHeaderFactory.RegistryInterface representing a registry for MQHeaderFactories and their supported types and formats.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description MQHeadercreate(java.lang.String type)MQHeaderdecode(MQHeaderContext message)Decodes (parses) an MQHeader instance from a message.java.util.Collection<?>getSupportedFormats()java.util.Collection<?>getSupportedTypes()
-
-
-
Method Detail
-
create
MQHeader create(java.lang.String type) throws java.lang.InstantiationException
- Parameters:
type-- Returns:
- 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.- Returns:
- the parsed MQHeader
- Throws:
java.lang.Exception- (to allow the com.ibm.pcf classes to throw MQException)MQDataExceptionjava.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.
-
-