All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tascomm.dts.DTSMessage

java.lang.Object
   |
   +----tascomm.dts.DTSMessage

public class DTSMessage
extends Object
The DTSMessage class provides a Java applet or application all the functionality required for the execution of synchronous (on-line) DTS transactions against a remote DTS server system. The DTSMessage object is a complete DTS transaction context itself, containing all message input and output parameter areas and transaction control methods.

The Java applet or application may request a DTS back-end Handler application to be executed at a remote system, pass input data for the Handler and receive response data when the execution completes. The remote system may be the server where the client Java applet was loaded from (the default) or some other DTS environment connected to it (via DTS transparent routing). In case of a stand-alone Java application the default receiver is always the host the application is running in.

The version 1.0 of DTSJAVA package supports only transfer of text data. Thus the input and output data of transactions should be processed via Java String class objects by the calling application. Further releases of DTSJAVA will incorporate methods for binary data usage and conversion from and to other Java data types.

For detailed information about the Distributed Transaction System middleware products, refer to separate documentation, or directly to the Tascomm Engineering WWW site at http://www.tascomm.fi.

Version:
1.00, 97/10/21
Author:
Samuli Salminen

Constructor Index

 o DTSMessage()
Constructs a DTSMessage object without any predefined transaction parameters.
 o DTSMessage(Applet)
Constructs a DTSMessage object for the given source applet, without any predefined transaction parameters.
 o DTSMessage(Applet, String)
Constructs a DTSMessage for the given source applet, with the specified remote Handler name.
 o DTSMessage(Applet, String, String)
Constructs a DTSMessage for the given source applet, with the specified remote Handler and and user input data area.
 o DTSMessage(Applet, String, String, String)
Constructs a DTSMessage for the given source applet, with the specified remote Handler, receiver node and user input data area.
 o DTSMessage(String)
Constructs a DTSMessage with the specified remote Handler name.
 o DTSMessage(String, String)
Constructs a DTSMessage with the specified remote Handler and and user input data area.
 o DTSMessage(String, String, String)
Constructs a DTSMessage with the specified remote Handler, receiver node and user input data area.

Method Index

 o execute()
Executes a DTS call (transaction) as specified.
 o getDataString()
Get the user output data area of the DTS message.
 o getReturnCode()
Get the return code of the executed DTS transaction.
 o getSender()
Get the message sender node of the executed DTS transaction.
 o getTimeStamp()
Get the message timestamp of the executed DTS transaction.
 o setDataString(String)
Set the user input data area of the DTS message.
 o setHandler(String)
Sets the message DTS Handler name.
 o setReceiver(String)
Sets the message receiver DTS node name.
 o setSourceApplet(Applet)
Sets the source applet object.
 o setTargetPort(int)
Sets the target DTS server TCP port number.

Constructors

 o DTSMessage
 public DTSMessage()
Constructs a DTSMessage object without any predefined transaction parameters. At least the remote back-end Handler name must be set afterwards using the setHandler method. If the program is an applet instead of a stand-alone application, it must also identify itself by using the setSourceApplet method.

See Also:
setHandler, setReceiver, setDataString, setSourceApplet
 o DTSMessage
 public DTSMessage(Applet sapplet)
Constructs a DTSMessage object for the given source applet, without any predefined transaction parameters. At least the remote back-end Handler name must be set afterwards using the setHandler method. The source applet is used to determine the target DTS server system, which is always the host where the applet was loaded from.

Parameters:
sapplet - the source applet object.
See Also:
setHandler, setReceiver, setDataString
 o DTSMessage
 public DTSMessage(String handler)
Constructs a DTSMessage with the specified remote Handler name. The Handler name may be changed at a later time using the setHandler method. DTS Handler names are non case-sensitive strings with a maximum length of 8 characters.

Parameters:
handler - the remote DTS back-end Handler name.
Throws: IllegalParameterException
if the given Handler name is invalid (ie. too long).
See Also:
setHandler, setReceiver, setDataString, setSourceApplet
 o DTSMessage
 public DTSMessage(Applet sapplet,
                   String handler)
Constructs a DTSMessage for the given source applet, with the specified remote Handler name. The Handler name may be changed at a later time using the setHandler method. DTS Handler names are non case-sensitive strings with a maximum length of 8 characters. The source applet is used to determine the target DTS server system, which is always the host where the applet was loaded from.

Parameters:
sapplet - the source applet object.
handler - the remote DTS back-end Handler name.
Throws: IllegalParameterException
if the given Handler name is invalid (ie. too long).
See Also:
setHandler, setReceiver, setDataString
 o DTSMessage
 public DTSMessage(String handler,
                   String data)
Constructs a DTSMessage with the specified remote Handler and and user input data area. The parameters may be changed at a later time using the setHandler and setDataString methods. DTS Handler name is a non case-sensitive string with a maximum length of 8 characters. The maximum length of user input data for a DTS message is 31922 characters.

