public interface HapiContext extends Closeable
ExecutorService
: thread executors used for the HAPI networking features in
ca.uhn.hl7v2.app
LowerLayerProtocol
: MLLP protocol used for the HAPI networking features in
ca.uhn.hl7v2.app
SocketFactory
: Socket factory used for the HAPI networking features in
ca.uhn.hl7v2.app
ParserConfiguration
: detail configuration for all HL7 parsers
ModelClassFactory
: lookup for message model classes during parsing or message
creation
ValidationContext
: validation rules used during parsing or during a dedcated
validation step
ValidationRuleBuilder
: alternative way of providing a ValidationContext
ValidationExceptionHandlerFactory
: factory for exception handler used during message validation
Modifier and Type | Method and Description |
---|---|
CodeStoreRegistry |
getCodeStoreRegistry() |
Validator |
getConformanceValidator()
Returns a ca.uhn.hl7v2.conf.check.Validator instance.
|
ConnectionHub |
getConnectionHub()
Deprecated.
|
ExecutorService |
getExecutorService() |
GenericParser |
getGenericParser() |
LowerLayerProtocol |
getLowerLayerProtocol() |
<R> Validator<R> |
getMessageValidator() |
ModelClassFactory |
getModelClassFactory() |
ParserConfiguration |
getParserConfiguration() |
PipeParser |
getPipeParser() |
ProfileStore |
getProfileStore() |
ServerConfiguration |
getServerConfiguration() |
SocketFactory |
getSocketFactory() |
ValidationContext |
getValidationContext() |
<R> ValidationExceptionHandlerFactory<R> |
getValidationExceptionHandlerFactory() |
ValidationRuleBuilder |
getValidationRuleBuilder() |
XMLParser |
getXMLParser() |
Connection |
newClient(String host,
int port,
boolean tls)
Construct a new HL7 Client which will connect to an external TCP server for
the purpose of sending messages (and receiving responses).
|
Connection |
newClient(String host,
int outboundPort,
int inboundPort,
boolean tls)
Construct a new HL7 two-port client which will connect to an external TCP server for
the purpose of sending messages (and receiving responses).
|
Connection |
newLazyClient(String host,
int port,
boolean tls)
Construct a new HL7 Client which will connect to an external TCP server for
the purpose of sending messages (and receiving responses).
|
Connection |
newLazyClient(String host,
int outboundPort,
int inboundPort,
boolean tls)
Construct a new HL7 two-port client which will connect to an external TCP server for
the purpose of sending messages (and receiving responses).
|
<T extends Message> |
newMessage(Class<T> clazz)
Creates a new message of the provided message structure class, without further initializing the message
|
Message |
newMessage(String eventType,
String triggerEvent,
Version version)
Creates a new message of the given event type, trigger and version, and initializes the message header
|
HL7Service |
newServer(int port,
boolean tls)
Construct a new HL7 Server which will listen for incoming connections
|
HL7Service |
newServer(int inboundPort,
int outboundPort,
boolean tls)
Construct a new HL7 Server which will listen for a pair of connections (one for
incoming messages, one for outgoing)
|
void |
setCodeStoreRegistry(CodeStoreRegistry store) |
void |
setExecutorService(ExecutorService executorService) |
void |
setLowerLayerProtocol(LowerLayerProtocol llp) |
void |
setModelClassFactory(ModelClassFactory modelClassFactory) |
void |
setParserConfiguration(ParserConfiguration configuration) |
void |
setProfileStore(ProfileStore store) |
void |
setServerConfiguration(ServerConfiguration theServerConfiguration)
Sets the
ServerConfiguration to be used by all HL7 servers obtained from this class. |
void |
setSocketFactory(SocketFactory socketFactory) |
void |
setValidationContext(String contextClassName)
Sets a default
ValidationContext . |
void |
setValidationContext(ValidationContext context) |
<R> void |
setValidationExceptionHandlerFactory(ValidationExceptionHandlerFactory<R> factory) |
void |
setValidationRuleBuilder(String builderClassName)
Sets a new instance of
ValidationRuleBuilder as default. |
void |
setValidationRuleBuilder(ValidationRuleBuilder ruleBuilder)
Sets a default
ValidationRuleBuilder . |
ExecutorService getExecutorService()
ExecutorService
to be used by all services that spawn threadsvoid setExecutorService(ExecutorService executorService)
executorService
- the ExecutorService
to be used by all services that spawn
threadsConnectionHub getConnectionHub()
newClient(String, int, boolean)
ParserConfiguration getParserConfiguration()
ParserConfiguration
to be used by all parsers obtained from this class.ServerConfiguration getServerConfiguration()
ServerConfiguration
to be used by all HL7 servers obtained from this class.newServer(int, boolean)
,
newServer(int, int, boolean)
void setServerConfiguration(ServerConfiguration theServerConfiguration)
ServerConfiguration
to be used by all HL7 servers obtained from this class.void setParserConfiguration(ParserConfiguration configuration)
configuration
- ParserConfiguration
to be used by all parsers obtained from this
class.ValidationContext getValidationContext()
ValidationContext
to be used by all parsers obtained from this class.void setValidationContext(ValidationContext context)
context
- ValidationContext
to be used by all parsers obtained from this class.void setValidationContext(String contextClassName)
ValidationContext
. Note that a default ValidationRuleBuilder
has precedence of this ValidationContext.contextClassName
- class name of the ValidationContext
to be used by all parsers
obtained from this class.ValidationRuleBuilder getValidationRuleBuilder()
ValidationRuleBuilder
to be used by all parsers obtained from this class.void setValidationRuleBuilder(ValidationRuleBuilder ruleBuilder)
ValidationRuleBuilder
. Note that this ValidationRuleBuilder
has precedence over a default ValidationContext
set with
setValidationContext(ValidationContext)
or setValidationContext(String)
ruleBuilder
- ValidationRuleBuilder
to be used by all parsers obtained from this
class.void setValidationRuleBuilder(String builderClassName)
ValidationRuleBuilder
as default. Note that this
ValidationRuleBuilder
has precedence over a default ValidationContext
set
with setValidationContext(ValidationContext)
or
setValidationContext(String)
builderClassName
- class name of the ValidationRuleBuilder
to be used by all
parsers obtained from this class.ModelClassFactory getModelClassFactory()
ModelClassFactory
to be used by all parsers obtained from this class.void setModelClassFactory(ModelClassFactory modelClassFactory)
modelClassFactory
- the ModelClassFactory
to be used by all parsers obtained
from this class.ProfileStore getProfileStore()
ProfileStore
to be used for loading conformance profile filesvoid setProfileStore(ProfileStore store)
store
- the ProfileStore
to be used for loading conformance profile filesCodeStoreRegistry getCodeStoreRegistry()
CodeStoreRegistry
to be used for serving codes for conformance profilesvoid setCodeStoreRegistry(CodeStoreRegistry store)
store
- the CodeStoreRegistry
to be used for serving codes for conformance profilesPipeParser getPipeParser()
setModelClassFactory(ModelClassFactory)
,
setValidationContext(String)
and
setParserConfiguration(ParserConfiguration)
.XMLParser getXMLParser()
setModelClassFactory(ModelClassFactory)
,
setValidationContext(String)
and
setParserConfiguration(ParserConfiguration)
.GenericParser getGenericParser()
setModelClassFactory(ModelClassFactory)
,
setValidationContext(String)
and
setParserConfiguration(ParserConfiguration)
.Validator getConformanceValidator()
getMessageValidator()
and configure a Validation rule that checks
a message against a conformance profilesetCodeStoreRegistry(CodeStoreRegistry)
<R> Validator<R> getMessageValidator()
ValidationContext
as set
using setValidationContext(ValidationContext)
. For each validation it will
use a new instance of ValidationExceptionHandler
as obtained by
getValidationExceptionHandlerFactory()
.<R> ValidationExceptionHandlerFactory<R> getValidationExceptionHandlerFactory()
<R> void setValidationExceptionHandlerFactory(ValidationExceptionHandlerFactory<R> factory)
factory
- a ValidationExceptionHandlerFactory
that is used to create
a ValidationExceptionHandler
during message validation.LowerLayerProtocol getLowerLayerProtocol()
LowerLayerProtocol
instance used by all HL7 MLLP operationsvoid setLowerLayerProtocol(LowerLayerProtocol llp)
llp
- the LowerLayerProtocol
instance used by all HL7 MLLP operationsSocketFactory getSocketFactory()
SocketFactory
instance used by HL7 networking operationsvoid setSocketFactory(SocketFactory socketFactory)
socketFactory
- the SocketFactory
instance used by HL7 networking operationsHL7Service newServer(int port, boolean tls)
port
- The port on which to listen for new connectionstls
- Whether or not to use SSL/TLSService.start()
or
Service.startAndWait()
setSocketFactory(SocketFactory)
HL7Service newServer(int inboundPort, int outboundPort, boolean tls)
inboundPort
- The port on which to listen for connections for inbound messagesoutboundPort
- The port on which to listen for connections for outgoing messagestls
- Whether or not to use SSL/TLSService.start()
or
Service.startAndWait()
setSocketFactory(SocketFactory)
Connection newClient(String host, int port, boolean tls) throws HL7Exception
Note that connections are pooled by the HapiContext by default. If multiple concurrent connections to the same server are required, the easiest way to accomplish this is currently to create multiple HapiContext instances.
host
- The host IP/hostname to connect toport
- The port to connect totls
- Whether or not to use SSL/TLSHL7Exception
- If the connection can not be initialized for any reasonConnection newLazyClient(String host, int port, boolean tls) throws HL7Exception
Note that connections are pooled by the HapiContext by default. If multiple concurrent connections to the same server are required, the easiest way to accomplish this is currently to create multiple HapiContext instances.
host
- The host IP/hostname to connect toport
- The port to connect totls
- Whether or not to use SSL/TLSHL7Exception
- If the connection can not be initialized for any reasonConnection newClient(String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception
Note that connections are pooled by the HapiContext by default. If multiple concurrent connections to the same server are required, the easiest way to accomplish this is currently to create multiple HapiContext instances.
host
- The host IP/hostname to connect tooutboundPort
- The port to connect to for outgoing messagesinboundPort
- The port to connect to for inbound (response) messagestls
- Whether or not to use SSL/TLSHL7Exception
- If the connection can not be initialized for any reasonConnection newLazyClient(String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception
Note that connections are pooled by the HapiContext by default. If multiple concurrent connections to the same server are required, the easiest way to accomplish this is currently to create multiple HapiContext instances.
host
- The host IP/hostname to connect tooutboundPort
- The port to connect to for outgoing messagesinboundPort
- The port to connect to for inbound (response) messagestls
- Whether or not to use SSL/TLSHL7Exception
- If the connection can not be initialized for any reasonMessage newMessage(String eventType, String triggerEvent, Version version) throws HL7Exception
eventType
- event type, e.g. ADTtriggerEvent
- trigger event, e.g. A01version
- HL7v2 versionHL7Exception
- if no message object could be created<T extends Message> T newMessage(Class<T> clazz) throws HL7Exception
T
- message structure class typeclazz
- message structure classHL7Exception
Copyright © 2001–2017 University Health Network. All rights reserved.