org.red5.server
Class Client

java.lang.Object
  extended by org.red5.server.AttributeStore
      extended by org.red5.server.Client
All Implemented Interfaces:
AttributeStoreMBean, IAttributeStore, IBWControllable, ICastingAttributeStore, IClient, ClientMBean

public class Client
extends AttributeStore
implements IClient, ClientMBean

Client is an abstraction representing user connected to Red5 application. Clients are tied to connections and registred in ClientRegistry


Field Summary
protected  ConcurrentMap<IConnection,IScope> connToScope
          Scopes this client connected to
protected  long creationTime
          Creation time as Timestamp
protected  String id
          Clients identificator
protected static Logger log
          Logger
protected static String PERMISSIONS
          Name of connection attribute holding the permissions.
protected  ClientRegistry registry
          Client registry where Client is registred
 
Fields inherited from class org.red5.server.AttributeStore
attributes
 
Fields inherited from interface org.red5.server.api.IClient
ID
 
Constructor Summary
Client()
           
Client(String id, ClientRegistry registry)
          Creates client, sets creation time and registers it in ClientRegistry
 
Method Summary
 void disconnect()
          Disconnects client from Red5 application
 boolean equals(Object obj)
          Check clients equality by id
 IBandwidthConfigure getBandwidthConfigure()
          Return bandwidth configuration context, that is, broadcasting bandwidth and quality settings for this client
 Set<IConnection> getConnections()
          Return set of connections for this client
 Set<IConnection> getConnections(IScope scope)
          Return client connections to given scope
 long getCreationTime()
          Get the creation time for this client object.
 String getId()
          Returns the client id
 IBWControllable getParentBWControllable()
          Parent flow controllable object, that is, parent object that is used to determine client broadcast bandwidth settings.
 Collection<String> getPermissions(IConnection conn)
          Return the permissions in a given context.
 Collection<IScope> getScopes()
          Get a set of scopes the client is connected to.
 int hashCode()
          if overriding equals then also do hashCode
 boolean hasPermission(IConnection conn, String permissionName)
          Check if the client has a permission in the given context.
 List<String> iterateScopeNameList()
          Iterate through the scopes and their attributes.
protected  void register(IConnection conn)
          Associate connection with client
 void setBandwidthConfigure(IBandwidthConfigure config)
          Set new bandwidth configuration context
 void setId(String id)
          Sets the clients id
 void setPermissions(IConnection conn, Collection<String> permissions)
          Set the permissions for this client in a given context.
 String toString()
           
protected  void unregister(IConnection conn)
          Removes client-connection association for given connection
 
Methods inherited from class org.red5.server.AttributeStore
filterNull, getAttribute, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.red5.server.api.IAttributeStore
getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes
 

Field Detail

log

protected static Logger log
Logger


PERMISSIONS

protected static final String PERMISSIONS
Name of connection attribute holding the permissions.

See Also:
Constant Field Values

connToScope

protected ConcurrentMap<IConnection,IScope> connToScope
Scopes this client connected to


creationTime

protected long creationTime
Creation time as Timestamp


id

protected String id
Clients identificator


registry

protected ClientRegistry registry
Client registry where Client is registred

Constructor Detail

Client

public Client()

Client

public Client(String id,
              ClientRegistry registry)
Creates client, sets creation time and registers it in ClientRegistry

Parameters:
id - Client id
registry - ClientRegistry
Method Detail

disconnect

public void disconnect()
Disconnects client from Red5 application

Specified by:
disconnect in interface IClient
Specified by:
disconnect in interface ClientMBean

equals

public boolean equals(Object obj)
Check clients equality by id

Overrides:
equals in class Object
Parameters:
obj - Object to check against
Returns:
true if clients ids are the same, false otherwise

getBandwidthConfigure

public IBandwidthConfigure getBandwidthConfigure()
Return bandwidth configuration context, that is, broadcasting bandwidth and quality settings for this client

Specified by:
getBandwidthConfigure in interface IBWControllable
Returns:
Bandwidth configuration context

getConnections

public Set<IConnection> getConnections()
Return set of connections for this client

Specified by:
getConnections in interface IClient
Specified by:
getConnections in interface ClientMBean
Returns:
Set of connections

getConnections

public Set<IConnection> getConnections(IScope scope)
Return client connections to given scope

Specified by:
getConnections in interface IClient
Parameters:
scope - Scope
Returns:
Set of connections for that scope

getCreationTime

public long getCreationTime()
Description copied from interface: IClient
Get the creation time for this client object.

Specified by:
getCreationTime in interface IClient
Specified by:
getCreationTime in interface ClientMBean
Returns:
creation time

setId

public void setId(String id)
Description copied from interface: IClient
Sets the clients id

Specified by:
setId in interface IClient
Parameters:
id - client id

getId

public String getId()
Returns the client id

Specified by:
getId in interface IClient
Specified by:
getId in interface ClientMBean
Returns:
client id

getParentBWControllable

public IBWControllable getParentBWControllable()
Parent flow controllable object, that is, parent object that is used to determine client broadcast bandwidth settings. In case of base Client class parent is host.

Specified by:
getParentBWControllable in interface IBWControllable
Returns:
IFlowControllable instance

getScopes

public Collection<IScope> getScopes()
Description copied from interface: IClient
Get a set of scopes the client is connected to.

Specified by:
getScopes in interface IClient
Returns:
scopes on this client

hashCode

public int hashCode()
if overriding equals then also do hashCode

Overrides:
hashCode in class Object
Returns:
a has code

iterateScopeNameList

public List<String> iterateScopeNameList()
Iterate through the scopes and their attributes. Used by JMX

Specified by:
iterateScopeNameList in interface ClientMBean
Returns:
list of scope attributes

register

protected void register(IConnection conn)
Associate connection with client

Parameters:
conn - Connection object

setBandwidthConfigure

public void setBandwidthConfigure(IBandwidthConfigure config)
Set new bandwidth configuration context

Specified by:
setBandwidthConfigure in interface IBWControllable
Parameters:
config - Bandwidth configuration context

toString

public String toString()
Overrides:
toString in class Object
Returns:
string representation of client

unregister

protected void unregister(IConnection conn)
Removes client-connection association for given connection

Parameters:
conn - Connection object

getPermissions

public Collection<String> getPermissions(IConnection conn)
Return the permissions in a given context.

Specified by:
getPermissions in interface IClient
Parameters:
conn - Connection specifying the context to get the permissions for.
Returns:
Permission names.

hasPermission

public boolean hasPermission(IConnection conn,
                             String permissionName)
Check if the client has a permission in the given context.

Specified by:
hasPermission in interface IClient
Parameters:
conn - Connection specifying the context to check the permissions for.
permissionName - Name of the permission to check.
Returns:
true if the client has the permission, otherwise false

setPermissions

public void setPermissions(IConnection conn,
                           Collection<String> permissions)
Set the permissions for this client in a given context.

Specified by:
setPermissions in interface IClient
Parameters:
conn - Connection specifying the context to set the permissions for.
permissions - Permissions the client has in this context or null for no permissions.


Copyright © 2006-2009 The Red5 Project