Package org.red5.server
Class PersistableAttributeStore
java.lang.Object
org.red5.server.AttributeStore
org.red5.server.PersistableAttributeStore
- All Implemented Interfaces:
IAttributeStore
,ICastingAttributeStore
,IPersistable
,AttributeStoreMXBean
Persistable attributes store. Server-side SharedObjects feature based on this class.
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
Last modified Timestampprotected String
Attribute store nameprotected String
Attribute store path (on local hard drive)protected boolean
Persistence flagprotected IPersistenceStore
Store object that deals with save/load routinesprotected String
Attribute store typeFields inherited from class org.red5.server.AttributeStore
attributes, log
Fields inherited from interface org.red5.server.api.persistence.IPersistable
TRANSIENT_PREFIX
-
Constructor Summary
ConstructorDescriptionPersistableAttributeStore
(String type, String name, String path, boolean persistent) Creates persistable attribute store -
Method Summary
Modifier and TypeMethodDescriptionvoid
deserialize
(Input input) Deserializes data from input to attributesgetAttribute
(String name, Object defaultValue) Return the value for a given attribute and set it if it doesn't exist.long
Returns last modification time as timestampgetName()
Return store namegetPath()
Ruturn scope pathgetStore()
Return persistent storegetType()
Return scope typeboolean
Check whether object is persistent or notprotected void
modified()
Set last modified flag to current system timeboolean
removeAttribute
(String name) Removes attributevoid
Removes all attributes and sets modified flagvoid
Serializes byte buffer output, storing them to attributesboolean
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.void
Setter for namevoid
Setter for scope pathvoid
setPersistent
(boolean persistent) Set for persistencevoid
setStore
(IPersistenceStore store) Load data from another persistent storeMethods inherited from class org.red5.server.AttributeStore
filterNull, from, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, size
-
Field Details
-
persistent
protected boolean persistentPersistence flag -
name
Attribute store name -
type
Attribute store type -
path
Attribute store path (on local hard drive) -
lastModified
protected long lastModifiedLast modified Timestamp -
store
Store object that deals with save/load routines
-
-
Constructor Details
-
PersistableAttributeStore
Creates persistable attribute store- Parameters:
type
- Attribute store typename
- Attribute store namepath
- Attribute store pathpersistent
- Whether store is persistent or not
-
-
Method Details
-
modified
protected void modified()Set last modified flag to current system time -
isPersistent
public boolean isPersistent()Check whether object is persistent or not- Specified by:
isPersistent
in interfaceIPersistable
- Returns:
- true if object is persistent, false otherwise
-
setPersistent
public void setPersistent(boolean persistent) Set for persistence- Specified by:
setPersistent
in interfaceIPersistable
- Parameters:
persistent
- Persistence flag value
-
getLastModified
public long getLastModified()Returns last modification time as timestamp- Specified by:
getLastModified
in interfaceIPersistable
- Returns:
- Timestamp of last attribute modification
-
getName
Return store name- Specified by:
getName
in interfaceIPersistable
- Returns:
- Store name
-
setName
Setter for name- Specified by:
setName
in interfaceIPersistable
- Parameters:
name
- Name
-
getPath
Ruturn scope path- Specified by:
getPath
in interfaceIPersistable
- Returns:
- Path
-
setPath
Setter for scope path- Specified by:
setPath
in interfaceIPersistable
- Parameters:
path
- Path
-
getType
Return scope type- Specified by:
getType
in interfaceIPersistable
- Returns:
- Scope type
-
serialize
Serializes byte buffer output, storing them to attributes- Specified by:
serialize
in interfaceIPersistable
- Parameters:
output
- Output object- Throws:
IOException
- if error
-
deserialize
Deserializes data from input to attributes- Specified by:
deserialize
in interfaceIPersistable
- Parameters:
input
- Input object- Throws:
IOException
- I/O exception
-
setStore
Load data from another persistent store- Specified by:
setStore
in interfaceIPersistable
- Parameters:
store
- Persistent store
-
getStore
Return persistent store- Specified by:
getStore
in interfaceIPersistable
- Returns:
- Persistence store
-
getAttribute
Return the value for a given attribute and set it if it doesn't exist.- Specified by:
getAttribute
in interfaceIAttributeStore
- Overrides:
getAttribute
in classAttributeStore
- 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
-
setAttribute
Set an attribute on this object.- Specified by:
setAttribute
in interfaceIAttributeStore
- Overrides:
setAttribute
in classAttributeStore
- 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
- Overrides:
setAttributes
in classAttributeStore
- 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
- Overrides:
setAttributes
in classAttributeStore
- Parameters:
values
- the attributes to set- Returns:
- true if the attribute values changed otherwise false
-
removeAttribute
Removes attribute- Specified by:
removeAttribute
in interfaceAttributeStoreMXBean
- Specified by:
removeAttribute
in interfaceIAttributeStore
- Overrides:
removeAttribute
in classAttributeStore
- Parameters:
name
- Attribute name- Returns:
- true if attribute was removed, false otherwise
-
removeAttributes
public void removeAttributes()Removes all attributes and sets modified flag- Specified by:
removeAttributes
in interfaceAttributeStoreMXBean
- Specified by:
removeAttributes
in interfaceIAttributeStore
- Overrides:
removeAttributes
in classAttributeStore
-