Package org.red5.server
Class PersistableAttributeStore
- java.lang.Object
-
- org.red5.server.AttributeStore
-
- org.red5.server.PersistableAttributeStore
-
- All Implemented Interfaces:
org.red5.server.api.IAttributeStore
,org.red5.server.api.ICastingAttributeStore
,org.red5.server.api.persistence.IPersistable
,org.red5.server.jmx.mxbeans.AttributeStoreMXBean
public class PersistableAttributeStore extends org.red5.server.AttributeStore implements org.red5.server.api.persistence.IPersistable
Persistable attributes store. Server-side SharedObjects feature based on this class.
-
-
Field Summary
Fields Modifier and Type Field Description protected long
lastModified
Last modified Timestampprotected String
name
Attribute store nameprotected String
path
Attribute store path (on local hard drive)protected boolean
persistent
Persistence flagprotected org.red5.server.api.persistence.IPersistenceStore
store
Store object that deals with save/load routinesprotected String
type
Attribute store type
-
Constructor Summary
Constructors Constructor Description PersistableAttributeStore(String type, String name, String path, boolean persistent)
Creates persistable attribute store
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deserialize(org.red5.io.object.Input input)
Deserializes data from input to attributesObject
getAttribute(String name, Object defaultValue)
long
getLastModified()
Returns last modification time as timestampString
getName()
Return store nameString
getPath()
Ruturn scope pathorg.red5.server.api.persistence.IPersistenceStore
getStore()
Return persistent storeString
getType()
Return scope typeboolean
isPersistent()
Check whether object is persistent or notprotected void
modified()
Set last modified flag to current system timeboolean
removeAttribute(String name)
Removes attributevoid
removeAttributes()
Removes all attributes and sets modified flagvoid
serialize(org.red5.io.object.Output output)
Serializes byte buffer output, storing them to attributesboolean
setAttribute(String name, Object value)
boolean
setAttributes(Map<String,Object> values)
boolean
setAttributes(org.red5.server.api.IAttributeStore values)
void
setName(String name)
Setter for namevoid
setPath(String path)
Setter for scope pathvoid
setPersistent(boolean persistent)
Set for persistencevoid
setStore(org.red5.server.api.persistence.IPersistenceStore store)
Load data from another persistent store-
Methods inherited from class org.red5.server.AttributeStore
filterNull, from, getAttribute, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, hasAttribute, removeAttribute, setAttribute, size
-
-
-
-
Field Detail
-
persistent
protected boolean persistent
Persistence flag
-
name
protected String name
Attribute store name
-
type
protected String type
Attribute store type
-
path
protected String path
Attribute store path (on local hard drive)
-
lastModified
protected long lastModified
Last modified Timestamp
-
store
protected org.red5.server.api.persistence.IPersistenceStore store
Store object that deals with save/load routines
-
-
Method Detail
-
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 interfaceorg.red5.server.api.persistence.IPersistable
- Returns:
- true if object is persistent, false otherwise
-
setPersistent
public void setPersistent(boolean persistent)
Set for persistence- Specified by:
setPersistent
in interfaceorg.red5.server.api.persistence.IPersistable
- Parameters:
persistent
- Persistence flag value
-
getLastModified
public long getLastModified()
Returns last modification time as timestamp- Specified by:
getLastModified
in interfaceorg.red5.server.api.persistence.IPersistable
- Returns:
- Timestamp of last attribute modification
-
getName
public String getName()
Return store name- Specified by:
getName
in interfaceorg.red5.server.api.persistence.IPersistable
- Returns:
- Store name
-
setName
public void setName(String name)
Setter for name- Specified by:
setName
in interfaceorg.red5.server.api.persistence.IPersistable
- Parameters:
name
- Name
-
getPath
public String getPath()
Ruturn scope path- Specified by:
getPath
in interfaceorg.red5.server.api.persistence.IPersistable
- Returns:
- Path
-
setPath
public void setPath(String path)
Setter for scope path- Specified by:
setPath
in interfaceorg.red5.server.api.persistence.IPersistable
- Parameters:
path
- Path
-
getType
public String getType()
Return scope type- Specified by:
getType
in interfaceorg.red5.server.api.persistence.IPersistable
- Returns:
- Scope type
-
serialize
public void serialize(org.red5.io.object.Output output) throws IOException
Serializes byte buffer output, storing them to attributes- Specified by:
serialize
in interfaceorg.red5.server.api.persistence.IPersistable
- Parameters:
output
- Output object- Throws:
IOException
- if error
-
deserialize
public void deserialize(org.red5.io.object.Input input) throws IOException
Deserializes data from input to attributes- Specified by:
deserialize
in interfaceorg.red5.server.api.persistence.IPersistable
- Parameters:
input
- Input object- Throws:
IOException
- I/O exception
-
setStore
public void setStore(org.red5.server.api.persistence.IPersistenceStore store)
Load data from another persistent store- Specified by:
setStore
in interfaceorg.red5.server.api.persistence.IPersistable
- Parameters:
store
- Persistent store
-
getStore
public org.red5.server.api.persistence.IPersistenceStore getStore()
Return persistent store- Specified by:
getStore
in interfaceorg.red5.server.api.persistence.IPersistable
- Returns:
- Persistence store
-
getAttribute
public Object getAttribute(String name, Object defaultValue)
- Specified by:
getAttribute
in interfaceorg.red5.server.api.IAttributeStore
- Overrides:
getAttribute
in classorg.red5.server.AttributeStore
-
setAttribute
public boolean setAttribute(String name, Object value)
- Specified by:
setAttribute
in interfaceorg.red5.server.api.IAttributeStore
- Overrides:
setAttribute
in classorg.red5.server.AttributeStore
-
setAttributes
public boolean setAttributes(Map<String,Object> values)
- Specified by:
setAttributes
in interfaceorg.red5.server.api.IAttributeStore
- Overrides:
setAttributes
in classorg.red5.server.AttributeStore
-
setAttributes
public boolean setAttributes(org.red5.server.api.IAttributeStore values)
- Specified by:
setAttributes
in interfaceorg.red5.server.api.IAttributeStore
- Overrides:
setAttributes
in classorg.red5.server.AttributeStore
-
removeAttribute
public boolean removeAttribute(String name)
Removes attribute- Specified by:
removeAttribute
in interfaceorg.red5.server.jmx.mxbeans.AttributeStoreMXBean
- Specified by:
removeAttribute
in interfaceorg.red5.server.api.IAttributeStore
- Overrides:
removeAttribute
in classorg.red5.server.AttributeStore
- 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 interfaceorg.red5.server.jmx.mxbeans.AttributeStoreMXBean
- Specified by:
removeAttributes
in interfaceorg.red5.server.api.IAttributeStore
- Overrides:
removeAttributes
in classorg.red5.server.AttributeStore
-
-