public interface Dialog
This interface provides facilities common to all CGIN dialogs. It is the activity object interface for all activities generated by a CGIN resource adaptor.
The methods dealing with operations and errors take metadata instances, built by the specific protocol in use, to identify the operation or error to operate on.
Many of the methods on this interface are intended for use by generated code, or by generic code that is not aware of the exact protocol in use. For this reason, they are generally verbose and there are no "helper" convenience methods. Each protocol implemented via CGIN will implement an extension interface that extends Dialog and provides methods that are specific to the operations and errors of that protocol, which is a more convenient interface to use for general service development.
Modifier and Type | Interface and Description |
---|---|
static class |
Dialog.State
An enumeration of the states a dialog may be in.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptDialog()
Issue a dialog open request acceptance response on this dialog.
|
void |
acceptDialog(SccpAddress responderAddress,
Object... userInformation)
Issue a dialog open request acceptance response on this dialog.
|
boolean |
equals(Object o)
Determine if this Dialog object is equal to another specified object.
|
TcapApplicationContext |
getApplicationContext()
Get the application context currently in use on this dialog
|
ObjectID |
getApplicationContextName()
Get the application context name currently in use on this dialog
|
String |
getDialogID()
Get a unique dialog identifier for this dialog.
|
Dialog.State |
getDialogState()
Get the current state of the dialog.
|
byte[] |
getLocalTransactionID()
Get the local TCAP transaction ID for this dialog.
|
int |
getMTPPriority()
Get the MTP3 message priority in use by this dialog.
|
CGINProvider |
getProvider()
Get the provider that created this dialog.
|
byte[] |
getRemoteTransactionID()
Get the remote TCAP transaction ID for this dialog.
|
int |
getSCCPClass()
Get the current SCCP class in use by this dialog.
|
boolean |
getSCCPReturnOption()
Get the current SCCP Return Option in use by this dialog.
|
int |
hashCode()
Get a hash code for this Dialog object.
|
boolean |
isStateless()
Determine if this Dialog object represents a stateless dialog.
|
void |
refuseDialog()
Refuse an open dialog request.
|
void |
refuseDialog(OpenRefuseReason reason,
TcapApplicationContext applicationContext,
SccpAddress responderAddress,
Object... userInformation)
Refuse an open dialog request.
|
void |
sendClose(boolean prearrangedEnd)
Close the dialog.
|
void |
sendDelimiter()
Flush the operation requests and/or responses that have been queued on this dialog out to the network and the
remote Provider.
|
void |
sendError(int invokeId,
TcapError error,
Object parameter)
Issue a user error response for an invoked operation on the dialog.
|
int |
sendInvoke(TcapOperation operation,
boolean invokeIdPresent,
int invokeId,
boolean linkedIdPresent,
int linkedId,
long timeout,
Object arg)
Issue an operation request on the dialog.
|
void |
sendResult(int invokeId,
Object result,
boolean lastResult)
Issue a result to an operation on the dialog.
|
void |
sendUserAbort(Object... userInformation)
Abort the dialog.
|
void |
setActivityTimeout(long timeout)
Set the dialog activity timeout for this dialog.
|
void |
setMTPPriority(int priority)
Set the MTP3 message priority to use.
|
void |
setRemoteAddress(SccpAddress remoteAddress)
Set the remote SCCP address for future outgoing messages.
|
void |
setSCCPClass(int c)
Set the SCCP class to use for future outgoing messages.
|
void |
setSCCPReturnOption(boolean returnErrors)
Set the SCCP Return Option to use for future outgoing messages.
|
String |
toString()
Get a string representation of this Dialog object.
|
int sendInvoke(TcapOperation operation, boolean invokeIdPresent, int invokeId, boolean linkedIdPresent, int linkedId, long timeout, Object arg) throws TooManyInvokesException, ProtocolException
operation
- operation metadata object that identifies the operation to sendinvokeIdPresent
- if true, use the specified invoke ID; otherwise, allow the local provider to allocate an IDinvokeId
- the invoke ID to use, if invokeIdPresent == true; must be in the range [-128..127]linkedIdPresent
- if true, use a linked ID in this operationlinkedId
- the linked ID to use, if linkedIdPresent == true; must be in the range [-128..127]timeout
- invoke timeout for the operation, in milliseconds; if 0, use the provider's defaultarg
- the operation argument, or null
if there is no argumentTooManyInvokesException
- if invokeIdPresent == false and too many invokes are already active on the dialogProtocolException
- if a problem occurred sending the requestvoid sendResult(int invokeId, Object result, boolean lastResult) throws ProtocolException
invokeId
- the invoke ID that is being responded toresult
- the operation result, or null
if there is no result valuelastResult
- true if this is the last result for this operation (TC-RESULT-L); false otherwise (TC-RESULT-NL)ProtocolException
- if a problem occurred sending the resultvoid sendError(int invokeId, TcapError error, Object parameter) throws ProtocolException
invokeId
- the invoke ID of the operation to respond toerror
- a metadata object identifying the error to sendparameter
- the error parameter, or null
if there is no associated parameterProtocolException
- if a problem occurred sending the errorvoid sendDelimiter() throws ProtocolException
ProtocolException
- if a problem occurred sending the delimitervoid sendClose(boolean prearrangedEnd) throws ProtocolException
prearrangedEnd == false
causes a message to be sent over
the network containing all operation requests and/or responses that have been queued on the dialog since it was
opened or the last delimiter was sent. If prearrangedEnd == true
, no network message is sent and
the dialog is torn down by the local Provider, discarding any queued operation requests and/or responses.prearrangedEnd
- true
if the dialog closure was "prearranged", false
if not
(a "basic end"). The typical argument value is false
.ProtocolException
- if there was a problem sending the dialog closevoid sendUserAbort(Object... userInformation) throws ProtocolException
userInformation
- the user information to include in the abortProtocolException
- if there was a problem sending the user abortvoid acceptDialog(SccpAddress responderAddress, Object... userInformation) throws ProtocolException
responderAddress
- the SCCP Address to use as the responding address in the Open Response instead of the
address provided by the stack, or null
to leave the address unchangeduserInformation
- the user information to include in the responding TC-CONTINUE or TC-ENDProtocolException
- if the open response could not be sentvoid acceptDialog() throws ProtocolException
This is a convenience method that is equivalent to calling: acceptDialog(null)
ProtocolException
- if there was a problem accepting the dialog open requestvoid refuseDialog(OpenRefuseReason reason, TcapApplicationContext applicationContext, SccpAddress responderAddress, Object... userInformation) throws ProtocolException
reason
- the refusal reason (must be PROVIDER_* (except PROVIDER_ABORT) or USER_*)applicationContext
- an alternative application context to include in the open refuse message, or
null
to leave the ACN unchangedresponderAddress
- the SCCP Address to use as the responding address in the Open Response instead of the
address provided by the stack, or null
to leave the address unchangeduserInformation
- the user information to include in the responding TC-U-ABORTProtocolException
- if the open response could not be sentvoid refuseDialog() throws ProtocolException
This is a convenience method that is equivalent to calling: refuseDialog(OpenRefuseReason.USER_NO_REASON_GIVEN,null,null)
ProtocolException
- if the open response could not be sentDialog.State getDialogState()
This always reflects the most recent state of the dialog in the TCAP stack, so the state may change spontaneously during event delivery, or may reflect a future state compared to the event currently being delivered.
For example, if a TC-CONTINUE then a TC-END are received on the same dialog in quick succession, the dialog state may become IDLE (reflecting processing of the TC-END) before events corresponding to the TC-CONTINUE have been delivered.
TcapApplicationContext getApplicationContext()
ObjectID getApplicationContextName()
String getDialogID()
byte[] getLocalTransactionID()
null
if one has not yet been allocatedbyte[] getRemoteTransactionID()
null
if one has not yet been allocatedCGINProvider getProvider()
boolean equals(Object o)
int hashCode()
String toString()
boolean isStateless()
true
if this Dialog is stateless, or false
if this Dialog is stateful.void setSCCPClass(int c) throws ProtocolException
Other SCCP classes, providing connection-oriented services, are not supported by this resource adaptor.
For incoming dialogs, this setting defaults to the class used by the received TC-BEGIN For outgoing dialogs, this setting defaults to Class 1.
c
- the SCCP class to useProtocolException
- if the dialog no longer exists, or the specified SCCP class is not supportedint getSCCPClass() throws ProtocolException
ProtocolException
- if the dialog no longer existsvoid setSCCPReturnOption(boolean returnErrors) throws ProtocolException
For incoming dialogs, this setting defaults to the setting used by the received TC-BEGIN For outgoing dialogs, this setting defaults to true (return errors)
returnErrors
- true to request "return errors"; false to request "discard errors"ProtocolException
- if the dialog no longer existsboolean getSCCPReturnOption() throws ProtocolException
ProtocolException
- if the dialog no longer existsvoid setMTPPriority(int priority) throws ProtocolException
For incoming and outgoing dialogs, this setting defaults to 0.
priority
- the MTP3 priority to useProtocolException
- if the dialog no longer exists, or the given priority is not supportedint getMTPPriority() throws ProtocolException
ProtocolException
- if the dialog no longer existsvoid setActivityTimeout(long timeout) throws ProtocolException
If no messages are received or sent on the dialog for the given period of time, then the TCAP stack is permitted to decide that the dialog is dead and abort it to free resources.
Dialog activity timeouts are a "best effort" and may not be implemented (or may take longer than expected) depending on the underlying TCAP stack. They are present to provide a last resort attempt at cleaning up dialogs that would otherwise be leaked. The correct operation of services should not rely on the timeout occuring in a timely manner (or at all).
In particular, activity timeouts are generally not implemented for stateless dialogs.
timeout
- the new activity timeout, in milliseconds; must be greater than zeroProtocolException
- if the dialog no longer exists, or the given timeout is not supportedvoid setRemoteAddress(SccpAddress remoteAddress) throws ProtocolException
For incoming dialogs, this defaults to the address included in the received TC-BEGIN For outgoing dialogs, this defaults to the address that the TC-BEGIN was sent to
remoteAddress
- the remote SCCP address to use in future messagesProtocolException
- if the dialog no longer exists