com.sun.media.jsdt.template
Class ChannelProxy

java.lang.Object
  |
  +--com.sun.media.jsdt.template.templateJSDTObject
        |
        +--com.sun.media.jsdt.template.ManageableProxy
              |
              +--com.sun.media.jsdt.template.ChannelProxy

public final class ChannelProxy
extends com.sun.media.jsdt.template.ManageableProxy
implements AbstractChannelProxy

JSDT Session proxy class.

Version:
1.5 - 7th January 1999
Author:
Rich Burridge

Constructor Summary
ChannelProxy()
           
 
Method Summary
 void addConsumer(com.sun.media.jsdt.Client client, com.sun.media.jsdt.ChannelConsumer consumer)
           addConsumer add a new channel consumer for this client.
 boolean dataAvailable(com.sun.media.jsdt.Client client)
           dataAvailable
 java.lang.Object getProxy()
           getProxy get a handle to the "client-side" proxy for this Channel.
 void initProxy(java.lang.String name, SessionImpl session, java.lang.Object object)
           initProxy initialise the "client-side" proxy for this Channel.
 void join(com.sun.media.jsdt.Client client, boolean authenticate, int mode)
           join
 void leave(com.sun.media.jsdt.Client client)
           leave removes a Client from this Channel.
 java.lang.String[] listConsumerNames()
           list the names of the Clients who are currently consuming this Channel.
 com.sun.media.jsdt.Data receive(com.sun.media.jsdt.Client client, long timeout, boolean ignoreTimeout)
           receive is used to receive data from other clients joined to this channel.
 void removeConsumer(com.sun.media.jsdt.Client client, com.sun.media.jsdt.ChannelConsumer consumer)
           removeConsumer delete a channel consumer from this client.
 void send(com.sun.media.jsdt.Client sendingClient, char recipient, java.lang.String receivingClientName, com.sun.media.jsdt.Data data, boolean uniform)
           send is used to send data to clients joined to the specified channel.
 
Methods inherited from class com.sun.media.jsdt.template.ManageableProxy
addListener, changeListenerMask, changeManagerMask, destroy, expel, getSession, invite, isManaged, join, leave, listClientNames, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelProxy

public ChannelProxy()
Method Detail

initProxy

public void initProxy(java.lang.String name,
                      SessionImpl session,
                      java.lang.Object object)
initProxy initialise the "client-side" proxy for this Channel.
Specified by:
initProxy in interface AbstractChannelProxy
Parameters:
name - the name of the Channel proxy being constructed.
session - the client-side session the Channel belongs to.
object - the client-side Channel.
Overrides:
initProxy in class com.sun.media.jsdt.template.ManageableProxy

getProxy

public java.lang.Object getProxy()
getProxy get a handle to the "client-side" proxy for this Channel.
Specified by:
getProxy in interface AbstractChannelProxy
Returns:
a handle to the "client-side" proxy for this Channel.
Overrides:
getProxy in class com.sun.media.jsdt.template.ManageableProxy

addConsumer

public void addConsumer(com.sun.media.jsdt.Client client,
                        com.sun.media.jsdt.ChannelConsumer consumer)
                 throws com.sun.media.jsdt.ConnectionException,
                        com.sun.media.jsdt.InvalidClientException,
                        com.sun.media.jsdt.NoSuchChannelException,
                        com.sun.media.jsdt.NoSuchClientException,
                        com.sun.media.jsdt.NoSuchConsumerException,
                        com.sun.media.jsdt.NoSuchSessionException,
                        com.sun.media.jsdt.PermissionDeniedException,
                        com.sun.media.jsdt.TimedOutException
addConsumer add a new channel consumer for this client. The client's channel consumers gets informed when there is data available on a channel.
Specified by:
addConsumer in interface AbstractChannelProxy
Parameters:
client - the client to associate this consumer with.
consumer - the new channel consumer for this client.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchChannelException - if the channel given does not exist.
com.sun.media.jsdt.NoSuchClientException - if the client given doesn't exist.
com.sun.media.jsdt.NoSuchConsumerException - if the consumer given doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if you do not have permission for this operation.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

removeConsumer

public void removeConsumer(com.sun.media.jsdt.Client client,
                           com.sun.media.jsdt.ChannelConsumer consumer)
                    throws com.sun.media.jsdt.ConnectionException,
                           com.sun.media.jsdt.InvalidClientException,
                           com.sun.media.jsdt.NoSuchChannelException,
                           com.sun.media.jsdt.NoSuchClientException,
                           com.sun.media.jsdt.NoSuchConsumerException,
                           com.sun.media.jsdt.NoSuchSessionException,
                           com.sun.media.jsdt.PermissionDeniedException,
                           com.sun.media.jsdt.TimedOutException
removeConsumer delete a channel consumer from this client. This channel consumer will no longer get informed when there is data available on this channel.
Specified by:
removeConsumer in interface AbstractChannelProxy
Parameters:
client - the client to associate this consumer with.
consumer - the channel consumer to delete from this client.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchChannelException - if the channel given does not exist.
com.sun.media.jsdt.NoSuchClientException - if the client given doesn't exist.
com.sun.media.jsdt.NoSuchConsumerException - if the consumer given doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if you do not have permission for this operation.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

listConsumerNames

public java.lang.String[] listConsumerNames()
                                     throws com.sun.media.jsdt.ConnectionException,
                                            com.sun.media.jsdt.NoSuchChannelException,
                                            com.sun.media.jsdt.NoSuchSessionException,
                                            com.sun.media.jsdt.TimedOutException
list the names of the Clients who are currently consuming this Channel.
Specified by:
listConsumerNames in interface AbstractChannelProxy
Returns:
a sorted array of names of Clients currently comsuming this Channel.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.NoSuchChannelException - if this Channel doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

join

public void join(com.sun.media.jsdt.Client client,
                 boolean authenticate,
                 int mode)
          throws com.sun.media.jsdt.ConnectionException,
                 com.sun.media.jsdt.InvalidClientException,
                 com.sun.media.jsdt.NoSuchChannelException,
                 com.sun.media.jsdt.NoSuchClientException,
                 com.sun.media.jsdt.NoSuchSessionException,
                 com.sun.media.jsdt.PermissionDeniedException,
                 com.sun.media.jsdt.NameInUseException,
                 com.sun.media.jsdt.TimedOutException
join
Specified by:
join in interface AbstractChannelProxy
Parameters:
client - identifies the client wishing to join this channel.
authenticate - if true, authenticate the client.
mode - the mode which can be one of, READONLY, WRITEONLY or READWRITE.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchChannelException - if this Channel doesn't exist.
com.sun.media.jsdt.NoSuchClientException - if the client given doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if you do not have permission for this operation.
com.sun.media.jsdt.NameInUseException - if a Client with this name is already joined to this Manageable object.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

leave

public void leave(com.sun.media.jsdt.Client client)
           throws com.sun.media.jsdt.ConnectionException,
                  com.sun.media.jsdt.InvalidClientException,
                  com.sun.media.jsdt.NoSuchChannelException,
                  com.sun.media.jsdt.NoSuchClientException,
                  com.sun.media.jsdt.NoSuchSessionException,
                  com.sun.media.jsdt.TimedOutException
leave removes a Client from this Channel. This Client will no longer be known to this Channel. Listeners of this Channel will be sent an indication when this happens.
Specified by:
leave in interface AbstractChannelProxy
Parameters:
client - the Client in question.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchChannelException - if this Channel doesn't exist.
com.sun.media.jsdt.NoSuchClientException - if this Client doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

receive

public com.sun.media.jsdt.Data receive(com.sun.media.jsdt.Client client,
                                       long timeout,
                                       boolean ignoreTimeout)
                                throws com.sun.media.jsdt.ConnectionException,
                                       com.sun.media.jsdt.InvalidClientException,
                                       com.sun.media.jsdt.NoSuchClientException,
                                       com.sun.media.jsdt.NoSuchSessionException,
                                       com.sun.media.jsdt.PermissionDeniedException,
                                       com.sun.media.jsdt.TimedOutException
receive is used to receive data from other clients joined to this channel. If the timeout value is to be ignored, then it will block if there is no data to read. The dataAvailable method can be used to check if there is data that can be received on this channel. Otherwise if Data is immediately available then it will return with it, else it will wait until the timeout period, specified by the timeout argument in milliseconds, has elapsed. If no Data is available at this time, it will return null. Note that if Data becomes available during the timeout period, this method will be woken up and that Data is immediately returned.
Specified by:
receive in interface AbstractChannelProxy
Parameters:
client - identifies the client wishing to receive data from this channel. This client must already be successfully joined to this channel.
timeout - the maximum time to wait in milliseconds.
ignoreTimeout - ignore the timeout argument, and block until data becomes available.
Returns:
the next Data object available on this channel, or null if a timeout value was specified and the timeout period has expired, and there is currently no Data available.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchClientException - if the client given doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if you do not have permission for this operation.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

dataAvailable

public boolean dataAvailable(com.sun.media.jsdt.Client client)
                      throws com.sun.media.jsdt.ConnectionException,
                             com.sun.media.jsdt.InvalidClientException,
                             com.sun.media.jsdt.NoSuchClientException,
                             com.sun.media.jsdt.NoSuchSessionException,
                             com.sun.media.jsdt.PermissionDeniedException,
                             com.sun.media.jsdt.TimedOutException
dataAvailable
Specified by:
dataAvailable in interface AbstractChannelProxy
Parameters:
client - identifies the client wishing to check if there is data available to receive on this channel. This client must already be successfully joined to this channel.
Returns:
true if data available to read on this channel; false if not.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchClientException - if the client given doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if you do not have permission for this operation.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

send

public void send(com.sun.media.jsdt.Client sendingClient,
                 char recipient,
                 java.lang.String receivingClientName,
                 com.sun.media.jsdt.Data data,
                 boolean uniform)
          throws com.sun.media.jsdt.ConnectionException,
                 com.sun.media.jsdt.InvalidClientException,
                 com.sun.media.jsdt.NoSuchChannelException,
                 com.sun.media.jsdt.NoSuchClientException,
                 com.sun.media.jsdt.NoSuchConsumerException,
                 com.sun.media.jsdt.NoSuchSessionException,
                 com.sun.media.jsdt.PermissionDeniedException,
                 com.sun.media.jsdt.TimedOutException
send is used to send data to clients joined to the specified channel. A message containing the data is sent to the session server which then sends messages to the appropriate receiving channel listeners.
Specified by:
send in interface AbstractChannelProxy
Parameters:
sendingClient - the client sending the data.
recipient - who is going to receive this message. This can be all channel receipts (ChannelImpl.D_All), or all other channel recipients (ChannelImpl.D_Others) or just a single client (ChannelImpl.D_Client).
receivingClientName - the name of the client receiving the data, or null if we are sending this message to all (or all other) channel recipients.
data - the data being send over this channel.
uniform - set true if this is a uniform send.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchChannelException - if the channel given does not exist.
com.sun.media.jsdt.NoSuchClientException - if the client given does not exist.
com.sun.media.jsdt.NoSuchConsumerException - if this Client doesn't have a ChannelConsumer associated with it.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if you do not have permission for this operation.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.