ca.uhn.hl7v2.protocol.impl
Class ApplicationRouterImpl

java.lang.Object
  extended by ca.uhn.hl7v2.protocol.impl.ApplicationRouterImpl
All Implemented Interfaces:
ApplicationRouter

public class ApplicationRouterImpl
extends java.lang.Object
implements ApplicationRouter

A default implementation of ApplicationRouter

Note that ParseChecker is used for each inbound message, iff the system property ca.uhn.hl7v2.protocol.impl.check_parse = "TRUE".

Version:
$Revision: 1.2 $ updated on $Date: 2009/09/01 00:22:23 $ by $Author: jamesagnew $
Author:
Bryan Tripp

Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.uhn.hl7v2.protocol.ApplicationRouter
ApplicationRouter.AppRoutingData
 
Field Summary
static java.lang.String RAW_MESSAGE_KEY
          Key under which raw message text is stored in metadata Map sent to ReceivingApplications.
 
Constructor Summary
ApplicationRouterImpl()
          Creates an instance that uses a GenericParser.
ApplicationRouterImpl(Parser theParser)
          Creates an instance that uses the specified Parser.
 
Method Summary
 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)
           
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RAW_MESSAGE_KEY

public static java.lang.String RAW_MESSAGE_KEY
Key under which raw message text is stored in metadata Map sent to ReceivingApplications.

Constructor Detail

ApplicationRouterImpl

public ApplicationRouterImpl()
Creates an instance that uses a GenericParser.


ApplicationRouterImpl

public ApplicationRouterImpl(Parser theParser)
Creates an instance that uses the specified Parser.

Parameters:
theParser - the parser used for converting between Message and Transportable
Method Detail

processMessage

public Transportable processMessage(Transportable theMessage)
                             throws HL7Exception
Description copied from interface: ApplicationRouter
Attempts to route the given message to the associated Application and obtain a response.

Specified by:
processMessage in interface ApplicationRouter
Parameters:
theMessage - the message to route
Returns:
the response message (this may be null, for example if the given message doesn't require an application ACK)
Throws:
HL7Exception
See Also:
ApplicationRouter.processMessage(ca.uhn.hl7v2.protocol.Transportable)

hasActiveBinding

public boolean hasActiveBinding(ApplicationRouter.AppRoutingData theRoutingData)
Specified by:
hasActiveBinding in interface ApplicationRouter
Parameters:
theRoutingData - message fields used in determining the appropriate destination
Returns:
true if there is a destination application for messages with the given characteristics
See Also:
ApplicationRouter.hasActiveBinding(ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData)

bindApplication

public void bindApplication(ApplicationRouter.AppRoutingData theRoutingData,
                            ReceivingApplication theApplication)
Description copied from interface: ApplicationRouter

Associates 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.

Specified by:
bindApplication in interface ApplicationRouter
Parameters:
theRoutingData - message fields used in determining the appropriate destination
theApplication - the application to which messages with these parameters should be sent
See Also:
ApplicationRouter.bindApplication( ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData, ca.uhn.hl7v2.protocol.ReceivingApplication)

disableBinding

public void disableBinding(ApplicationRouter.AppRoutingData theRoutingData)
Description copied from interface: ApplicationRouter
Temporarily deactivates the binding on the given field data, if present.

Specified by:
disableBinding in interface ApplicationRouter
Parameters:
theRoutingData - the fields that define a set of messages that are bound to some Application
See Also:
ApplicationRouter.disableBinding(ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData)

enableBinding

public void enableBinding(ApplicationRouter.AppRoutingData theRoutingData)
Description copied from interface: ApplicationRouter
Undoes disableBinding(AppRoutingData theRoutingData).

Specified by:
enableBinding in interface ApplicationRouter
Parameters:
theRoutingData - the fields that define a set of messages that are bound to some Application
See Also:
ApplicationRouter.enableBinding(ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData)

getParser

public Parser getParser()
Specified by:
getParser in interface ApplicationRouter
Returns:
the Parser that is used to parse inbound messages and encode outbound ones. It may be of interest to set certain parameters of this parser.
See Also:
ApplicationRouter.getParser()

matches

public static boolean matches(ApplicationRouter.AppRoutingData theMessageData,
                              ApplicationRouter.AppRoutingData theReferenceData)
Parameters:
theMessageData - routing data related to a particular message
theReferenceData - routing data related to a binding, which may include wildcards
exact - if true, each field must match exactly
Returns:
true if the message data is consist with the reference data, ie all values either match or are wildcards in the reference


Copyright © 2001-2011 University Health Network. All Rights Reserved.