Parameters:
handler - the remote DTS back-end Handler name.
data - the user data area of the message.
Throws: IllegalParameterException
if a given parameter is invalid (ie. too long).
Throws: IllegalLengthException
if given user data is too long.
See Also:
setHandler, setReceiver, setDataString, setSourceApplet
 o DTSMessage
 public DTSMessage(Applet sapplet,
                   String handler,
                   String data)
Constructs a DTSMessage for the given source applet, with the specified remote Handler and and user input data area. The parameters may be changed at a later time using the setHandler and setDataString methods. DTS Handler name is a non case-sensitive string with a maximum length of 8 characters. The maximum length of user input data for a DTS message is 31922 characters. The source applet is used to determine the target DTS server system, which is always the host where the applet was loaded from.

Parameters:
sapplet - the source applet object.
handler - the remote DTS back-end Handler name.
data - the user data area of the message.
Throws: IllegalParameterException
if a given parameter is invalid (ie. too long).
Throws: IllegalLengthException
if given user data is too long.
See Also:
setHandler, setReceiver, setDataString
 o DTSMessage
 public DTSMessage(String handler,
                   String node,
                   String data)
Constructs a DTSMessage with the specified remote Handler, receiver node and user input data area. The parameters and message data may be changed at a later time using the setHandler, setReceiver and setDataString methods. The receiver node must be set only if the target DTS system is not the server where the applet was loaded from, or in case of a stand-alone Java application the localhost. This is called the default DTS receiver. If a node name is specified, the actual transaction goes through the default server which passes it further using DTS transparent routing capabilities. DTS Handler and node names are non case-sensitive strings with a maximum length of 8 characters. The maximum length of user input data for a DTS message is 31922 characters.

Parameters:
handler - the remote DTS back-end Handler name.
node - the remote DTS node name of the system to be called.
data - the user data area of the message.
Throws: IllegalParameterException
if a given parameter is invalid (ie. too long).
Throws: IllegalLengthException
if given user data is too long.
See Also:
setHandler, setReceiver, setDataString, setSourceApplet
 o DTSMessage
 public DTSMessage(Applet sapplet,
                   String handler,
                   String node,
                   String data)
Constructs a DTSMessage for the given source applet, with the specified remote Handler, receiver node and user input data area. The parameters and message data may be changed at a later time using the setHandler, setReceiver and setDataString methods. The receiver node must be set only if the target DTS system is not the server where the applet was loaded from, or in case of a stand-alone Java application the localhost. This is called the default DTS receiver. If a node name is specified, the actual transaction goes through the default server which passes it further using DTS transparent routing capabilities. DTS Handler and node names are non case-sensitive strings with a maximum length of 8 characters. The maximum length of user input data for a DTS message is 31922 characters. The source applet is used to determine the target DTS server system, which is always the host where the applet was loaded from.

Parameters:
sapplet - the source applet object.
handler - the remote DTS back-end Handler name.
node - the remote DTS node name of the system to be called.
data - the user data area of the message.
Throws: IllegalParameterException
if a given parameter is invalid (ie. too long).
Throws: IllegalLengthException
if given user data is too long.
See Also:
setHandler, setReceiver, setDataString

Methods

 o setSourceApplet
 public void setSourceApplet(Applet sapplet)
Sets the source applet object. Identify Java applet that is making the DTS transaction. The source applet is used to determine the target DTS server system, which is always the host where the applet was loaded from. Any user defined class derived from the Applet class can be passed to this method. Typically your applet would issue setSourceApplet(this) before executing the transaction. The source applet may be given in the DTSMessage class constructors as well to avoid a separate call to this method. If your applet does not identify itself to the DTSMessage object, executing a transaction will most probably result in an exception indicating that the program is unable to connect to the local host running the browser. Instead of the local host an applet would want to target its DTS messages to the server host.

Parameters:
sapplet - the source applet object.
 o setTargetPort
 public void setTargetPort(int tcpport)
Sets the target DTS server TCP port number. Define the number of the listening DTS back-end server TCP port the communication interface should attempt to connect to. A running DTS back-end server process must be present in this port at the remote server. If no port is specified by a call to this method the default number 2424 will be used.

The usage of this method is not encouraged to allow highest possible isolation of network dependent issues in the user application. In all cases the listening port on the server side should be set to 2424 if possible. The target port should be set to something else by the calling Java program only if there is no chance to use the default at the server.

Parameters:
tcpport - the number of the remote DTS server port.
 o setHandler
 public void setHandler(String handler) throws IllegalParameterException
Sets the message DTS Handler name. Identify the remote DTS back-end Handler that should receive the message and execute the transaction. The Handler must be set always before entering the execute method. DTS Handler names are non case-sensitive strings with a maximum length of 8 characters.

Parameters:
handler - the remote DTS back-end Handler name.
Throws: IllegalParameterException
if the given Handler name is invalid (ie. too long).
 o setReceiver
 public void setReceiver(String receiver) throws IllegalParameterException
