public class MCassociation
extends java.lang.Object
It can either represent an accepted or a requested association.
Instances of this class can be created using the MCapplication.requestAssociation(String)
method
for the requester side or using the MCapplication.startListening(String, MCacceptor)
method for the
acceptor side.
See the Association Management topic for a discussion on the usage of this class.
Instances of this class can be used by multiple threads concurrently.
Modifier and Type | Method and Description |
---|---|
void |
abort()
Aborts the association.
|
void |
accept()
Accepts an association request sent by an remote application.
|
void |
accept(byte[] userIdentityResponse)
Accepts an association request sent by an remote application with User Identity server response.
|
void |
continueRead(MCdimseMessage msg)
Reads one message from the network until the end finishing any previous
ToTag calls. |
MCreadStatus |
continueReadMessage(MCdimseMessage msg)
Reads one message from the network until the end finishing any previous
ToTag calls. |
MCreadStatus |
continueReadMessageToStream(MCdimseMessage msg,
java.nio.channels.WritableByteChannel dest)
Continues the reading of the current message to a data channel
|
MCreadStatus |
continueReadMessageToTag(MCdimseMessage msg,
int upToTag)
Partially reads one message from the network until the specified tag, starting from the previous
ToTag call. |
void |
continueReadToStream(MCdimseMessage msg,
java.nio.channels.WritableByteChannel dest)
Continues the reading of the current message to a data channel
|
void |
continueReadToTag(MCdimseMessage msg,
int upToTag)
Partially reads one message from the network until the specified tag, starting from the previous
ToTag call. |
MCresultContext |
getAcceptableContext(java.lang.String serviceOrUID)
Gets the first acceptable presentation context that matches the specified service name or UID.
|
MCresultContext |
getAcceptableContext(java.lang.String serviceOrUID,
MCtransferSyntax transferSyntax)
Gets the first acceptable presentation context that matches the specified service name or UID and has the
specified transfer syntax.
|
MCresultContext[] |
getAcceptableContexts()
Gets the list of acceptable presentation context for this association.
|
java.lang.String |
getCalledAETitle()
Gets the application entity title to which the association was requested.
|
java.lang.String |
getCallingAETitle()
Gets the application entity title of the requester.
|
int |
getListenPort()
Gets the port number of the acceptor application.
|
MCapplication |
getLocalApplication()
Gets the local application object for this association.
|
long |
getLocalMaxPDULength()
Get the local application's maximum PDU length.
|
int |
getMaxOperationsInvoked()
Gets the negotiated maximum number of operations invoked by the association requester.
|
int |
getMaxOperationsPerformed()
Gets the negotiated maximum number of operations performed by the association requester.
|
java.lang.String |
getRemoteAddress()
Gets the IP address of the remote application.
|
java.lang.String |
getRemoteImplementationUID()
Gets the Implementation Class UID of the remote application.
|
java.lang.String |
getRemoteImplementationVersion()
Gets the Implementation Version of the remote application.
|
long |
getRemoteMaxPDULength()
Get the remote application's maximum PDU length.
|
MCuserIdentity |
getUserIdentity()
Returns
MCuserIdentity value of the association. |
byte[] |
getUserIdentityPrimaryField()
User Identity Primary Field
|
byte[] |
getUserIdentityResponse()
User Identity Server Response
|
boolean |
getUserIdentityResponseReceived()
User Identity Response received
|
boolean |
getUserIdentityResponseRequested()
User Identity Response requested
|
byte[] |
getUserIdentitySecondaryField()
User Identity Secondary Field
|
boolean |
isActive()
Tells whether this association is active and is ready to receive or send messages.
|
boolean |
isRequestor()
Tells whether this association represents a requested association.
|
MCdimseMessage |
read(int timeout)
This method reads a DICOM DIMSE (DICOM Message Service Element) message from the network.
|
MCreadStatus |
readMessage(int timeout)
This method reads a DICOM DIMSE (DICOM Message Service Element) message from the network.
|
MCreadStatus |
readMessageToTag(int timeout,
int upToTag)
Partially reads one message from the network until a specified tag
|
MCreadStatus |
readToStream(int timeout,
java.lang.String filename,
java.nio.channels.WritableByteChannel dest)
Reads a message to a data channel.
|
MCdimseMessage |
readToTag(int timeout,
int upToTag)
This method partially reads a DICOM DIMSE (DICOM Message Service Element) message from the network until the specified tag.
|
void |
reject()
Rejects an association request received from a remote application.
|
void |
reject(MCrejectReason reason)
Deprecated.
This method is deprecated. Use
reject(MCrejectReasonEnum) instead. |
void |
reject(MCrejectReasonEnum reason)
Rejects an association request received from a remote application.
|
void |
reject(short result,
short source,
short reason)
Rejects an association request received from a remote application.
|
void |
release()
Releases an open association.
|
void |
sendRequest(MCdimseMessage message)
Sends a DIMSE request message to the association partner.
|
void |
sendRequest(MCdimseMessage message,
java.lang.String serviceName)
Sends a DIMSE request message to the association partner.
|
void |
sendRequest(MCvalueStorageEx storage,
java.lang.String serviceName,
java.lang.String filename)
Sends a DIMSE request from the data storage to the association partner.
|
void |
sendResponse(int status)
Sends a response message to the remote application for the last received request message.
|
void |
sendResponse(MCdimseMessage response,
int status)
Sends a response message to the remote application.
|
void |
sendResponse(MCvalueStorageEx storage,
int status,
java.lang.String filename)
Sends a response message from the data storage to the remote application.
|
void |
sendResponse(java.lang.String serviceName,
MCcommand command,
int status)
Sends a response message to the remote application.
|
void |
sendSuccessResponse()
Sends a success response message to the remote application for the last received request message.
|
void |
sendSuccessResponse(MCdimseMessage requestMessage)
Sends a success response message to the remote application.
|
void |
sendSuccessResponse(java.lang.String serviceName,
MCcommand cmd)
Sends a success response message to the remote application.
|
void |
setNegotiationInfo(java.lang.String serviceName,
byte[] extendedInfo)
Sets extended negotiation information to be returned in the associate response before an association is accepted.
|
public MCuserIdentity getUserIdentity()
MCuserIdentity
value of the association.
public byte[] getUserIdentityPrimaryField()
The username as a series of characters, or the Kerberos Service ticket encoded in accordance with RFC-1510, or the JWT encoded in accordance with RFC 7519 using base64url encoded parts.
public byte[] getUserIdentitySecondaryField()
MCuserIdentity.USERNAME_AND_PASSCODE
.public byte[] getUserIdentityResponse()
Returns the Kerberos Server ticket if User Identity value was Kerberos Service ticket (3) or the SAML response if the User Identity value was SAML Assertion (4) and if the Association requestor has requested a positive acknowledgment.
public boolean getUserIdentityResponseRequested()
True
if user identity response was requested.public boolean getUserIdentityResponseReceived()
True
if user identity response was received.public boolean isActive()
Note that a return value of true
does not guarantee that the next read or send operation will
succeed. The active state of the association is reported as of the last read or send operation.
true
if the association is established and it is not disposed, released or aborted.public boolean isRequestor()
true
if this association is a requested association, false
if it is an
accepted association.public java.lang.String getCallingAETitle()
public java.lang.String getCalledAETitle()
public long getLocalMaxPDULength()
During association negotiation the Merge DICOM toolkit and the remote DICOM system exchanged the
maximum size of Protocol Data Units that each is willing to receive. Each system
commits to send TCP/IP data no larger than that negotiated for the receiver. This
method returns the size of the largest PDU that the local system is willing to receive.
The getRemoteMaxPDULength()
method returns the size of the largest PDU that
the remote system is willing to receive.
public long getRemoteMaxPDULength()
See getLocalMaxPDULength()
for details on PDU lengths.
public java.lang.String getRemoteImplementationUID()
The identification of an implementation of the DICOM standard relies on two pieces of information: the Implementation Class UID (required) and the Implementation Version Name (optional). The DICOM standard requires that association requesters and acceptors notify each other of their respective Implementation Class UID. This method returns the Implementation Class UID of the remote application, the Implementation Class UID of the local application is set through the IMPLEMENTATION_CLASS_UID configuration item in the mergecom.pro file.
public java.lang.String getRemoteImplementationVersion()
public MCresultContext[] getAcceptableContexts()
An acceptable context describes a service that is acceptable to both the local application and the remote application.
For a requested association the returned list contains MCresultContext
for all services that were
accepted by the remote application. Each MCresultContext
contains information about the selected
transfer syntax, negotiated roles and any extended negotiation information as received in the association
accept response.
On the acceptor side the toolkit creates this list based on the proposed contexts in the received association
request and the contexts supported by the local application (specified in the
MCapplication.startListening(String, MCacceptor)
call ). The list contains services that are in both
lists and have a common transfer syntax. The application should not change the elements in the returned context
list as it does not affect the negotiation. If extended negotiation information should be returned in the
association accept response, the application should use the setNegotiationInfo(java.lang.String, byte[])
method before calling
accept()
.
public MCresultContext getAcceptableContext(java.lang.String serviceOrUID)
See getAcceptableContexts()
for more information on acceptable presentation contexts.
serviceOrUID
- The name or UID of the requested service.null
if there is no match.MCexception
- If the parameter is null
.public MCresultContext getAcceptableContext(java.lang.String serviceOrUID, MCtransferSyntax transferSyntax)
See getAcceptableContexts()
for more information on acceptable presentation contexts.
serviceOrUID
- The name or UID of the requested service.transferSyntax
- The transfer syntax to match.null
if there is no match.MCexception
- If a parameter is null
.public int getMaxOperationsInvoked()
public int getMaxOperationsPerformed()
public java.lang.String getRemoteAddress()
public MCapplication getLocalApplication()
MCapplication
object.public int getListenPort()
public void abort()
Either an association acceptor or an association requester may issue the abort request to bring an abrupt end to the association. The corresponding TCP/IP connection is also released. When this method call returns, the association is no longer "active".
public MCdimseMessage read(int timeout)
DICOM messages are exchanged over an active association connection. After successfully requesting an association or accepting an association request, a DICOM application must send or read DIMSE messages.
A DICOM service class user (SCU) sends request messages to the remote application to request that a service be performed. The service class provider (SCP) responds by sending one or more response messages back. The read method is used to retrieve these request and response messages.
When a message arrives, the toolkit returns an MCdimseMessage
object representing both the DIMSE command
set and the DIMSE data set which comprise the message. Methods of the returned MCdimseMessage
provide
access to the command set and data set attribute values of the message.
This method blocks until either a message is received or the number of seconds specified in the timeout parameter expires. If a communication error occurs, the association is released by the remote application or the association is aborted (on either side) this method throws an exception and logs an error message. Once the toolkit begins to receive a message, the INACTIVITY_TIMEOUT configuration value is used to determine if a transmission is stalled, meaning that the toolkit will abort the association if it does not receive more data from the network for the configured period of time. In that case this method will throw an exception.
timeout
- The time, in seconds, to wait for a message to arrive. If this parameter is zero (0) this method
will return immediately if there is no message to be received. If this parameter is -1 this method will block
until a message is received.MCdimseMessage
containing the received message or null
if a no
message was received for the number of seconds specified in the timeout parameter.MCexception
- If the argument is invalid, an inactivity timeout occurs while receiving the message, a
network error occurs, an improperly formatted DICOM message is received, the association is released by the
remote application or the association is aborted. Check the value of the MCexception.exceptionNumber
field of the exception object to determine the condition that caused this exception.public MCdimseMessage readToTag(int timeout, int upToTag)
timeout
- The time, in seconds, to wait for a message to arrive. If this parameter is zero (0) this method
will return immediately if there is no message to be received. If this parameter is -1 this method will block
until a message is received.upToTag
- Read up to and include this tag when reading from the remote application.
Must be outside the command section ( greater than or equal to (0001,0000)), or equals to Integer.MIN_VALUE
which means reading to the end of the message.MCdimseMessage
containing the received message or null
if a no
message was received for the number of seconds specified in the timeout parameter.MCexception
- If the argument is invalid, an inactivity timeout occurs while receiving the message, a
network error occurs, an improperly formatted DICOM message is received, the association is released by the
remote application or the association is aborted. Check the value of the MCexception.exceptionNumber
field of the exception object to determine the condition that caused this exception.public void continueRead(MCdimseMessage msg)
ToTag
calls.msg
- An instance of MCdimseMessage
containing the received message which was
returned from previous readMessageToTag
or continueReadMessageToTag
call.MCexception
- If the argument is invalid, an inactivity timeout occurs while receiving the message, a
network error occurs, an improperly formatted DICOM message is received, the association is released by the
remote application or the association is aborted. Check the value of the MCexception.exceptionNumber
field of the exception object to determine the condition that caused this exception.public void continueReadToTag(MCdimseMessage msg, int upToTag)
ToTag
call.msg
- An instance of MCdimseMessage
containing the received message which was
returned from previous readMessageToTag
or continueReadMessageToTag
call.upToTag
- Read up to and include this tag when reading from the remote application.
Must be outside the command section ( greater than or equal to (0001,0000)), or equals to Integer.MIN_VALUE
which means reading to the end of the message.MCexception
- If the argument is invalid, an inactivity timeout occurs while receiving the message, a
network error occurs, an improperly formatted DICOM message is received, the association is released by the
remote application or the association is aborted. Check the value of the MCexception.exceptionNumber
field of the exception object to determine the condition that caused this exception.public void continueReadToStream(MCdimseMessage msg, java.nio.channels.WritableByteChannel dest)
msg
- An instance of MCdimseMessage
containing the received message which was
returned from previous readMessageToTag
or continueReadMessageToTag
call.dest
- The destination for the received messageMCexception
- If the argument is invalid, an inactivity timeout occurs while receiving the message, a
network error occurs, an improperly formatted DICOM message is received, the association is released by the
remote application or the association is aborted. Check the value of the MCexception.exceptionNumber
field of the exception object to determine the condition that caused this exception.public MCreadStatus readMessage(int timeout)
DICOM messages are exchanged over an active association connection. After successfully requesting an association or accepting an association request, a DICOM application must send or read DIMSE messages.
A DICOM service class user (SCU) sends request messages to the remote application to request that a service be performed. The service class provider (SCP) responds by sending one or more response messages back. The read method is used to retrieve these request and response messages.
This method returns a MCreadStatus
object containing the result of the read operation. If a message was
successfully received the message
field of the returned object will contain the
MCdimseMessage
object representing the received message. If a message is not received or an error occurs
the returned status object contains the appropriate error code. See
MCreadStatus.getStatusCode()
for a description of status values and associated conditions.
timeout
- The time, in seconds, to wait for a message to arrive. If this parameter is zero (0) this method
will return immediately if there is no message to be received. If this parameter is -1 this method will block
until a message is received.MCreadStatus
instance containing the result of the read operation.public MCreadStatus readMessageToTag(int timeout, int upToTag)
timeout
- The time, in seconds, to wait for a message to arrive. If this parameter is zero (0) this method
will return immediately if there is no message to be received. If this parameter is -1 this method will block
until a message is received.upToTag
- Read up to and include this tag when reading from the remote application.
Must be outside the command section ( greater than or equal to (0001,0000)), or equals to Integer.MIN_VALUE
which means reading to the end of the message.MCreadStatus
instance containing the result of the read operation.public MCreadStatus continueReadMessageToTag(MCdimseMessage msg, int upToTag)
ToTag
call.
continueReadMessageToTag
requires that a previous readMessageToTag
or
continueReadMessageToTag
was called, otherwise the operation is not allowed.
msg
- An instance of MCdimseMessage
containing the received message which was
returned from previous readMessageToTag
or continueReadMessageToTag
call.
continueReadMessageToTag
doesn't create another new message, it just adds more
attributes to the message object if the previous operation didn't read to the end of the message.upToTag
- Read up to and include this tag when reading from the remote application.
Must be outside the command section ( greater than or equal to (0001,0000)), or equals to Integer.MIN_VALUE
which means reading to the end of the message.MCreadStatus
instance containing the result of the read operation.public MCreadStatus continueReadMessageToStream(MCdimseMessage msg, java.nio.channels.WritableByteChannel dest)
continueReadMessageToStream
requires that a previous readMessageToTag
or
continueReadMessageToTag
was called, otherwise the operation is not allowed.
msg
- An instance of MCdimseMessage
containing the received message which was
returned from previous readMessageToTag
or continueReadMessageToTag
call.dest
- The destination for the received messageMCreadStatus
instance containing the result of the read operation.public MCreadStatus continueReadMessage(MCdimseMessage msg)
ToTag
calls.msg
- An instance of MCdimseMessage
containing the received message which was
returned from previous readMessageToTag
or continueReadMessageToTag
call.MCreadStatus
instance containing the result of the read operation.public MCreadStatus readToStream(int timeout, java.lang.String filename, java.nio.channels.WritableByteChannel dest)
timeout
- The time, in seconds, to wait for a message to arrive. If this parameter is zero (0) this method
will return immediately if there is no message to be received. If this parameter is -1 this method will block
until a message is received.filename
- The name of destination filedest
- The destination for the received messageMCreadStatus
instance containing the result of the read operation.MCexception
- If the argument is invalid, an inactivity timeout occurs while receiving the message, a
network error occurs, an improperly formatted DICOM message is received, the association is released by the
remote application or the association is aborted. Check the value of the MCexception.exceptionNumber
field of the exception object to determine the condition that caused this exception.public void setNegotiationInfo(java.lang.String serviceName, byte[] extendedInfo)
The DICOM standard allows application entities to exchange extended negotiation information when establishing an association. The contents of the negotiation information must be known to both the association requester application and the association acceptor application. Such extended negotiation is not often used for DICOM services, but some services may require it. For example support for relational queries by Q/R SCP's and SCU's are negotiated using extended negotiation information.
When an association request is received, the extended negotiation information can be accessed
through the MCresultContext
objects returned by the getAcceptableContexts()
method. This method
may then be used to set extended negotiation information in the association response. After setting the extended
negotiation information to return, accept()
must be called to accept the association. If this method is not
used, no extended negotiation information will be returned in the response. Note that if no negotiation
information was included in the association request, the toolkit will not set the negotiation information in the
association response.
serviceName
- The service name for which the extended negotiation information is to be set.extendedInfo
- The extended negotiation information to be set.MCexception
- If one of the parameters is invalid, this association is a requester side association or
the association has been already accepted, rejected or aborted. Check the value of the
MCexception.exceptionNumber
field of the exception object for the cause of the failure.public void accept()
The toolkit notifies the registered MCacceptor
instance when an association request
is received from a remote DICOM application by calling its start()
method.
The start()
method may call accept()
to indicate that it is
satisfied with the parameters of the association as proposed by the remote requester
application.
When the start()
method of the acceptor is called the toolkit has already determined that both the
local and remote applications wish to perform at least one common service. The getAcceptableContexts()
method may be used to examine the services that are agreeable to both sides. Several other properties are
available to inquire about the remote application. If the local application agrees with the acceptable services,
it calls this method to establish an association between the two applications.
Note that a reject()
call may be made to reject the association request.
MCexception
- If this association is a requester side association or the association has been already
accepted, rejected or aborted. Check the value of the MCexception.exceptionNumber
field of the exception
object for the cause of the failure.public void accept(byte[] userIdentityResponse)
The toolkit notifies the registered MCacceptor
instance when an association request
is received from a remote DICOM application by calling its start()
method.
The start()
method may call accept to indicate that it is satisfied
with the parameters of the association as proposed by the remote requester application.
When the start()
method of the acceptor is called the toolkit has already determined that both the
local and remote applications wish to perform at least one common service. The getAcceptableContexts()
method may be used to examine the services that are agreeable to both sides. Several other properties are
available to inquire about the remote application. If the local application agrees with the acceptable services,
it calls this method to establish an association between the two applications.
Note that a reject()
call may be made to reject the association request.
userIdentityResponse
- If the association requestor has requested a positive acknowledgment
the response has to be
the Kerberos Server ticket if User Identity value was Kerberos Service ticket (3)
or the SAML assertion if User Identity value was SAML Assertion (4)MCexception
- If this association is a requester side association or the association has been already
accepted, rejected or aborted. Check the value of the MCexception.exceptionNumber
field of the exception
object for the cause of the failure.public void reject()
MCexception
- If this association is a requester side association or the association has been already
accepted, rejected or aborted. Check the value of the MCexception.exceptionNumber
field of the exception
object for the cause of the failure.public void reject(MCrejectReason reason)
reject(MCrejectReasonEnum)
instead.reason
- The reason for rejection.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void reject(MCrejectReasonEnum reason)
reason
- The (enumerated) reason for rejection.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void reject(short result, short source, short reason)
result
- Permanent or transient rejection (1, 2)source
- A valid DICOM sourcr code (1, 2, 3)reason
- A valid DICOM reason code (1, 2, 3, 7)MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendRequest(MCdimseMessage message)
This method sends a request message to the remote application. The message must have its service and command set, and the msg command must be a valid DIMSE request command.
Some DICOM services require that values for certain command set attributes (i.e. group 0 attributes) be set. With the exceptions listed below, the application must set any command set attribute value before sending the message:
message
- The message to be sent.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendRequest(MCdimseMessage message, java.lang.String serviceName)
This method sends a request message to the remote application. The message must have its service and command set, and the command must be a DIMSE request command.
The presentation context used in the transfer is looked up based on the service specified in the call. This call is used to select the proper presentation context when the object is common to multiple services negotiated. An example is the FilmBox when both BASIC_GRAYSCALE_PRINT_MANAGEMENT and BASIC_COLOR_PRINT_MANAGEMENT are negotiated.
Some DICOM services require that values for certain command set attributes (i.e. group 0 attributes) be set. With the exceptions listed below, the application must set any command set attribute value before sending the message:
The serviceName
parameter is optional. If it is null
it
will be ignored. Some DICOM services (e.g. the Basic Print Service) support multiple meta services.
Each meta service consists of a set of basic DICOM services. In some cases a DICOM application may
support multiple meta services over the same association. When two of the meta services include the
same basic service, this serviceName
parameter is used to tell the toolkit which meta
service to use when sending the message.
message
- The message to be sent.serviceName
- The name of the service that identify the presentation context for this message.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendRequest(MCvalueStorageEx storage, java.lang.String serviceName, java.lang.String filename)
This method sends a request message from the data storage to the remote application. The message by default has C_STORE_RQ. The presentation context used in the transfer is looked up based on the service specified in the call. This call is used to select the proper presentation context when the object is common to multiple services negotiated. An example is the FilmBox when both BASIC_GRAYSCALE_PRINT_MANAGEMENT and BASIC_COLOR_PRINT_MANAGEMENT are negotiated.
The application sets the required values for command set (i.e. group 0 attributes) before sending the message:
The serviceName
parameter is optional. If it is null
it
will be ignored. Some DICOM services (e.g. the Basic Print Service) support multiple meta services.
Each meta service consists of a set of basic DICOM services. In some cases a DICOM application may
support multiple meta services over the same association. When two of the meta services include the
same basic service, this serviceName
parameter is used to tell the toolkit which meta
service to use when sending the message.
storage
- The data storage with message to be sent.serviceName
- The name of the service that identify the presentation context for this message (optional).filename
- The name of the data storage (optional).MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendResponse(MCdimseMessage response, int status)
This method may be called after successfully receiving a request message.
The status
parameter is used as the value for the Status (0000,0900) attribute and it provides the
status of the requested operation. The value must be a valid response code for the service involved. Response
codes are defined in the MCresponseStatus
class. Many DICOM services do not require a response of more
than just a status. This method can be used for services that require the setting of several message attributes
(e.g. C_FIND_RSP).
If the response
parameter is not null
must have the same service as the last request
message, and for an appropriate command. If the response
parameter is null
the toolkit
will create one based on the service and command of the last request message received.
Some DICOM services require that values for certain command set attributes (i.e. group 0 attributes) be set. With the exceptions listed below, the application must set any command set attribute value before sending the message:
response
- The response message to be sent, or null
if the response does not need any attribute
other than the response status.status
- The response status as defined in the MCresponseStatus
class.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendResponse(java.lang.String serviceName, MCcommand command, int status)
This method may be called after successfully receiving a request message for DICOM services that do not require a response of more than just a status.
The status
parameter is used as the value for the Status (0000,0900) attribute and it provides the
status of the requested operation. The value must be a valid response code for the service involved. Response
codes are defined in the MCresponseStatus
class.
serviceName
- The service name for the response, it must match the service of the request.command
- The response command.status
- The response status as defined in the MCresponseStatus
class.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendResponse(int status)
This method may be called after successfully receiving a request message for DICOM services that do not require a response of more than just a status.
The status
parameter is used as the value for the Status (0000,0900) attribute and it provides the
status of the requested operation. The value must be a valid response code for the service involved. Response
codes are defined in the MCresponseStatus
class.
status
- The response status as defined in the MCresponseStatus
class.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendResponse(MCvalueStorageEx storage, int status, java.lang.String filename)
This method may be called after successfully receiving a request message.
The status
parameter is used as the value for the Status (0000,0900) attribute and it provides the
status of the requested operation. The value must be a valid response code for the service involved. Response
codes are defined in the MCresponseStatus
class. Many DICOM services do not require a response of more
than just a status. This method can be used for services that require the setting of several message attributes
(e.g. C_FIND_RSP).
If the response
parameter is not null
must have the same service as the last request
message, and for an appropriate command. If the response
parameter is null
the toolkit
will create one based on the service and command of the last request message received.
The application sets the required values for command set (i.e. group 0 attributes) before sending the message:
storage
- The data storage with message to be sent.status
- The response status as defined in the MCresponseStatus
class.filename
- The name of the data storage (optional).MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendSuccessResponse(MCdimseMessage requestMessage)
This method may be called after successfully receiving a request message. This method can be used for DICOM services do not require a response of more than just a status.
The value for the Status (0000,0900) attribute of the response message is set to 0 (success).
requestMessage
- The request message being responded to.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendSuccessResponse(java.lang.String serviceName, MCcommand cmd)
This method is equivalent to the sendResponse( String, MCcommand, int )
method with the status parameter
set to MCresponseStatus.SUCCESS
.
serviceName
- The service name for the response, it must match the service of the request.cmd
- The response command.MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void sendSuccessResponse()
This method is equivalent to the sendResponse( int )
method with the status parameter
set to MCresponseStatus.SUCCESS
.
MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.public void release()
This method blocks until the release request is sent and acknowledged.
An association requester can release an association when it has completed its work for the association.
Note that an association acceptor cannot release an association. It is required by DICOM to abort()
an association if an acceptor wants to close the association.
When an association requester application releases the association, the two application entities must react as
follows:
abort()
. The application may no longer send
messages to the association partner. The requester may, however, continue to receive messages until it is
informed that the association has been closed.
abort()
at any time.
MCexception
- MCexception.exceptionNumber
field of the exception object for the cause of the
failure.