org.beepcore.beep.core
Class Channel

java.lang.Object
  |
  +--org.beepcore.beep.core.Channel
Direct Known Subclasses:
SharedChannel

public class Channel
extends java.lang.Object

Channel is a conduit for a certain kind of traffic over a session, determined by the profile of the channel. Channels are created by Session


Field Summary
static int STATE_ABORTED
           
static int STATE_ACTIVE
           
static int STATE_CLOSE_PENDING
           
static int STATE_CLOSED
           
static int STATE_CLOSING
           
static int STATE_INITIALIZED
           
static int STATE_STARTING
           
static int STATE_TUNING
           
static int STATE_TUNING_PENDING
           
 
Constructor Summary
protected Channel(java.lang.String profile, java.lang.String number, MessageListener listener, boolean blocking, Session session)
          Create a Channel object.
protected Channel(java.lang.String profile, java.lang.String number, Session session)
           
 
Method Summary
 void close()
          Closes the channel.
 java.lang.Object getAppData()
          Returns application context data previously set using setAppData().
 int getBufferSize()
          Returns the receive buffer size for this channel.
 int getBufferUsed()
          Returns the size of the used portion of the receive buffer for this channel.
 MessageListener getMessageListener()
          Returns the message listener for this channel.
 int getNumber()
          Return the number of this Channel.
 java.lang.String getProfile()
          Returns the profile for this channel.
 Session getSession()
          Returns the session for this channel.
 java.lang.String getStartData()
          Used to get data that can be piggybacked on a profile reply to a start channel request (or any other scenario we choose) Could be called by users, profile implementors etc.
 MessageStatus sendMSG(OutputDataStream stream, ReplyListener replyListener)
          Sends a message of type MSG.
 void setAppData(java.lang.Object applicationData)
          Set the application context data member for future retrieval.
 MessageListener setMessageListener(MessageListener ml)
          Sets the MessageListener for this channel.
 void setReceiveBufferSize(int size)
          Sets the receive buffer size for this channel.
 void setStartData(java.lang.String data)
          Used to set data that can be piggybacked on a profile reply to a start channel request (or any other scenario we choose) called by Channel Zero
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_INITIALIZED

public static final int STATE_INITIALIZED
See Also:
Constant Field Values

STATE_STARTING

public static final int STATE_STARTING
See Also:
Constant Field Values

STATE_ACTIVE

public static final int STATE_ACTIVE
See Also:
Constant Field Values

STATE_TUNING_PENDING

public static final int STATE_TUNING_PENDING
See Also:
Constant Field Values

STATE_TUNING

public static final int STATE_TUNING
See Also:
Constant Field Values

STATE_CLOSE_PENDING

public static final int STATE_CLOSE_PENDING
See Also:
Constant Field Values

STATE_CLOSING

public static final int STATE_CLOSING
See Also:
Constant Field Values

STATE_CLOSED

public static final int STATE_CLOSED
See Also:
Constant Field Values

STATE_ABORTED

public static final int STATE_ABORTED
See Also:
Constant Field Values
Constructor Detail

Channel

protected Channel(java.lang.String profile,
                  java.lang.String number,
                  MessageListener listener,
                  boolean blocking,
                  Session session)
Create a Channel object.

Parameters:
profile - URI string of the profile that this channel will "speak".
number - The channel number.
listener - message listener that will receive callbacks for messages received on this channel
session - Session over which this channel sends/receives messages
See Also:
Session, MessageListener

Channel

protected Channel(java.lang.String profile,
                  java.lang.String number,
                  Session session)
Method Detail

close

public void close()
           throws BEEPException
Closes the channel.

Throws:
BEEPException

getAppData

public java.lang.Object getAppData()
Returns application context data previously set using setAppData().

See Also:
setAppData(java.lang.Object)

setAppData

public void setAppData(java.lang.Object applicationData)
Set the application context data member for future retrieval.

See Also:
getAppData()

getBufferSize

public int getBufferSize()
Returns the receive buffer size for this channel.


getBufferUsed

public int getBufferUsed()
Returns the size of the used portion of the receive buffer for this channel.


getNumber

public int getNumber()
Return the number of this Channel.


setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws BEEPException
Sets the receive buffer size for this channel. Default size is 4K.

Parameters:
size -
Throws:
BEEPException

setMessageListener

public MessageListener setMessageListener(MessageListener ml)
Sets the MessageListener for this channel.

Parameters:
ml -
Returns:
The previous MessageListener or null if none was set.

getMessageListener

public MessageListener getMessageListener()
Returns the message listener for this channel.


getSession

public Session getSession()
Returns the session for this channel.


sendMSG

public MessageStatus sendMSG(OutputDataStream stream,
                             ReplyListener replyListener)
                      throws BEEPException
Sends a message of type MSG.

Parameters:
stream - Data to send in the form of DataStream.
replyListener - A "one-shot" listener that will handle replies to this sendMSG listener.
Returns:
MessageStatus
Throws:
BEEPException - if an error is encoutered.
See Also:
OutputDataStream, MessageStatus

getProfile

public java.lang.String getProfile()
Returns the profile for this channel.


setStartData

public void setStartData(java.lang.String data)
Used to set data that can be piggybacked on a profile reply to a start channel request (or any other scenario we choose) called by Channel Zero


getStartData

public java.lang.String getStartData()
Used to get data that can be piggybacked on a profile reply to a start channel request (or any other scenario we choose) Could be called by users, profile implementors etc. to fetch data off a profile response.

Returns:
String the attached data, if any


Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.