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
FieldsModifier and TypeFieldDescriptionprotected longLast modified Timestampprotected StringAttribute store nameprotected StringAttribute store path (on local hard drive)protected booleanPersistence flagprotected IPersistenceStoreStore object that deals with save/load routinesprotected StringAttribute store typeFields inherited from class org.red5.server.AttributeStore
attributes, logFields inherited from interface org.red5.server.api.persistence.IPersistable
TRANSIENT_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionPersistableAttributeStore(String type, String name, String path, boolean persistent) Creates persistable attribute store -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(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.longReturns last modification time as timestampgetName()Return store namegetPath()Ruturn scope pathgetStore()Return persistent storegetType()Return scope typebooleanCheck whether object is persistent or notprotected voidmodified()Set last modified flag to current system timebooleanremoveAttribute(String name) Removes attributevoidRemoves all attributes and sets modified flagvoidSerializes byte buffer output, storing them to attributesbooleansetAttribute(String name, Object value) Set an attribute on this object.booleansetAttributes(Map<String, Object> values) Set multiple attributes on this object.booleansetAttributes(IAttributeStore values) Set multiple attributes on this object.voidSetter for namevoidSetter for scope pathvoidsetPersistent(boolean persistent) Set for persistencevoidsetStore(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:
isPersistentin interfaceIPersistable- Returns:
- true if object is persistent, false otherwise
-
setPersistent
public void setPersistent(boolean persistent) Set for persistence- Specified by:
setPersistentin interfaceIPersistable- Parameters:
persistent- Persistence flag value
-
getLastModified
public long getLastModified()Returns last modification time as timestamp- Specified by:
getLastModifiedin interfaceIPersistable- Returns:
- Timestamp of last attribute modification
-
getName
Return store name- Specified by:
getNamein interfaceIPersistable- Returns:
- Store name
-
setName
Setter for name- Specified by:
setNamein interfaceIPersistable- Parameters:
name- Name
-
getPath
Ruturn scope path- Specified by:
getPathin interfaceIPersistable- Returns:
- Path
-
setPath
Setter for scope path- Specified by:
setPathin interfaceIPersistable- Parameters:
path- Path
-
getType
Return scope type- Specified by:
getTypein interfaceIPersistable- Returns:
- Scope type
-
serialize
Serializes byte buffer output, storing them to attributes- Specified by:
serializein interfaceIPersistable- Parameters:
output- Output object- Throws:
IOException- if error
-
deserialize
Deserializes data from input to attributes- Specified by:
deserializein interfaceIPersistable- Parameters:
input- Input object- Throws:
IOException- I/O exception
-
setStore
Load data from another persistent store- Specified by:
setStorein interfaceIPersistable- Parameters:
store- Persistent store
-
getStore
Return persistent store- Specified by:
getStorein interfaceIPersistable- Returns:
- Persistence store
-
getAttribute
Return the value for a given attribute and set it if it doesn't exist.- Specified by:
getAttributein interfaceIAttributeStore- Overrides:
getAttributein 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:
setAttributein interfaceIAttributeStore- Overrides:
setAttributein 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:
setAttributesin interfaceIAttributeStore- Overrides:
setAttributesin 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:
setAttributesin interfaceIAttributeStore- Overrides:
setAttributesin classAttributeStore- Parameters:
values- the attributes to set- Returns:
- true if the attribute values changed otherwise false
-
removeAttribute
Removes attribute- Specified by:
removeAttributein interfaceAttributeStoreMXBean- Specified by:
removeAttributein interfaceIAttributeStore- Overrides:
removeAttributein 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:
removeAttributesin interfaceAttributeStoreMXBean- Specified by:
removeAttributesin interfaceIAttributeStore- Overrides:
removeAttributesin classAttributeStore
-