|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ks.server.communicator.Communicator
Responsible for all communication from the server to its clients.
Communicator will need access to an IUserManager object to be able to identify the set of active uers during a broadcast. Note that we read Commands from the client and write messages to the client.
Field Summary | |
protected java.util.Vector |
provided
provided set of interfaces. |
protected java.util.Vector |
required
required set of interfaces. |
protected IReadonlyUserManager |
userManagerRO
The readonly access to the user manager. |
Constructor Summary | |
Communicator()
Communicator constructor comment. |
Method Summary | |
boolean |
activate()
Nothing to do here, really. |
void |
broadcast(java.util.Enumeration users,
Message m)
Broadcast command to all users in given Enumeration EXCEPT self. |
void |
broadcast(Message m)
Broadcast command to all users EXCEPT self. |
boolean |
connect(IBlock block,
java.lang.String interfaceName)
|
void |
connectUser(java.lang.String userName,
ICommunicator agent)
Register with the communicator the means to interact with given userName. |
void |
deactivate()
Nothing to do here. |
java.util.Enumeration |
getProvided()
We expose ProcessCommand interface. |
java.util.Enumeration |
getRequired()
We expose ProcessCommand and IOutput required interfaces. |
void |
output(Message m)
Delivers message to intended receiver. |
boolean |
process(java.lang.String userName,
Command com)
Communicator handles some common communication commands TellCommand ShoutCommand |
protected boolean |
processShout(java.lang.String userName,
ShoutCommand sc)
Process a ShoutCommand. |
protected boolean |
processTell(java.lang.String userName,
TellCommand tc)
Process a TellCommand. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected IReadonlyUserManager userManagerRO
protected java.util.Vector provided
protected java.util.Vector required
Constructor Detail |
public Communicator()
Method Detail |
public void broadcast(Message m)
Note: attributes for Message m are modified within this method to ensure efficient delivery. In particular, after this method is invoked, the value of m.getTargetUser() may have been changed.
m
- Message to be delivered to all active userspublic void broadcast(java.util.Enumeration users, Message m)
Note: attributes for Message m are modified within this method to ensure efficient delivery. In particular, after this method is invoked, the value of m.getTargetUser() may have been changed.
users
- Enumeration (of String) of usersm
- Message to be delivered to all active userspublic void connectUser(java.lang.String userName, ICommunicator agent)
userName
- String representing user connecting to serveragent
- ICommunicator object managing our communication.public void output(Message m)
The routing of the message is determined by the message's attributes,
including its scope, from, and to user.
The Protocol
class contains all the specific details of
specific Protocols.
m
- Message object containing all informationpublic boolean activate() throws java.lang.Exception
java.lang.Exception
edu.wpi.cs.cs509.cmi.interfaces.IBlock#activate()
public boolean connect(IBlock block, java.lang.String interfaceName) throws java.lang.Exception
java.lang.Exception
public void deactivate() throws java.lang.Exception
java.lang.Exception
edu.wpi.cs.cs509.cmi.interfaces.IBlock#deactivate()
public java.util.Enumeration getProvided()
edu.wpi.cs.cs509.cmi.interfaces.IBlock#getProvided()
public java.util.Enumeration getRequired()
edu.wpi.cs.cs509.cmi.interfaces.IBlock#getRequired()
public boolean process(java.lang.String userName, Command com)
ks.server.interfaces.IProcessCommand#process(java.lang.String, ks.common.command.Command)
protected boolean processTell(java.lang.String userName, TellCommand tc)
Known messages generated from this method are:
protected boolean processShout(java.lang.String userName, ShoutCommand sc)
Known messages generated from this method are:
sc
- the shout command to processuserName
- the user requesting the command.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |