ChatApp
Class ChatRegistryServant

java.lang.Object
  |
  +--org.omg.CORBA.portable.ObjectImpl
        |
        +--org.omg.CORBA.DynamicImplementation
              |
              +--ChatApp._ChatRegistryImplBase
                    |
                    +--ChatApp.ChatRegistryServant

public class ChatRegistryServant
extends _ChatRegistryImplBase

This class represents the server's registry for maintaining clients IDs. The ChatRegistryServant extends the _ChatRegistryImplBase which implements the ChatRegistry interface The ChatRegistry has a set of methods that are remotely invoked by the ChatClient objects using CORBA is the network middleware.

See Also:
Serialized Form

Constructor Summary
ChatRegistryServant(org.omg.CORBA.ORB orb)
          Constructs a new ChatRegistryServant.
 
Method Summary
 void broadcast(byte[] Message, java.lang.String sourceID)
          Broadcasts a message from one registered client to all other registered clients on the Chat Server.
 void register(java.lang.String clientID)
          Registers a client to the chat server.
 void sendPrivateMessage(byte[] Message, java.lang.String SourceID, java.lang.String DestID)
          Sends a private message from one registered user to another registered user.
 void unregister(java.lang.String clientID)
          Unregisters a client from the server
 
Methods inherited from class ChatApp._ChatRegistryImplBase
_ids, invoke
 
Methods inherited from class org.omg.CORBA.portable.ObjectImpl
_create_request, _create_request, _duplicate, _get_delegate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_delegate, _set_policy_override, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChatRegistryServant

public ChatRegistryServant(org.omg.CORBA.ORB orb)
Constructs a new ChatRegistryServant. Using the ORB, the ChatRegistryServant initializes the NamingContext
Parameters:
orb - The CORBA object to fetch objects from the CORBA NameService
Method Detail

register

public void register(java.lang.String clientID)
Registers a client to the chat server. After registration the server holds the client's ID The server informs the clients about the new added client.
Parameters:
clientID - The ID of the registering client

unregister

public void unregister(java.lang.String clientID)
Unregisters a client from the server
Parameters:
clientID - The ID of the unregistrating client. key.

sendPrivateMessage

public void sendPrivateMessage(byte[] Message,
                               java.lang.String SourceID,
                               java.lang.String DestID)
Sends a private message from one registered user to another registered user.
Parameters:
Message - The message from the client
SourceID - The ID of the sender
DestID - The ID of the receiver

broadcast

public void broadcast(byte[] Message,
                      java.lang.String sourceID)
Broadcasts a message from one registered client to all other registered clients on the Chat Server. The server simply sends the message to all other clients (doing remote method invokation with the clients objects)
Parameters:
Message - The encrypted message
sourceID - The ID of the sender.