public interface HapiContext
HapiContext objects maintains the following configuration information
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
HapiContext serves as factory for HAPI objects that refer to this configuration. Changing the configuration automatically influence all HAPI objects that were created and will be created using the given factory instance:
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()
ParserConfiguration getParserConfiguration()
ParserConfiguration to be used by all parsers 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
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
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 reasonCopyright © 2001-2013 University Health Network. All Rights Reserved.