org.cometd.oort
Class Seti

java.lang.Object
  extended by AbstractLifeCycle
      extended by org.cometd.oort.Seti

public class Seti
extends AbstractLifeCycle

The Search for Extra Terrestial Intelligence. Well in this case, just the search for a user logged onto an Cometd node in an Oort cluster.

Seti allows an application to maintain a mapping from userId to comet client ID using the associate(String, Client) and disassociate(String) methods. Each cometd node keeps its own associate mapping for clients connected to it.

The sendMessage(Collection, String, Object) and sendMessage(String, String, Object) methods may be used to send a message to user(s) anywhere in the Oort cluster and Seti organizes the search of the distributed associate maps in order to locate the user(s)

If users can be directed to shards of cometd servers, then each Seti instance must be told it's shard ID and the userId2Shard(String) method must be extended to map users to shards.


Field Summary
static java.lang.String SETI_ATTRIBUTE
           
static java.lang.String SETI_SHARD
           
 
Constructor Summary
Seti(Oort oort, java.lang.String shardId)
           
 
Method Summary
 void associate(java.lang.String userId, Client client)
           
 void disassociate(java.lang.String userId)
           
protected  void doStart()
           
protected  void doStop()
           
protected  void receive(Client from, Client to, Message msg)
           
 void sendMessage(java.util.Collection<java.lang.String> toUsers, java.lang.String toChannel, java.lang.Object message)
           
 void sendMessage(java.lang.String toUser, java.lang.String toChannel, java.lang.Object message)
           
protected  org.cometd.oort.Seti.ShardLocation userId2Shard(java.lang.String userId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SETI_ATTRIBUTE

public static final java.lang.String SETI_ATTRIBUTE
See Also:
Constant Field Values

SETI_SHARD

public static final java.lang.String SETI_SHARD
See Also:
Constant Field Values
Constructor Detail

Seti

public Seti(Oort oort,
            java.lang.String shardId)
Method Detail

doStart

protected void doStart()
                throws java.lang.Exception
Throws:
java.lang.Exception

doStop

protected void doStop()
               throws java.lang.Exception
Throws:
java.lang.Exception

associate

public void associate(java.lang.String userId,
                      Client client)

disassociate

public void disassociate(java.lang.String userId)

sendMessage

public void sendMessage(java.lang.String toUser,
                        java.lang.String toChannel,
                        java.lang.Object message)

sendMessage

public void sendMessage(java.util.Collection<java.lang.String> toUsers,
                        java.lang.String toChannel,
                        java.lang.Object message)

userId2Shard

protected org.cometd.oort.Seti.ShardLocation userId2Shard(java.lang.String userId)

receive

protected void receive(Client from,
                       Client to,
                       Message msg)


Copyright © 2011 Dojo Foundation. All Rights Reserved.