Class 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 Timestamp
      protected String name
      Attribute store name
      protected String path
      Attribute store path (on local hard drive)
      protected boolean persistent
      Persistence flag
      protected org.red5.server.api.persistence.IPersistenceStore store
      Store object that deals with save/load routines
      protected String type
      Attribute store type
      • Fields inherited from class org.red5.server.AttributeStore

        attributes, log
      • Fields inherited from interface org.red5.server.api.persistence.IPersistable

        TRANSIENT_PREFIX
    • 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
    • Constructor Detail

      • PersistableAttributeStore

        public PersistableAttributeStore​(String type,
                                         String name,
                                         String path,
                                         boolean persistent)
        Creates persistable attribute store
        Parameters:
        type - Attribute store type
        name - Attribute store name
        path - Attribute store path
        persistent - Whether store is persistent or not
    • 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 interface org.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 interface org.red5.server.api.persistence.IPersistable
        Parameters:
        persistent - Persistence flag value
      • getLastModified

        public long getLastModified()
        Returns last modification time as timestamp
        Specified by:
        getLastModified in interface org.red5.server.api.persistence.IPersistable
        Returns:
        Timestamp of last attribute modification
      • getName

        public String getName()
        Return store name
        Specified by:
        getName in interface org.red5.server.api.persistence.IPersistable
        Returns:
        Store name
      • setName

        public void setName​(String name)
        Setter for name
        Specified by:
        setName in interface org.red5.server.api.persistence.IPersistable
        Parameters:
        name - Name
      • getPath

        public String getPath()
        Ruturn scope path
        Specified by:
        getPath in interface org.red5.server.api.persistence.IPersistable
        Returns:
        Path
      • setPath

        public void setPath​(String path)
        Setter for scope path
        Specified by:
        setPath in interface org.red5.server.api.persistence.IPersistable
        Parameters:
        path - Path
      • getType

        public String getType()
        Return scope type
        Specified by:
        getType in interface org.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 interface org.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 interface org.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 interface org.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 interface org.red5.server.api.persistence.IPersistable
        Returns:
        Persistence store
      • getAttribute

        public Object getAttribute​(String name,
                                   Object defaultValue)
        Specified by:
        getAttribute in interface org.red5.server.api.IAttributeStore
        Overrides:
        getAttribute in class org.red5.server.AttributeStore
      • setAttribute

        public boolean setAttribute​(String name,
                                    Object value)
        Specified by:
        setAttribute in interface org.red5.server.api.IAttributeStore
        Overrides:
        setAttribute in class org.red5.server.AttributeStore
      • setAttributes

        public boolean setAttributes​(Map<String,​Object> values)
        Specified by:
        setAttributes in interface org.red5.server.api.IAttributeStore
        Overrides:
        setAttributes in class org.red5.server.AttributeStore
      • setAttributes

        public boolean setAttributes​(org.red5.server.api.IAttributeStore values)
        Specified by:
        setAttributes in interface org.red5.server.api.IAttributeStore
        Overrides:
        setAttributes in class org.red5.server.AttributeStore
      • removeAttribute

        public boolean removeAttribute​(String name)
        Removes attribute
        Specified by:
        removeAttribute in interface org.red5.server.jmx.mxbeans.AttributeStoreMXBean
        Specified by:
        removeAttribute in interface org.red5.server.api.IAttributeStore
        Overrides:
        removeAttribute in class org.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 interface org.red5.server.jmx.mxbeans.AttributeStoreMXBean
        Specified by:
        removeAttributes in interface org.red5.server.api.IAttributeStore
        Overrides:
        removeAttributes in class org.red5.server.AttributeStore