## org.red5.server
Class PersistableAttributeStore

    java.lang.Object
      org.red5.server.AttributeStore
          org.red5.server.PersistableAttributeStore

All Implemented Interfaces:
  AttributeStoreMBean, IAttributeStore, ICastingAttributeStore, IPersistable

Direct Known Subclasses:
  BasicScope

    public class PersistableAttributeStore

extends AttributeStore
implements IPersistable

Persistable attributes store. Server-side SharedObjects feature based on this class.

Field Summary
`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 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`

Fields inherited from interface org.red5.server.api.persistence.IPersistable
`TRANSIENT_PREFIX`

Constructor Summary
`PersistableAttributeStore(String type, String name, String path, boolean persistent)` Creates persistable attribute store

Method Summary
`void` `deserialize(Input input)` Deserializes data from input to attributes
`Object` `getAttribute(String name, Object defaultValue)` Return the value for a given attribute and set it if it doesn't exist.
`long` `getLastModified()` Returns last modification time as timestamp
`String` `getName()` Return store name
`String` `getPath()` Ruturn scope path
`IPersistenceStore` `getStore()` Return persistent store
`String` `getType()` Return scope type
`boolean` `isPersistent()` Check whether object is persistent or not
`protected void` `modified()` Set last modified flag to current system time
`boolean` `removeAttribute(String name)` Removes attribute
`void` `removeAttributes()` Removes all attributes and sets modified flag
`void` `serialize(Output output)` Serializes byte buffer output, storing them to attributes
`boolean` `setAttribute(String name, Object value)` Set attribute by name and return success as boolean
`void` `setAttributes(IAttributeStore values)` Bulk set of attributes from another attributes store
`void` `setAttributes(Map<String,Object> values)` Set attributes from Map
`void` `setName(String name)` Setter for name
`void` `setPath(String path)` Setter for scope path
`void` `setPersistent(boolean persistent)` Set for persistence
`void` `setStore(IPersistenceStore store)` Load data from another persistent store

Methods inherited from class org.red5.server.AttributeStore
`filterNull, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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 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 `IPersistable`
  Returns:
    true if object is persistent, false otherwise

### setPersistent

    public void setPersistent(boolean persistent)

  Set for persistence

  Specified by:
    `setPersistent` in interface `IPersistable`
  Parameters:
    `persistent` - Persistence flag value

### getLastModified

    public long getLastModified()

  Returns last modification time as timestamp

  Specified by:
    `getLastModified` in interface `IPersistable`
  Returns:
    Timestamp of last attribute modification

### getName

    public String getName()

  Return store name

  Specified by:
    `getName` in interface `IPersistable`
  Returns:
    Store name

### setName

    public void setName(String name)

  Setter for name

  Specified by:
    `setName` in interface `IPersistable`
  Parameters:
    `name` - Name

### getPath

    public String getPath()

  Ruturn scope path

  Specified by:
    `getPath` in interface `IPersistable`
  Returns:
    Path

### setPath

    public void setPath(String path)

  Setter for scope path

  Specified by:
    `setPath` in interface `IPersistable`
  Parameters:
    `path` - Path

### getType

    public String getType()

  Return scope type

  Specified by:
    `getType` in interface `IPersistable`
  Returns:
    Scope type

### serialize

    public void serialize(Output output)
                   throws IOException

  Serializes byte buffer output, storing them to attributes

  Specified by:
    `serialize` in interface `IPersistable`
  Parameters:
    `output` - Output object
  Throws:
    `IOException` - if error

### deserialize

    public void deserialize(Input input)
                     throws IOException

  Deserializes data from input to attributes

  Specified by:
    `deserialize` in interface `IPersistable`
  Parameters:
    `input` - Input object
  Throws:
    `IOException` - I/O exception

### setStore

    public void setStore(IPersistenceStore store)

  Load data from another persistent store

  Specified by:
    `setStore` in interface `IPersistable`
  Parameters:
    `store` - Persistent store

### getStore

    public IPersistenceStore getStore()

  Return persistent store

  Specified by:
    `getStore` in interface `IPersistable`
  Returns:
    Persistence store

### getAttribute

    public Object getAttribute(String name,
                               Object defaultValue)

  Return the value for a given attribute and set it if it doesn't exist.

  Specified by:
    `getAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `getAttribute` in interface `IAttributeStore`
  Overrides:
    `getAttribute` in class `AttributeStore`
  Parameters:
    `name` - the name of the attribute to get
    `defaultValue` - the value of the attribute to set if the attribute doesn't exist
  Returns:
    the attribute value

### setAttribute

    public boolean setAttribute(String name,
                                Object value)

  Set attribute by name and return success as boolean

  Specified by:
    `setAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `setAttribute` in interface `IAttributeStore`
  Overrides:
    `setAttribute` in class `AttributeStore`
  Parameters:
    `name` - Attribute name
    `value` - Attribute value
  Returns:
    true if attribute was set, false otherwise

### setAttributes

    public void setAttributes(Map<String,Object> values)

  Set attributes from Map

  Specified by:
    `setAttributes` in interface `IAttributeStore`
  Overrides:
    `setAttributes` in class `AttributeStore`
  Parameters:
    `values` - Attributes as Map

### setAttributes

    public void setAttributes(IAttributeStore values)

  Bulk set of attributes from another attributes store

  Specified by:
    `setAttributes` in interface `IAttributeStore`
  Overrides:
    `setAttributes` in class `AttributeStore`
  Parameters:
    `values` - Attributes store

### removeAttribute

    public boolean removeAttribute(String name)

  Removes attribute

  Specified by:
    `removeAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `removeAttribute` in interface `IAttributeStore`
  Overrides:
    `removeAttribute` in class `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 `AttributeStoreMBean`
  Specified by:
    `removeAttributes` in interface `IAttributeStore`
  Overrides:
    `removeAttributes` in class `AttributeStore`

Copyright © 2006-2010 The Red5 Project