public class RamPersistence extends Object implements IPersistenceStore
| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<String,IPersistable> |
objects
Map for persistable objects
|
protected static String |
PERSISTENCE_NO_NAME
This is used in the id for objects that have a name of
|
protected ResourcePatternResolver |
resources
Resource pattern resolver.
|
| Constructor and Description |
|---|
RamPersistence(IScope scope)
Creates RAM persistence object from scope
|
RamPersistence(ResourcePatternResolver resources)
Creates RAM persistence object from resource pattern resolvers
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getObjectId(IPersistable object)
Get object id
|
protected String |
getObjectName(String id)
Get resource name from path.
|
Set<String> |
getObjectNames()
Return iterator over the names of all already loaded objects in the storage.
|
protected String |
getObjectPath(String id,
String name)
Get object path for given id and name.
|
Collection<IPersistable> |
getObjects()
Return iterator over the already loaded objects in the storage.
|
boolean |
load(IPersistable obj)
Load state of an already instantiated persistent object.
|
IPersistable |
load(String name)
Load a persistent object with the given name.
|
void |
notifyClose()
Notify store that it's being closed.
|
boolean |
remove(IPersistable object)
Delete the passed persistent object.
|
boolean |
remove(String name)
Delete the persistent object with the given name.
|
boolean |
save(IPersistable object)
Persist given object.
|
protected static final String PERSISTENCE_NO_NAME
null
protected ConcurrentMap<String,IPersistable> objects
protected ResourcePatternResolver resources
public RamPersistence(ResourcePatternResolver resources)
resources - Resource pattern resolver and loaderpublic RamPersistence(IScope scope)
scope - Scopeprotected String getObjectName(String id)
type / path / objectName
id - object idprotected String getObjectPath(String id, String name)
type / path / objectName
id - object idname - object nameprotected String getObjectId(IPersistable object)
object - Persistable object whose id is asked forpublic boolean save(IPersistable object)
save in interface IPersistenceStoreobject - Object to storetrueon success,
falseotherwise
public IPersistable load(String name)
load in interface IPersistenceStorename - the name of the object to loadnullif no such object was found
public boolean load(IPersistable obj)
load in interface IPersistenceStoreobj - the object to initializpublic boolean remove(IPersistable object)
remove in interface IPersistenceStoreobject - the object to deletetrueif object was persisted and thus can be removed,
falseotherwise
public boolean remove(String name)
remove in interface IPersistenceStorename - the name of the object to deletetrueif object was persisted and thus can be removed,
falseotherwise
public Set<String> getObjectNames()
getObjectNames in interface IPersistenceStorepublic Collection<IPersistable> getObjects()
getObjects in interface IPersistenceStorepublic void notifyClose()
notifyClose in interface IPersistenceStoreCopyright © 2005–2017 Red5. All rights reserved.