net.sf.beep4j.internal.tcp
Class TCPMapping

java.lang.Object
  extended by net.sf.beep4j.internal.tcp.TCPMapping
All Implemented Interfaces:
SessionListener, ChannelControllerFactory, TransportMapping

public class TCPMapping
extends java.lang.Object
implements TransportMapping, ChannelControllerFactory


Constructor Summary
TCPMapping(Transport transport)
           
TCPMapping(Transport transport, ChannelControllerFactory factory)
           
TCPMapping(Transport transport, ChannelControllerFactory factory, int bufferSize)
           
 
Method Summary
 void channelClosed(int channelNumber)
           
 void channelStarted(int channelNumber)
           
 void checkFrame(int channel, long seqno, int size)
          Checks that an incoming frame is valid.
 void closeTransport()
          Instructs the mapping to close the underlying Transport object.
 DefaultChannelController createChannelController(int channelNumber, Transport transport)
          Creates a new ChannelController for the channel identified by the channelNumber.
 void frameReceived(int channel, long seqno, int size)
          Invoked by the framework to notify the mapping that the parsing of the message has completed.
 void processMappingFrame(java.lang.String[] tokens)
          Process a mapping frame.
 void sendANS(int channel, int messageNumber, int answerNumber, Message message)
          Sends a message of type ANS.
 void sendERR(int channel, int messageNumber, Message message)
          Sends a message of type ERR.
 void sendMSG(int channel, int messageNumber, Message message)
          Sends a message of type MSG.
 void sendNUL(int channel, int messageNumber)
          Sends a message of type NUL.
 void sendRPY(int channel, int messageNumber, Message message)
          Sends a message of type RPY.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPMapping

public TCPMapping(Transport transport)

TCPMapping

public TCPMapping(Transport transport,
                  ChannelControllerFactory factory)

TCPMapping

public TCPMapping(Transport transport,
                  ChannelControllerFactory factory,
                  int bufferSize)
Method Detail

channelStarted

public void channelStarted(int channelNumber)
Specified by:
channelStarted in interface SessionListener

channelClosed

public void channelClosed(int channelNumber)
Specified by:
channelClosed in interface SessionListener

createChannelController

public DefaultChannelController createChannelController(int channelNumber,
                                                        Transport transport)
Description copied from interface: ChannelControllerFactory
Creates a new ChannelController for the channel identified by the channelNumber. The transport is the interface to the implementation of the Transport layer.

Specified by:
createChannelController in interface ChannelControllerFactory
Parameters:
channelNumber - the channel number
transport - the Transport implementation
Returns:
a fully initialized ChannelController

checkFrame

public void checkFrame(int channel,
                       long seqno,
                       int size)
Description copied from interface: TransportMapping
Checks that an incoming frame is valid. This method is called after the header has been parsed, but before the parsing of the body has started.

Specified by:
checkFrame in interface TransportMapping
Parameters:
channel - the channel number of the message
seqno - the sequence number of the message
size - the payload size of the message

frameReceived

public void frameReceived(int channel,
                          long seqno,
                          int size)
Description copied from interface: TransportMapping
Invoked by the framework to notify the mapping that the parsing of the message has completed.

Specified by:
frameReceived in interface TransportMapping
Parameters:
channel - the channel number of the message
seqno - the sequence number of the message
size - the size of the message

processMappingFrame

public void processMappingFrame(java.lang.String[] tokens)
Description copied from interface: TransportMapping
Process a mapping frame. This method receives the header tokens. As the TCP mapping is currently the only existing mapping, this is sufficient. If there ever exists another mapping that defines a payload for mapping frames, some changes would have to be implemented.

Specified by:
processMappingFrame in interface TransportMapping
Parameters:
tokens - the header tokens (i.e. header is split on spaces)

sendANS

public void sendANS(int channel,
                    int messageNumber,
                    int answerNumber,
                    Message message)
Description copied from interface: TransportMapping
Sends a message of type ANS.

Specified by:
sendANS in interface TransportMapping
Parameters:
channel - the channel number
messageNumber - the message number
message - the message

sendERR

public void sendERR(int channel,
                    int messageNumber,
                    Message message)
Description copied from interface: TransportMapping
Sends a message of type ERR.

Specified by:
sendERR in interface TransportMapping
Parameters:
channel - the channel number
messageNumber - the message number
message - the message

sendMSG

public void sendMSG(int channel,
                    int messageNumber,
                    Message message)
Description copied from interface: TransportMapping
Sends a message of type MSG.

Specified by:
sendMSG in interface TransportMapping
Parameters:
channel - the channel number
messageNumber - the message number
message - the message

sendNUL

public void sendNUL(int channel,
                    int messageNumber)
Description copied from interface: TransportMapping
Sends a message of type NUL.

Specified by:
sendNUL in interface TransportMapping
Parameters:
channel - the channel number
messageNumber - the message number

sendRPY

public void sendRPY(int channel,
                    int messageNumber,
                    Message message)
Description copied from interface: TransportMapping
Sends a message of type RPY.

Specified by:
sendRPY in interface TransportMapping
Parameters:
channel - the channel number
messageNumber - the message number
message - the message

closeTransport

public void closeTransport()
Description copied from interface: TransportMapping
Instructs the mapping to close the underlying Transport object.

Specified by:
closeTransport in interface TransportMapping


Copyright © 2007 null. All Rights Reserved.