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
null |
protected org.springframework.core.io.support.ResourcePatternResolver |
resources
Resource pattern resolver.
|
Constructor and Description |
---|
RamPersistence(IScope scope)
Creates RAM persistence object from scope
|
RamPersistence(org.springframework.core.io.support.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 org.springframework.core.io.support.ResourcePatternResolver resources
public RamPersistence(org.springframework.core.io.support.ResourcePatternResolver resources)
resources
- Resource pattern resolver and loaderpublic RamPersistence(IScope scope)
scope
- Scopeprotected String getObjectName(String id)
id
- Object ID. The format of the object id is protected String getObjectPath(String id, String name)
id
- Object ID. The format of the object id is name
- Object nameprotected String getObjectId(IPersistable object)
object
- Persistable object whose id is asked forpublic boolean save(IPersistable object)
save
in interface IPersistenceStore
object
- Object to storetrue
on success, false
otherwisepublic IPersistable load(String name)
load
in interface IPersistenceStore
name
- the name of the object to loadnull
if no such object was
foundpublic boolean load(IPersistable obj)
load
in interface IPersistenceStore
obj
- the object to initializpublic boolean remove(IPersistable object)
remove
in interface IPersistenceStore
object
- the object to deletetrue
if object was persisted and thus can be removed, false
otherwisepublic boolean remove(String name)
remove
in interface IPersistenceStore
name
- the name of the object to deletetrue
if object was persisted and thus can be removed, false
otherwisepublic Set<String> getObjectNames()
getObjectNames
in interface IPersistenceStore
public Collection<IPersistable> getObjects()
getObjects
in interface IPersistenceStore
public void notifyClose()
notifyClose
in interface IPersistenceStore
Copyright © 2006-2012 The Red5 Project