org.red5.server
Class ClientRegistry

java.lang.Object
  extended by org.red5.server.ClientRegistry
All Implemented Interfaces:
IClientRegistry, ClientRegistryMXBean

@ManagedResource(objectName="org.red5.server:type=ClientRegistry,name=default",
                 description="ClientRegistry")
public class ClientRegistry
extends Object
implements IClientRegistry, ClientRegistryMXBean

Registry for clients. Associates client with it's id so it's possible to get client by id from whenever we need.

Author:
The Red5 Project ([email protected])

Constructor Summary
ClientRegistry()
           
ClientRegistry(String name)
           
 
Method Summary
protected  void addClient(IClient client)
          Add client to registry
 Client getClient(String id)
           
 ClientList<Client> getClientList()
          Returns a list of Clients.
protected  Collection<IClient> getClients()
          Return collection of clients
 boolean hasClient(String id)
          Check whether registry has client with given id
protected  boolean hasClients()
          Check if client registry contains clients.
 IClient lookupClient(String id)
          Return client by id
 IClient newClient(Object[] params)
          Return client from next id with given params
 String nextId()
          Return next client id
 String previousId()
          Return previous client id
protected  void removeClient(IClient client)
          Removes client from registry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientRegistry

public ClientRegistry()

ClientRegistry

public ClientRegistry(String name)
Method Detail

addClient

protected void addClient(IClient client)
Add client to registry

Parameters:
client - Client to add

getClient

public Client getClient(String id)
                 throws ClientNotFoundException
Specified by:
getClient in interface ClientRegistryMXBean
Throws:
ClientNotFoundException

getClientList

public ClientList<Client> getClientList()
Returns a list of Clients.

Specified by:
getClientList in interface ClientRegistryMXBean

hasClients

protected boolean hasClients()
Check if client registry contains clients.

Returns:
True if clients exist, otherwise False

getClients

protected Collection<IClient> getClients()
Return collection of clients

Returns:
Collection of clients

hasClient

public boolean hasClient(String id)
Check whether registry has client with given id

Specified by:
hasClient in interface IClientRegistry
Specified by:
hasClient in interface ClientRegistryMXBean
Parameters:
id - Client id
Returns:
true if client with given id was register with this registry, false otherwise

lookupClient

public IClient lookupClient(String id)
                     throws ClientNotFoundException
Return client by id

Specified by:
lookupClient in interface IClientRegistry
Parameters:
id - Client id
Returns:
Client object associated with given id
Throws:
ClientNotFoundException - if we can't find client

newClient

public IClient newClient(Object[] params)
                  throws ClientNotFoundException,
                         ClientRejectedException
Return client from next id with given params

Specified by:
newClient in interface IClientRegistry
Parameters:
params - Client params
Returns:
Client object
Throws:
ClientNotFoundException - if client not found
ClientRejectedException - if client rejected

nextId

public String nextId()
Return next client id

Specified by:
nextId in interface ClientRegistryMXBean
Returns:
Next client id

previousId

public String previousId()
Return previous client id

Specified by:
previousId in interface ClientRegistryMXBean
Returns:
Previous client id

removeClient

protected void removeClient(IClient client)
Removes client from registry

Parameters:
client - Client to remove


Copyright © 2006-2012 The Red5 Project