org.red5.server.api
Interface IAttributeStore

All Superinterfaces:
AttributeStoreMXBean
All Known Subinterfaces:
ICastingAttributeStore, IClient, IClientSharedObject, IConnection, IRemotingConnection, IServiceCapableConnection, ISharedObject, ISharedObjectBase, IStreamCapableConnection
All Known Implementing Classes:
ApplicationAdapter, AttributeStore, BaseConnection, BaseRTMPTConnection, Client, ClientSharedObject, MultiThreadedApplicationAdapter, PersistableAttributeStore, RemotingConnection, RTMPConnection, RTMPMinaConnection, RTMPTConnection, SharedObject, SharedObjectScope, StatefulScopeWrappingAdapter

public interface IAttributeStore
extends AttributeStoreMXBean

Base interface for all API objects with attributes

Author:
The Red5 Project ([email protected]), Luke Hubbard ([email protected])

Method Summary
 Object getAttribute(String name)
          Return the value for a given attribute.
 Object getAttribute(String name, Object defaultValue)
          Return the value for a given attribute and set it if it doesn't exist.
 Set<String> getAttributeNames()
          Get the attribute names.
 Map<String,Object> getAttributes()
          Get the attributes.
 boolean hasAttribute(String name)
          Check the object has an attribute.
 boolean removeAttribute(String name)
          Remove an attribute.
 void removeAttributes()
          Remove all attributes.
 boolean setAttribute(String name, Object value)
          Set an attribute on this object.
 boolean setAttributes(IAttributeStore values)
          Set multiple attributes on this object.
 boolean setAttributes(Map<String,Object> values)
          Set multiple attributes on this object.
 int size()
          Size of the attribute store.
 

Method Detail

getAttributeNames

Set<String> getAttributeNames()
Get the attribute names. The resulting set will be read-only.

Specified by:
getAttributeNames in interface AttributeStoreMXBean
Returns:
set containing all attribute names

getAttributes

Map<String,Object> getAttributes()
Get the attributes. The resulting map will be read-only.

Returns:
map containing all attributes

setAttribute

boolean setAttribute(String name,
                     Object value)
Set an attribute on this object.

Parameters:
name - the name of the attribute to change
value - the new value of the attribute
Returns:
true if the attribute value changed otherwise false

setAttributes

boolean setAttributes(Map<String,Object> values)
Set multiple attributes on this object.

Parameters:
values - the attributes to set
Returns:
true if the attribute values changed otherwise false

setAttributes

boolean setAttributes(IAttributeStore values)
Set multiple attributes on this object.

Parameters:
values - the attributes to set
Returns:
true if the attribute values changed otherwise false

getAttribute

Object getAttribute(String name)
Return the value for a given attribute.

Parameters:
name - the name of the attribute to get
Returns:
the attribute value or null if the attribute doesn't exist

getAttribute

Object getAttribute(String name,
                    Object defaultValue)
Return the value for a given attribute and set it if it doesn't exist.

This is a utility function that internally performs the following code:

if (!hasAttribute(name)) setAttribute(name, defaultValue);
return getAttribute(name);

Parameters:
name - the name of the attribute to get
defaultValue - the value of the attribute to set if the attribute doesn't exist
Returns:
the attribute value

hasAttribute

boolean hasAttribute(String name)
Check the object has an attribute.

Specified by:
hasAttribute in interface AttributeStoreMXBean
Parameters:
name - the name of the attribute to check
Returns:
true if the attribute exists otherwise false

removeAttribute

boolean removeAttribute(String name)
Remove an attribute.

Specified by:
removeAttribute in interface AttributeStoreMXBean
Parameters:
name - the name of the attribute to remove
Returns:
true if the attribute was found and removed otherwise false

removeAttributes

void removeAttributes()
Remove all attributes.

Specified by:
removeAttributes in interface AttributeStoreMXBean

size

int size()
Size of the attribute store.

Returns:
count of attributes


Copyright © 2006-2012 The Red5 Project