Package org.red5.server
Class Client
java.lang.Object
org.red5.server.AttributeStore
org.red5.server.Client
- All Implemented Interfaces:
IAttributeStore
,ICastingAttributeStore
,IClient
,AttributeStoreMXBean
Client is an abstraction representing user connected to Red5 application. Clients are tied to connections and registered in ClientRegistry
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Whether or not the bandwidth has been checked.protected CopyOnWriteArraySet<IConnection>
Connections this client is associated with.protected final long
Creation time as Timestampprotected AtomicBoolean
Disconnected state.protected final String
Clients identifierprotected static org.slf4j.Logger
protected static final String
Name of connection attribute holding the permissions.protected WeakReference<ClientRegistry>
Client registry where Client is registeredFields inherited from class org.red5.server.AttributeStore
attributes
-
Constructor Summary
ConstructorDescriptionClient
(String id, Long creationTime, ClientRegistry registry) Creates client, sets creation time and registers it in ClientRegistry.Client
(String id, ClientRegistry registry) Creates client, sets creation time and registers it in ClientRegistry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Performs a bandwidth checking routine.checkBandwidthUp
(Object[] params) Performs a bandwidth checking callback for the client.void
Disconnects client from Red5 applicationboolean
Check clients equality by idstatic Client
from
(CompositeData cd) Allows for reconstruction via CompositeData.Return set of connections for this clientgetConnections
(IScope scope) Return client connections to given scopelong
Returns the time at which the client was created.getId()
Returns the client id.getPermissions
(IConnection conn) Return the permissions in a given context.Get a set of scopes the client is connected to.int
hashCode()
boolean
hasPermission
(IConnection conn, String permissionName) Check if the client has a permission in the given context.boolean
Returns whether or not a bandwidth check has been requested.boolean
isRegistered
(IConnection conn) Returns registration status of given connection.Iterate through the scopes and their attributes.protected void
register
(IConnection conn) Associate connection with clientprivate void
Removes this instance from the client registry.void
setPermissions
(IConnection conn, Collection<String> permissions) Set the permissions for this client in a given context.toString()
protected void
unregister
(IConnection conn) Removes client-connection association for given connectionprotected void
unregister
(IConnection conn, boolean deleteIfNoConns) Removes client-connection association for given connectionMethods 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, size
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, size
-
Field Details
-
log
protected static org.slf4j.Logger log -
PERMISSIONS
Name of connection attribute holding the permissions.- See Also:
-
registry
Client registry where Client is registered -
connections
Connections this client is associated with. -
creationTime
protected final long creationTimeCreation time as Timestamp -
id
Clients identifier -
bandwidthChecked
protected boolean bandwidthCheckedWhether or not the bandwidth has been checked. -
disconnected
Disconnected state.
-
-
Constructor Details
-
Client
Creates client, sets creation time and registers it in ClientRegistry.- Parameters:
id
- Client idregistry
- ClientRegistry
-
Client
@ConstructorProperties({"id","creationTime","registry"}) public Client(String id, Long creationTime, ClientRegistry registry) Creates client, sets creation time and registers it in ClientRegistry.- Parameters:
id
- Client idcreationTime
- Creation timeregistry
- ClientRegistry
-
-
Method Details
-
disconnect
public void disconnect()Disconnects client from Red5 application- Specified by:
disconnect
in interfaceIClient
-
getConnections
Return set of connections for this client- Specified by:
getConnections
in interfaceIClient
- Returns:
- Set of connections
-
getConnections
Return client connections to given scope- Specified by:
getConnections
in interfaceIClient
- Parameters:
scope
- Scope- Returns:
- Set of connections for that scope
-
getCreationTime
public long getCreationTime()Returns the time at which the client was created.- Specified by:
getCreationTime
in interfaceIClient
- Returns:
- creation time
-
getId
Returns the client id. -
getScopes
Description copied from interface:IClient
Get a set of scopes the client is connected to. -
iterateScopeNameList
Iterate through the scopes and their attributes. Used by JMX- Returns:
- list of scope attributes
-
isRegistered
Returns registration status of given connection.- Parameters:
conn
- connection- Returns:
- true if registered and false otherwise
-
register
Associate connection with client- Parameters:
conn
- Connection object
-
unregister
Removes client-connection association for given connection- Parameters:
conn
- Connection object
-
unregister
Removes client-connection association for given connection- Parameters:
conn
- Connection objectdeleteIfNoConns
- Whether to delete this client if it no longer has any connections
-
isBandwidthChecked
public boolean isBandwidthChecked()Returns whether or not a bandwidth check has been requested.- Specified by:
isBandwidthChecked
in interfaceIClient
- Returns:
- true if requested and false otherwise
-
getPermissions
Return the permissions in a given context.- Specified by:
getPermissions
in interfaceIClient
- Parameters:
conn
- Connection specifying the context to get the permissions for.- Returns:
- Permission names.
-
hasPermission
Check if the client has a permission in the given context.- Specified by:
hasPermission
in interfaceIClient
- Parameters:
conn
- Connection specifying the context to check the permissions forpermissionName
- Name of the permission to check- Returns:
true
if the client has the permission, otherwisefalse
-
setPermissions
Set the permissions for this client in a given context.- Specified by:
setPermissions
in interfaceIClient
- Parameters:
conn
- Connection specifying the context to set the permissions for.permissions
- Permissions the client has in this context ornull
for no permissions.
-
checkBandwidth
public void checkBandwidth()Performs a bandwidth checking routine. Information may be found here: http://www.adobe.com/devnet/flashmediaserver/articles/dynamic_stream_switching_04.html- Specified by:
checkBandwidth
in interfaceIClient
-
checkBandwidthUp
Performs a bandwidth checking callback for the client. Information may be found here: http://www.adobe.com/devnet/flashmediaserver/articles/dynamic_stream_switching_04.html- Specified by:
checkBandwidthUp
in interfaceIClient
- Parameters:
params
- parameters- Returns:
- bandwidth results
-
from
Allows for reconstruction via CompositeData.- Parameters:
cd
- composite data- Returns:
- Client class instance
-
removeInstance
private void removeInstance()Removes this instance from the client registry. -
hashCode
public int hashCode() -
equals
Check clients equality by id -
toString
-