public class ApplicationRouterImpl extends Object implements ApplicationRouter
A default implementation of ApplicationRouter
ApplicationRouter.AppRoutingData| Modifier and Type | Field and Description |
|---|---|
static String |
RAW_MESSAGE_KEY
Key under which raw message text is stored in metadata Map sent to
ReceivingApplications. |
METADATA_KEY_MESSAGE_CHARSET, METADATA_KEY_MESSAGE_CONTROL_ID, METADATA_KEY_SENDING_IP| Constructor and Description |
|---|
ApplicationRouterImpl()
Creates an instance that uses a
GenericParser. |
ApplicationRouterImpl(Parser theParser)
Creates an instance that uses the specified
Parser. |
| Modifier and Type | Method and Description |
|---|---|
void |
bindApplication(ApplicationRouter.AppRoutingData theRoutingData,
ReceivingApplication theApplication)
Associates the given application with the given message parameters, so that messages
with matching parameters will be sent there.
|
void |
disableBinding(ApplicationRouter.AppRoutingData theRoutingData)
Temporarily deactivates the binding on the given field data, if present.
|
void |
enableBinding(ApplicationRouter.AppRoutingData theRoutingData)
Undoes
disableBinding(AppRoutingData theRoutingData). |
Parser |
getParser() |
boolean |
hasActiveBinding(ApplicationRouter.AppRoutingData theRoutingData) |
String |
logAndMakeErrorMessage(Exception e,
Segment inHeader,
Parser p,
String encoding)
Logs the given exception and creates an error message to send to the
remote system.
|
static boolean |
matches(ApplicationRouter.AppRoutingData theMessageData,
ApplicationRouter.AppRoutingData theReferenceData) |
Transportable |
processMessage(Transportable theMessage)
Attempts to route the given message to the associated
Application
and obtain a response. |
void |
setExceptionHandler(ReceivingApplicationExceptionHandler theExceptionHandler)
Sets an exception handler which will be invoked in the event of a
failure during parsing, processing, or encoding of an
incoming message or its response.
|
public static String RAW_MESSAGE_KEY
ReceivingApplications.public ApplicationRouterImpl()
GenericParser.public ApplicationRouterImpl(Parser theParser)
Parser.theParser - the parser used for converting between Message and
Transportablepublic Transportable processMessage(Transportable theMessage) throws HL7Exception
ApplicationRouterApplication
and obtain a response.processMessage in interface ApplicationRoutertheMessage - the message to routeHL7ExceptionApplicationRouter.processMessage(ca.uhn.hl7v2.protocol.Transportable)public boolean hasActiveBinding(ApplicationRouter.AppRoutingData theRoutingData)
hasActiveBinding in interface ApplicationRoutertheRoutingData - message fields used in determining the appropriate destinationApplicationRouter.hasActiveBinding(ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData)public void bindApplication(ApplicationRouter.AppRoutingData theRoutingData, ReceivingApplication theApplication)
ApplicationRouterAssociates the given application with the given message parameters, so that messages with matching parameters will be sent there. Only one application can be registered for a given set of parameters: repeated registration for a particular combination over-writes the previous one.
Because of wildcards, there may be multiple registrations that match a given message. In this case, the first registered wins.
bindApplication in interface ApplicationRoutertheRoutingData - message fields used in determining the appropriate destinationtheApplication - the application to which messages with these parameters should be
sentApplicationRouter.bindApplication(
ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData, ca.uhn.hl7v2.protocol.ReceivingApplication)public void disableBinding(ApplicationRouter.AppRoutingData theRoutingData)
ApplicationRouterdisableBinding in interface ApplicationRoutertheRoutingData - the fields that define a set of messages that are bound to
some ApplicationApplicationRouter.disableBinding(ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData)public void enableBinding(ApplicationRouter.AppRoutingData theRoutingData)
ApplicationRouterdisableBinding(AppRoutingData theRoutingData).enableBinding in interface ApplicationRoutertheRoutingData - the fields that define a set of messages that are bound to
some ApplicationApplicationRouter.enableBinding(ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData)public Parser getParser()
getParser in interface ApplicationRouterParser that is used to parse inbound messages
and encode outbound ones. It may be of interest to set certain parameters
of this parser.ApplicationRouter.getParser()public void setExceptionHandler(ReceivingApplicationExceptionHandler theExceptionHandler)
setExceptionHandler in interface ApplicationRouterpublic static boolean matches(ApplicationRouter.AppRoutingData theMessageData, ApplicationRouter.AppRoutingData theReferenceData)
theMessageData - routing data related to a particular messagetheReferenceData - routing data related to a binding, which may include
wildcardsexact - if true, each field must match exactlypublic String logAndMakeErrorMessage(Exception e, Segment inHeader, Parser p, String encoding) throws HL7Exception
encoding - The encoding for the error message. If null, uses
default encodingHL7ExceptionCopyright © 2001-2013 University Health Network. All Rights Reserved.