net.sourceforge.jwap.wtp
Class CWTPInitiator

java.lang.Object
  |
  +--net.sourceforge.jwap.wtp.CWTPInitiator
All Implemented Interfaces:
IWTPTransaction

public class CWTPInitiator
extends java.lang.Object
implements IWTPTransaction

This class implements a WTP state machine of one transaction according to the WTP specification by the WAP Forum. It uses CWTPManagement to send the PDUs. CWTPManagement receives PDUs from the remote, decodes them and calls #process(CWTPPDU pdu) of the corresponding tranaction (this class).

To be informed of thrown service primitives by this layer, you should implement the interface IWTPUpperLayer and give it with the constructor.

To construct a service primitive to be processed by this WTP-socket, use objects of the class CWTPEvent, that implement service primitives.

To Use a whole WAP Stack besides you need the WSP layer, implemented in package mmsjua.wap.wsp.

Notice, that development is actually in progress. Most features are implemented but only for Initiator, not for a responder! (for a definition of these terms refer to the spec, section 3.2.)

Section descriptions used in this class refer to WTP Specification WAP-224-WTP-20010710-a by the WAP Forum


Field Summary
static int AEC_MAX
           
static int RCR_MAX
           
 
Fields inherited from interface net.sourceforge.jwap.wtp.IWTPTransaction
CLASS_TYPE_0, CLASS_TYPE_1, CLASS_TYPE_2
 
Constructor Summary
CWTPInitiator(CWTPSocket wtp_Socket, IWTPUpperLayer upper_Layer, CWTPEvent initPacket, boolean ackType, byte classType)
          Constructs a CWTPSocket using a DatagramSocket (UDP).
 
Method Summary
 void abort()
          use this method to invoke a TR-ABORT.REQ by the upper Layer
 void abort(short abortReason)
          use this method to invoke a TR-ABORT.REQ by the upper Layer
 void close(short reasonCode)
           
 short getAbortCode()
           
 byte getClassType()
           
 int getTID()
           
 boolean isAborted()
           
 void process(CWTPEvent p)
          Invoked by higher layers to process given service primitives according to state machine described in section 9.5.
Notice: Only WTP Initiator is implemented!
 void process(CWTPPDU pdu)
          Invoked by the run()-Method of the Management-Entity CWTPManagement.
 void process(EWTPCorruptPDUException e)
           
 void setClassType(byte classType)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RCR_MAX

public static final int RCR_MAX

AEC_MAX

public static final int AEC_MAX
Constructor Detail

CWTPInitiator

public CWTPInitiator(CWTPSocket wtp_Socket,
                     IWTPUpperLayer upper_Layer,
                     CWTPEvent initPacket,
                     boolean ackType,
                     byte classType)
Constructs a CWTPSocket using a DatagramSocket (UDP). Even implementing all parameters belonging to according to TR-Invoke service primitive (section 5.3.1), which are not temporary for one transaction. This socket can be used several times by service primitives. After all it has to be closed by calling close()
Parameters:
to - destination address (section 5.3.1.3)
port - destination port (section 5.3.1.4)
ackType - Ack Type (section 5.3.1.5)
classType - Class Type (0, 1 or 2) (section 5.3.1.8)
Throws:
java.lang.IllegalArgumentException -  
SocketException -  
See Also:
close(short)
Method Detail

process

public void process(CWTPPDU pdu)
             throws EWTPAbortedException
Invoked by the run()-Method of the Management-Entity CWTPManagement. Processes given protocol data units according to state machine described in section 9.5 Notice: Only WTP Initiator is implemented!
Specified by:
process in interface IWTPTransaction
Parameters:
pdu - the pdu to be processed in the state machine

process

public void process(CWTPEvent p)
             throws EWTPAbortedException
Invoked by higher layers to process given service primitives according to state machine described in section 9.5.
Notice: Only WTP Initiator is implemented!
Specified by:
process in interface IWTPTransaction
Parameters:
p - the Service Primitive to be processed

process

public void process(EWTPCorruptPDUException e)
Specified by:
process in interface IWTPTransaction

abort

public void abort()
use this method to invoke a TR-ABORT.REQ by the upper Layer
Specified by:
abort in interface IWTPTransaction

abort

public void abort(short abortReason)
use this method to invoke a TR-ABORT.REQ by the upper Layer
Specified by:
abort in interface IWTPTransaction

close

public void close(short reasonCode)
Specified by:
close in interface IWTPTransaction

getTID

public int getTID()
Specified by:
getTID in interface IWTPTransaction

setClassType

public void setClassType(byte classType)
                  throws java.lang.IllegalArgumentException
Specified by:
setClassType in interface IWTPTransaction

getClassType

public byte getClassType()
Specified by:
getClassType in interface IWTPTransaction

isAborted

public boolean isAborted()
Specified by:
isAborted in interface IWTPTransaction

getAbortCode

public short getAbortCode()
Specified by:
getAbortCode in interface IWTPTransaction