net.sf.xbus.protocol
Class MessageFactory
java.lang.Object
net.sf.xbus.protocol.MessageFactory
public class MessageFactory
- extends java.lang.Object
The class MessageFactory
is used to dynamically create
messages. It implements the Factory Design-Pattern.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TRANSFORM_FROM_REQUEST
public static final int TRANSFORM_FROM_REQUEST
- See Also:
- Constant Field Values
TRANSFORM_FROM_RESPONSE
public static final int TRANSFORM_FROM_RESPONSE
- See Also:
- Constant Field Values
MessageFactory
public MessageFactory()
createApplicationMessage
public static Message createApplicationMessage(XBUSSystem source)
throws XException
- The appropriate
Message
-object for the given source will
be created. The name of the appropriate Message
class is
read from the Configuration
.
- Parameters:
source
- the name of the system, from which the message was received
- Throws:
XException
transformResponse2Response
public static void transformResponse2Response(XBUSSystem source,
XBUSSystem destination,
Message sourceMessage,
Message destinationMessage)
throws XException
- Transforms the response of a source message to the response of a
destination message.
- Parameters:
source
- the system name where the response of the source message is
coming fromdestination
- the system name where the response of the destination
message shall be sent tosourceMessage
- the Message
from which the response
to transform is taken.destinationMessage
- the Message
whose response is
filled
- Throws:
XException
createSenderMessage
public static Message createSenderMessage(XBUSSystem destination,
Message sourceMessage,
int convertFrom)
throws XException
- The appropriate
Message
object which is needed to send a
message to the given destination will be created. At this point either
the request or the response of the incoming Message
will
be converted to the request of the outgoing Message
.
- Parameters:
destination
- the name of the system where the message will be send
tosourceMessage
- the Message
from which the new
Message
will be initializedconvertFrom
- flag wether the request or the response of the
sourceMessage is used to fill the request of the new
Message
- Throws:
XException