org.cometd.oort
Class Seti

java.lang.Object
  extended by org.mortbay.component.AbstractLifeCycle
      extended by org.cometd.oort.Seti
All Implemented Interfaces:
LifeCycle

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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
LifeCycle.Listener
 
Field Summary
static java.lang.String SETI_ATTRIBUTE
           
static java.lang.String SETI_SHARD
           
 
Fields inherited from class org.mortbay.component.AbstractLifeCycle
_listeners
 
Constructor Summary
Seti(Oort oort, java.lang.String shardId)
           
 
Method Summary
 void associate(java.lang.String userId, org.cometd.Client client)
           
 void disassociate(java.lang.String userId)
           
protected  void doStart()
           
protected  void doStop()
           
protected  void receive(org.cometd.Client from, org.cometd.Client to, org.cometd.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 org.mortbay.component.AbstractLifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
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
Overrides:
doStart in class AbstractLifeCycle
Throws:
java.lang.Exception

doStop

protected void doStop()
               throws java.lang.Exception
Overrides:
doStop in class AbstractLifeCycle
Throws:
java.lang.Exception

associate

public void associate(java.lang.String userId,
                      org.cometd.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(org.cometd.Client from,
                       org.cometd.Client to,
                       org.cometd.Message msg)


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.