Sets the message receiver DTS node name. Identify the remote DTS system this Java applet or application is sending the message to. The receiver node must be set only if the target DTS system is not the server where the applet was loaded from, or in case of a stand-alone Java application the localhost. This is called the default DTS receiver. If a node name is specified the actual transaction goes through the default receiver which passes it further using DTS transparent routing capabilities. DTS node names are non case-sensitive strings with a maximum length of 8 characters. An empty node name ("") implies the default receiver as the message destination. This is also the default when a new DTSMessage object is being created.

Parameters:
node - the remote DTS node name of the system to be called.
Throws: IllegalParameterException
if the given node name is invalid (ie. too long)
 o setDataString
 public void setDataString(String msgData) throws IllegalLengthException
Set the user input data area of the DTS message. Fill up the user data area of the DTS transaction, to be passed to the specified remote back-end Handler. The input data is taken from a Java String and internally converted into format suitable for DTS network transmission. All the necessary multinational and special character conversions are performed automatically by the underlying mechanisms. However, the set of special characters that DTS can properly convert between different environments depends on the target systems in question (for example, ASCII vs. IBM EBCDIC). The number of characters in the given String directly reflects the number of bytes in the constructed DTS input message user data area. Binary data transfer is not supported in version 1.0 of DTSJAVA package. The maximum length of a DTS message is 32000 bytes. However, the underlying interface reserves two 39-byte header areas for its own use, thus leaving a maximum of 31922 bytes (characters) for the use of user input data.

Parameters:
data - the user data area of the message.
Throws: IllegalLengthException
if data length exceeds the maximum of 31922 characters.
 o execute
 public void execute() throws CommunicationException, UnknownNodeException, UnknownHandlerException, SecurityViolationException, CriticalException, IllegalParameterException
Executes a DTS call (transaction) as specified. A request to the specified DTS back-end Handler at the specified remote DTS node will be sent and a reply received, unless a communication or remote system failure occurs. A call to this method will block the calling Java applet or application until the execution of the DTS back-end Handler at the remote system completes, or a communication failure, timeout or some other exception occurs.

Throws: CommunicationException
if an error occurred during the network communication of the DTS transaction.
Throws: UnknownNodeException
if the remote DTS node name specified for the transaction is unknown.
Throws: UnknownHandlerException
if the back-end Handler specified for the transaction is unknown.
Throws: SecurityViolationException
if the DTS transaction request is not allowed at the remote system.
Throws: CriticalException
if the DTS transaction request failed because of some other reason.
Throws: IllegalParameterException
if no remote back-end Handler has been specified for the transaction.
See Also:
getDataString
 o getDataString
 public String getDataString() throws IllegalStateException
Get the user output data area of the DTS message. Retrieve the user data area of the DTS transaction reply, received from the remote back-end Handler. The output data is returned as a Java String and internally converted from the DTS network transmission format. All the necessary multinational and special character conversions are performed automatically by the underlying mechanisms. However, the set of special characters that DTS can properly convert between different environments depends on the target systems in question (for example, ASCII vs. IBM EBCDIC). The number of characters in the returned String directly reflects the number of bytes in the returned DTS output message user data area. Binary data transfer is not supported in version 1.0 of DTSJAVA package.

The maximum length of a DTS message is 32000 bytes. However, the underlying interface reserves two bytes for the DTS return code, thus leaving a maximum of 31998 bytes (characters) for the use of user output data.

Returns:
the reply data area of the message.
Throws: IllegalStateException
if called at a state when no DTS transaction has been executed.
 o getReturnCode
 public int getReturnCode() throws IllegalStateException
Get the return code of the executed DTS transaction. Retrieve the DTS return code numeric value as returned by the underlying communication interface or remote DTS server system. A zero return code always indicates successful completion of the transaction. Normally there is no need to check the return code after executing a DTS transaction if exceptions thrown by the execute method have been catched and processed properly. The getReturnCode method of the DTSException class can be used in the catch block of the code to check the actual numeric code when a transaction failure occurs.

Returns:
the DTS return code of the transaction.
Throws: IllegalStateException
if called at a state when no DTS transaction has been executed.
See Also:
DTSException
 o getTimeStamp
 public String getTimeStamp() throws IllegalStateException
Get the message timestamp of the executed DTS transaction. Retrieve the DTS message unique timestamp used as the identification of the executed DTS transaction. It is returned as a String of 12 characters long, where the format is always YDDDHHMMSSXX:

Y = Last digit of current year
DDD = Day of year (1-366)
HH = Hours (00-23)
MM = Minutes (00-59)
SS = Seconds (00-59)
XX = Hundreths of a second (00-99)

Returns:
the DTS message timestamp of the transaction.
Throws: IllegalStateException
if called at a state when no DTS transaction has been executed.
 o getSender
 public String getSender() throws IllegalStateException
Get the message sender node of the executed DTS transaction. Retrieve the DTS message sender node name used as the identification of the executed DTS transaction. In DTSJAVA usage it is always the IP address of the local system, converted to hexadecimal format of 8 characters. For example, "C26409A1" for IP address 194.100.9.161.

Returns:
the DTS message sender node of the transaction.
Throws: IllegalStateException
if called at a state when no DTS transaction has been executed.

All Packages  Class Hierarchy  This Package  Previous  Next  Index