Package org.red5.server
Class AttributeStore
java.lang.Object
org.red5.server.AttributeStore
- All Implemented Interfaces:
IAttributeStore
,ICastingAttributeStore
,AttributeStoreMXBean
- Direct Known Subclasses:
BaseConnection
,Client
,PersistableAttributeStore
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected ConcurrentMap<String,
Object> Map for attributesprotected static org.slf4j.Logger
-
Constructor Summary
ConstructorDescriptionCreates empty attribute store.AttributeStore
(Map<String, Object> values) Creates attribute store with initial values.AttributeStore
(IAttributeStore values) Creates attribute store with initial values. -
Method Summary
Modifier and TypeMethodDescriptionfilterNull
(Map<String, Object> values) Filterstatic AttributeStore
from
(CompositeData cd) Allows for reconstruction via CompositeData.getAttribute
(String name) Return the value for a given attribute.getAttribute
(String name, Object defaultValue) Return the value for a given attribute and set it if it doesn't exist.Get the attribute names.Get the attributes.getBoolAttribute
(String name) Get Boolean attribute by namegetByteAttribute
(String name) Get Byte attribute by namegetDoubleAttribute
(String name) Get Double attribute by namegetIntAttribute
(String name) Get Integer attribute by nameList<?>
getListAttribute
(String name) Get List attribute by namegetLongAttribute
(String name) Get boolean attribute by nameMap<?,
?> getMapAttribute
(String name) Get Long attribute by nameSet<?>
getSetAttribute
(String name) Get Set attribute by namegetShortAttribute
(String name) Get Short attribute by namegetStringAttribute
(String name) Get String attribute by nameboolean
hasAttribute
(String name) Check the object has an attribute.boolean
removeAttribute
(String name) Remove an attribute.void
Remove all attributes.boolean
setAttribute
(String name, Object value) Set an attribute on this object.boolean
setAttributes
(Map<String, Object> values) Set multiple attributes on this object.boolean
setAttributes
(IAttributeStore values) Set multiple attributes on this object.int
size()
Size of the attribute store.
-
Field Details
-
log
protected static org.slf4j.Logger log -
attributes
Map for attributes
-
-
Constructor Details
-
AttributeStore
public AttributeStore()Creates empty attribute store. Object is not associated with a persistence storage. -
AttributeStore
Creates attribute store with initial values. Object is not associated with a persistence storage.- Parameters:
values
- map
-
AttributeStore
Creates attribute store with initial values. Object is not associated with a persistence storage.- Parameters:
values
- map
-
-
Method Details
-
filterNull
Filternull
keys and values from given map.- Parameters:
values
- the map to filter- Returns:
- filtered map
-
getAttributeNames
Get the attribute names. The resulting set will be read-only.- Specified by:
getAttributeNames
in interfaceAttributeStoreMXBean
- Specified by:
getAttributeNames
in interfaceIAttributeStore
- Returns:
- set containing all attribute names
-
getAttributes
Get the attributes. The resulting map will be read-only.- Specified by:
getAttributes
in interfaceIAttributeStore
- Returns:
- map containing all attributes
-
getAttribute
Return the value for a given attribute.- Specified by:
getAttribute
in interfaceIAttributeStore
- Parameters:
name
- the name of the attribute to get- Returns:
- the attribute value or null if the attribute doesn't exist
-
getAttribute
Return the value for a given attribute and set it if it doesn't exist.- Specified by:
getAttribute
in interfaceIAttributeStore
- Parameters:
name
- the name of the attribute to getdefaultValue
- the value of the attribute to set if the attribute doesn't exist- Returns:
- the attribute value
-
hasAttribute
Check the object has an attribute.- Specified by:
hasAttribute
in interfaceAttributeStoreMXBean
- Specified by:
hasAttribute
in interfaceIAttributeStore
- Parameters:
name
- the name of the attribute to check- Returns:
- true if the attribute exists otherwise false
-
setAttribute
Set an attribute on this object.- Specified by:
setAttribute
in interfaceIAttributeStore
- Parameters:
name
- the name of the attribute to changevalue
- the new value of the attribute- Returns:
- true if the attribute value was added or changed, otherwise false
-
setAttributes
Set multiple attributes on this object.- Specified by:
setAttributes
in interfaceIAttributeStore
- Parameters:
values
- the attributes to set- Returns:
- true if the attribute values changed otherwise false
-
setAttributes
Set multiple attributes on this object.- Specified by:
setAttributes
in interfaceIAttributeStore
- Parameters:
values
- the attributes to set- Returns:
- true if the attribute values changed otherwise false
-
removeAttribute
Remove an attribute.- Specified by:
removeAttribute
in interfaceAttributeStoreMXBean
- Specified by:
removeAttribute
in interfaceIAttributeStore
- Parameters:
name
- the name of the attribute to remove- Returns:
- true if the attribute was found and removed otherwise false
-
removeAttributes
public void removeAttributes()Remove all attributes.- Specified by:
removeAttributes
in interfaceAttributeStoreMXBean
- Specified by:
removeAttributes
in interfaceIAttributeStore
-
size
public int size()Size of the attribute store.- Specified by:
size
in interfaceIAttributeStore
- Returns:
- count of attributes
-
getBoolAttribute
Get Boolean attribute by name- Specified by:
getBoolAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getByteAttribute
Get Byte attribute by name- Specified by:
getByteAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getDoubleAttribute
Get Double attribute by name- Specified by:
getDoubleAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getIntAttribute
Get Integer attribute by name- Specified by:
getIntAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getListAttribute
Get List attribute by name- Specified by:
getListAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getLongAttribute
Get boolean attribute by name- Specified by:
getLongAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getMapAttribute
Get Long attribute by name- Specified by:
getMapAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getSetAttribute
Get Set attribute by name- Specified by:
getSetAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getShortAttribute
Get Short attribute by name- Specified by:
getShortAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
getStringAttribute
Get String attribute by name- Specified by:
getStringAttribute
in interfaceICastingAttributeStore
- Parameters:
name
- Attribute name- Returns:
- Attribute
-
from
Allows for reconstruction via CompositeData.- Parameters:
cd
- composite data- Returns:
- AttributeStore class instance
-