Exchange Manager methods, objects, and functions
Overview
The Exchange Manager, and its internal counterpart Internal Exchange Manager, is responsible for managing the exchanges. Most of the functionality runs around obtaining information for a given organization from a combination of Exchange Name, Home Community ID, Service Name, and API Spec versions. The exchange manager is also responsible for loading and reloading the exchangeInfo.xml and internalExchangeInfo.xml files. The exchange manager is mostly used internally to retrieve a URL to be used when making an external SOAP request to another exchange, or internally for client provided proxy services such as the secure/unsecure adapter webservice layers. The exchange manager also supports Exchange Overriding which allows an exchange to override specific endpoints for various services. CONNECT also supports Exchange Targeting, which allows the Entity message to specify a requested HCID, Exchange Name, and API Spec Version by providing a NhinTargetCommunities element inside of the SOAP request.
<urn:NhinTargetCommunities> <urn1:nhinTargetCommunity> <urn1:homeCommunity> <urn1:description>{HCID DESCRIPTION}</urn1:description> <urn1:homeCommunityId>{HCID}</urn1:homeCommunityId> <urn1:name>{HCID NAME}</urn1:name> </urn1:homeCommunity> </urn1:nhinTargetCommunity> <urn1:useSpecVersion>{SPEC VERSION}</urn1:useSpecVersion> <urn1:exchangeName>{EXCHANGE NAME}</urn1:exchangeName></urn:NhinTargetCommunities> </urn:NhinTargetCommunities>
It should be noted that this element is optional in Standard mode, but required in Passthrough Mode. The functionality of this element, however, remains the same regardless of a service being in Passthrough or Standard mode. When the Entity request contains this element, any values provided here will take precedence over the default behavior / lookups for any subsequent requests to external webservices. The request may contain any combination of nhinTargetCommunity (Required), useSpecVersion (Optional), and exchangeName (Optional). These values will be propagated into the NhinTargetSystemType, which is used as the primary reference for the Exchange Manager when looking up webservice URLs.
If the service is in Standard Mode and the NhinTargetCommunities is absent, the service will invoke a fan out request if the service supports it.
Methods
Most public methods from the Exchange Manager is either invoked internally (Exchange Manager calling methods within itself), via the WebServiceProxyHelper, or ExchangeManagerHelper. Every service, at one point, will have invoked the Exchange Manager in order to retrieve a given URL for the outbound messages when communicating with an external organization. This is often done by an exchange lookup via the targeted HCID, service name, and exchange name. If there is a targeted API Spec version specified by the Entity message, that would be included as well. The following contains a list of all of the public methods used, a brief explanation of its purpose, as well as any classes that may be invoking Exchange Manager directly.
- public void refreshExchangeCacheIfRequired() throws ExchangeManagerException;
- Refreshes the exchange cache if necessary
- Internally Used
- Refreshes the exchange cache if necessary
- public List<OrganizationType> getAllOrganizations() throws ExchangeManagerException;
- Gets a list of all organizations specified in the Exchange Info XML configuration
- Called via WebServiceProxyHelper
- Gets a list of all organizations specified in the Exchange Info XML configuration
- public List<OrganizationType> getAllOrganizations(String exchangeName) throws ExchangeManagerException;
- Gets a list of all organizations for a given exchange
- Internally used
- Gets a list of all organizations for a given exchange
- public OrganizationType getOrganization(String hcid) throws ExchangeManagerException;
- Gets an organization associated with the specified HCID
- Internally Used
- Used in DocumentQueryServiceImpl to get the highest API version.
- Gets an organization associated with the specified HCID
- public OrganizationType getOrganization(String exchangeName, String hcid) throws ExchangeManagerException;
- Gets an organization associated with the specified Exchange Name and HCID
- Internally used
- Gets an organization associated with the specified Exchange Name and HCID
- public Set<OrganizationType> getAllOrganizationSetByServiceName(String sUniformServiceName, String exchangeName) throws ExchangeManagerException;
- Gets a set of all organizations for a given exchange which contain the provided Service Name in a given Exchange.
- Internally used
- Gets a set of all organizations for a given exchange which contain the provided Service Name in a given Exchange.
- public List<NhincConstants.UDDI_SPEC_VERSION> getSpecVersions(String hcid, NhincConstants.NHIN_SERVICE_NAMES serviceName);
- Gets a list of all spec versions that the service supports for the given HCID.
- NhinEndpointManager: Used for OrchestrationContextFactory and PurposeOfForDecider
- Gets a list of all spec versions that the service supports for the given HCID.
- public String getEndpointURL(* * * * *) throws ExchangeManagerException;
- Convenience methods for changing which properties to select the URL by. Retrieves a given URL to be used as the destination of a SOAP request.
- Internally Used
- Convenience methods for changing which properties to select the URL by. Retrieves a given URL to be used as the destination of a SOAP request.
- public String getEndpointURL(String sServiceName) throws ExchangeManagerException;
- Returns a URL from the given service name
- EntityPatientDiscoveryProxyWebServicAbstract
- WebServiceProxyHelper
- Returns a URL from the given service name
- public String getEndpointURL(String sHomeCommunityId, String sServiceName, T apiSpec, String exchangeName) throws ExchangeManagerException;
- Returns a URL from the given HCID, service name, API spec, and exchange name
- Internally Used
- NhinDocQueryProxyWebServiceSecuredImpl
- NhinDocRetrieveProxyWebServiceSecuredImpl
- Returns a URL from the given HCID, service name, API spec, and exchange name
- public String getDefaultEndpointURL(String hcid, String sUniformServiceName, String exchangeName) throws ExchangeManagerException;
- Gets a default URL for a given HCID, Exchange, and Service name. This will be the highest version for the specified service.
- NhinPatientDsicoveryProxyWebServiceSecuredImpl
- Internally Used
- Gets a default URL for a given HCID, Exchange, and Service name. This will be the highest version for the specified service.
- public String getEndpointURLFromNhinTarget(NhinTargetSystemType targetSystem, String serviceName) throws ExchangeManagerException;
- Retrieves the URL for the service via a provided NhinTargetSystem type.
- Audit Transforms
- Internally used
- WebServiceProxyHelper
- PatientDiscoveryDeferredResponseAuditTransforms
- Retrieves the URL for the service via a provided NhinTargetSystem type.
- public List<UrlInfo> getEndpointURLFromNhinTargetCommunities(NhinTargetCommunitiesType targets, String serviceName) throws ExchangeManagerException;
- Retrieves the URL for the service via a provided NhinTargetCommunities type.
- DocumentQuery's AggregationService
- WebServiceProxyHelper
- StandardOutboundPatientDiscovery
- StandardOutboundPatientDiscoveryDeferredRequest
- StandardOutboundPatientDiscoveryDeferredResponse
- PatientDiscoveryDeferredResponseAuditTransforms
- AdapterPatientDiscoveryDeferredReqQueueOrchImpl
- AuditTransforms (Abstract Class)
- Retrieves the URL for the service via a provided NhinTargetCommunities type.
- public String getDefaultExchange();
- Retrieves the default exchange from the Exchange Info configuration
- Used Internally
- During creation of a CONNECT Clients
- Retrieves the default exchange from the Exchange Info configuration
- public Optional<String> getSNIServerName(String exchangeName);
- Returns the configured SNI Server Name for a given exchange
- Used internally for TLS configurations inside of the CXF endpoint decorators
- Returns the configured SNI Server Name for a given exchange
Objects
- EndpointConfiguration - Schema mapping for a given endpoint to be used for an organization's service. Specifies the URL and API Spec Version.
- OrganizationType - Schema mapping for a given Organization. Holds the Name, HCID, Type, Status, Description, Contact/Address information, endpoint configuration list (EndpointConfiguration), and the target region.
- ExchangeType - Schema mapping for a given Exchange. Holds the name, certificate alias to be used for HTTPS, SNI Name, URL, tlsVersion, whether or not it is disabled, the time the exchange was last updated, and a list of organizations (OrganizationType).
- ExchangeInfoType - Schema mapping for the root element of the exchange info. This holds the refresh interval, max number of backups, the default exchange to use, and a list of all the exchanges (ExchangeType)
Example Workflow for PD
This example assumes that PD is in Passthrough Mode. In this case, NhinTargetcommunities is required to be present in the Entity message.
Entity Layer:
- Converts NhinTargetCommunities to NhinTargetSystemType to be used in all future requests.
- Invokes OutboundPatientDiscoveryStrategyImpl
- Gets the URL from the NhinTargetSystemType and Service Name.
- Sets the URL on the NhinTargetSystemType to be used later.
- Invokes Nhin Webservice Proxy Class. (NhinPatientDiscoveryProxyWebServiceSecuredImpl.java)
- Attempts to use the URL provided in the NhinTargetSystemType if it is not NULL, otherwise retrieves Default URL from the HCID, ServiceName, and Exchange Name.
- Creates a CONNECT CXF Client with the returned URL (*See Connect Client flow below).
- Invokes the Nhin webservice via the CXF Client.
Nhin Layer:
- Processes requests and invokes the MPI Adapter Proxy
- Gets the URL from the Adapter Endpoint, which uses the Service Name and Highest API Level.
- Creates a CONNECT CXF Client with the returned URL(*See Connect Client flow below).
- Invokes the Adapter webservice via the CXF Client.
Adapter Layer:
- Processes request, and returns a response, which bubbles up to the previous layers.
CONNECT CXF Client:
- If a targeted exchange was provided via the NhinTargetSystemType, the exchange name will be used as the exchange for future requests.
- If the targeted exchange was *not* provided via a NhinTargetSystemType, the default exchange will be used.