public class UserSession extends java.lang.Object implements IDataNotificationListener, IExceptionReceiver, IConnectionListener
| Constructor and Description |
|---|
UserSession()
Instantiates User Session
|
UserSession(java.net.Socket objSocket)
Instantiates User Session by given connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExceptionListener(IExceptionListener objIExceptionListener)
Register for Receiving Deferred Response.
|
boolean |
close()
Close.
|
void |
closeConnection()
This function is automatically invoked when connection is closed by remote end.
|
void |
connect(java.net.InetAddress ip,
int iPort)
Connects this UserSession to provided server IP address and port.
|
void |
connect(java.net.InetSocketAddress addr)
Connects this UserSession to provided server Socket Address
|
void |
connect(int iPort)
Connects this UserSession to provided server on local host to given port
|
void |
connect(java.lang.String strIP,
int iPort)
Connects this UserSession to provided server IP Address and port
|
void |
enableMLLP()
Enable MLLP at User session.
|
EnumErrorCode |
getErrorCode()
Retrieves Error Code of received message.
|
IProcessHandler |
getListener()
Retrieves instance of Listener Which implements IProcessHandler, All messages subscribed by this UserSession
are received using this listener.
|
Message |
getMessage()
Retrieves Message from UserSession.
|
ISingleCollection<Message> |
getRecievedMessagesCollection(java.lang.String strMessageControlID)
This method returns the Collection of Message by MessageControlId.
|
ISingleCollection<IHL7BatchFile> |
getResponseBatches()
Retrieves last received Response Batch collection.
|
int |
getTimeOut()
Returns setting for Socket read timeout of this session,
0 returns implies that the option is disabled (i.e., timeout of infinity).
|
int |
getWaitPeriod()
Retrieves the wait Period for which UserSession should wait till it receives ACK/Reponse for triggered event/Query.
|
void |
notifyData(IHL7BatchFile objBatchFile)
Invoked when HL7BatchFile is received from Remote End.
|
void |
notifyData(Message objReceivedMessage,
EnumErrorCode enumErrorCode)
Invoked when Message is received from Remote End.
|
void |
onException(java.lang.Exception ex,
byte[] buffer)
Invoked when exception is fetched while processing Message.
|
void |
onException(java.lang.Exception ex,
ISegmentSet objISegmentSet)
Invoked when exception is fetched while processing Message.
|
boolean |
sendBatchFile(IHL7BatchFile objBatchFile)
Sends specified HL7BatchFile server system if Batch processor is supported.
|
boolean |
sendBatchFile(java.lang.String strFilePath)
This method parses HL7Batch from file located at given path if Batch Processor is supported.
|
boolean |
sendMessage(Message messageToSend)
Sends the message to server system.
|
boolean |
sendMessage(java.lang.String strFilePath)
This method parses message from file located at given path.
|
void |
setBatchProcessor(IBatchProcessor objIBatchProcessor)
Sets the Batch Processor
|
void |
setClientSideQCNAgent(IClientQueryCancellation objClientSideQCNAgent)
This will set the Query Cancellation agent on ClientSideMessageAgent
|
void |
setClientSideQICAgent(IClientInteractiveContinuation objClientSideQICAgent)
Sets the Interactive Continuation Agent.
|
void |
setClientSideTransactionHandler(ITransactionHandler objClientSideTransactionHandler)
This will set the ITransactionHandler on User session.
|
void |
setErrorCode(EnumErrorCode enumErrorCode)
Sets Error Code of received
|
void |
setFragmentProcessor(IFragmentProcessor objIFragmentProcessor)
Sets the Fragment Processor
|
void |
setIBatchReceiver(IBatchReceiver objIBatchReceiver)
This will set the IBatchReceiver on user session.
|
void |
setICanceledResponseReceiver(ICanceledResponseReceiver objCanceledResponseReceiver)
This will set the ICanceledResponseReceiver on user session.
|
void |
setIInteractiveResponseReciever(IInteractiveResponseReciever objInteractiveResponseReciever)
This will set the IInteractiveResponseReciever on user session.
|
void |
setListener(IProcessHandler objProcessHandler)
Sets Listener Which implements IProcessHandler, All messages subscribed by this UserSession
are received using this listener.
|
void |
setLocalExtensionAgent(LocalExtensionAgent objLocalExtensionAgent)
sets localextensionAgent on UserSession.
|
void |
setMessage(Message objHL7Message)
Sets Message on UserSession.
|
void |
setMessageFactory(MessageFactory objMessageFactory)
Sets Message Factory
|
void |
setReadWriteLength(int iReadLength,
int iWriteLength)
Sets max length limit of reading and writing.
|
void |
setSequenceAgent(ISequenceAgent objSequenceAgent)
Sets the sequence agent on UserSession.Sequence Agent is required to enable Sequence Numbering in the message transactions.
|
void |
setTimeOut(int itimeout)
sets Socket read timeout of this session, in
milliseconds.
|
void |
setWaitPeriod(int waitPeriod)
Sets the wait period for which UserSession should wait till it receives ACK/reponse for triggered event/Query.
|
void |
stopListener()
Stops listening for HL7 message if listener is started.
|
public UserSession()
public UserSession(java.net.Socket objSocket)
throws java.io.IOException
objSocket - Specified socket to which UserSessoin is to be connectedjava.io.IOException - thrown when IOOperation failspublic void setClientSideQICAgent(IClientInteractiveContinuation objClientSideQICAgent)
objClientSideQICAgent - the ClientSideQICAgent to set.public void setSequenceAgent(ISequenceAgent objSequenceAgent)
objSequenceAgent - Sequence Agent to be set on UserSession.public void onException(java.lang.Exception ex,
byte[] buffer)
onException in interface IExceptionReceiverex - Exception fetchedbuffer - data for which error is fetchedpublic void onException(java.lang.Exception ex,
ISegmentSet objISegmentSet)
onException in interface IExceptionReceiverex - Exception fetchedbuffer - data for which error is fetchedpublic void setFragmentProcessor(IFragmentProcessor objIFragmentProcessor)
objIFragmentProcessor - the objIFragmentProcessor to setpublic void enableMLLP()
public void setBatchProcessor(IBatchProcessor objIBatchProcessor)
objIBatchProcessor - the objIBatchProcessor to setpublic void setMessageFactory(MessageFactory objMessageFactory)
objMessageFactory - instance of Message Factorypublic int getWaitPeriod()
public void setReadWriteLength(int iReadLength,
int iWriteLength)
iReadLength - value of Reading max lengthiWriteLength - value of Writing max lengthpublic void setWaitPeriod(int waitPeriod)
waitPeriod - Specifies wait period for UserSession.public Message getMessage()
public void setMessage(Message objHL7Message)
objHL7Message - Specifies object of Message from UserSession.public IProcessHandler getListener()
public void setListener(IProcessHandler objProcessHandler)
objProcessHandler - instance of listener implements IProcessHandlerpublic void addExceptionListener(IExceptionListener objIExceptionListener)
objIExceptionListener - - implementor of IExceptionListenerpublic void setIInteractiveResponseReciever(IInteractiveResponseReciever objInteractiveResponseReciever)
objInteractiveResponseReciever - - implementor of IInteractiveResponseRecieverpublic void setIBatchReceiver(IBatchReceiver objIBatchReceiver)
objIExceptionListener - - implementor of IExceptionListenerpublic void setICanceledResponseReceiver(ICanceledResponseReceiver objCanceledResponseReceiver)
objCanceledResponseReceiver - - implementor of ICanceledResponseReceiver.public void setClientSideTransactionHandler(ITransactionHandler objClientSideTransactionHandler)
objClientSideTransactionHandler - - implementor of ITransactionHandlerpublic EnumErrorCode getErrorCode()
public void setErrorCode(EnumErrorCode enumErrorCode)
enumErrorCode - public void notifyData(Message objReceivedMessage, EnumErrorCode enumErrorCode) throws java.io.IOException, InvalidMessageException
notifyData in interface IDataNotificationListenerobjReceivedMessage - Received MessageenumErrorCode - Received Error Codejava.io.IOException - Signals that an IO Exception has occurred.InvalidMessageExceptionpublic void stopListener()
throws java.io.IOException
java.io.IOExceptionpublic void notifyData(IHL7BatchFile objBatchFile)
notifyData in interface IDataNotificationListenerobjBatchFile - Received Messagepublic ISingleCollection<IHL7BatchFile> getResponseBatches()
public void connect(java.lang.String strIP,
int iPort)
throws java.io.IOException
strIP - IP address specified in String formatiPort - specified Portjava.io.IOException - Signals that an I/O exception has occurred.public void connect(int iPort)
throws java.io.IOException
iPort - int value of port.java.io.IOException - Signals that an I/O exception has occurred.public void connect(java.net.InetAddress ip,
int iPort)
throws java.io.IOException
ip - instance of INet Address.iPort - int value of port.java.io.IOException - Signals that an I/O exception has occurred.public void connect(java.net.InetSocketAddress addr)
throws java.io.IOException
addr - specified addressjava.io.IOException - Signals that an I/O exception has occurred.public boolean sendMessage(Message messageToSend) throws java.io.IOException
messageToSend - instance of messagejava.io.IOException - Signals that an I/O exception has occurred.public boolean sendMessage(java.lang.String strFilePath)
throws java.io.IOException
strFilePath - specified path of File containing messagejava.io.IOException - Signals that an I/O exception has occurred.public boolean sendBatchFile(IHL7BatchFile objBatchFile) throws java.io.IOException
objBatchFile - instance of HL7 Batch filejava.io.IOException - Signals when IO error occurs.public boolean sendBatchFile(java.lang.String strFilePath)
throws java.io.IOException
strFilePath - specified path of File containing HL7Batchjava.io.IOException - Signals that an I/O exception has occurred.public void setLocalExtensionAgent(LocalExtensionAgent objLocalExtensionAgent)
objLocalExtensionAgent - Specified LocallyExtendedAgent to be set on UserSession.public void closeConnection()
closeConnection in interface IConnectionListenerpublic boolean close()
throws java.io.IOException
java.io.IOExceptionpublic int getTimeOut()
public void setTimeOut(int itimeout)
timeout - the specified timeout, in milliseconds.public ISingleCollection<Message> getRecievedMessagesCollection(java.lang.String strMessageControlID)
public void setClientSideQCNAgent(IClientQueryCancellation objClientSideQCNAgent)
objClientSideQCNAgent - object of Client Side QCN Agent.