|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.red5.server.AttributeStore
org.red5.server.PersistableAttributeStore
org.red5.server.BasicScope
org.red5.server.so.SharedObjectScope
public class SharedObjectScope
Special scope for shared objects
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.red5.server.BasicScope |
|---|
BasicScope.EmptyBasicScopeIterator |
| Field Summary | |
|---|---|
protected SharedObject |
so
Scoped shared object |
| Fields inherited from class org.red5.server.BasicScope |
|---|
keepDelay, keepOnDisconnect, listeners, parent, persistenceClass |
| Fields inherited from class org.red5.server.PersistableAttributeStore |
|---|
lastModified, name, path, persistent, store, type |
| Fields inherited from class org.red5.server.AttributeStore |
|---|
attributes |
| Fields inherited from interface org.red5.server.api.so.ISharedObject |
|---|
TYPE |
| Fields inherited from interface org.red5.server.api.persistence.IPersistable |
|---|
TRANSIENT_PREFIX |
| Fields inherited from interface org.red5.server.api.so.ISharedObjectSecurityService |
|---|
BEAN_NAME |
| Constructor Summary | |
|---|---|
SharedObjectScope(IScope parent,
String name,
boolean persistent,
IPersistenceStore store)
Creates shared object with given parent scope, name, persistence flag state and store object |
|
| Method Summary | |
|---|---|
void |
acquire()
Prevent shared object from being released. |
void |
addEventListener(IEventListener listener)
Add event listener to list of notified objects |
void |
addSharedObjectListener(ISharedObjectListener listener)
Register object that will be notified about update events. |
void |
beginUpdate()
Start performing multiple updates to the shared object from serverside code. |
void |
beginUpdate(IEventListener listener)
Start performing multiple updates to the shared object from a connected client. |
boolean |
clear()
Deletes all the attributes and sends a clear event to all listeners. |
void |
close()
Detaches a reference from this shared object, this will destroy the reference immediately. |
void |
dispatchEvent(IEvent e)
Dispatches event (notifies all listeners) |
void |
endUpdate()
The multiple updates are complete, notify clients about all changes at once. |
Object |
getAttribute(String name)
Return the value for a given attribute. |
Object |
getAttribute(String name,
Object value)
Return the value for a given attribute and set it if it doesn't exist. |
Set<String> |
getAttributeNames()
Get the attribute names. |
Map<String,Object> |
getAttributes()
Get the attributes. |
Map<String,Object> |
getData()
Return a map containing all attributes of the shared object. |
String |
getName()
Return store name |
String |
getPath()
Ruturn scope path |
Object |
getServiceHandler(String name)
Return a previously registered service handler. |
Set<String> |
getServiceHandlerNames()
Get list of registered service handler names. |
Set<ISharedObjectSecurity> |
getSharedObjectSecurity()
Get handlers that protect shared objects. |
ISharedObjectStatistics |
getStatistics()
Return statistics about the shared object. |
IPersistenceStore |
getStore()
Return persistent store |
String |
getType()
Return scope type |
int |
getVersion()
Returns the version of the shared object. |
boolean |
hasAttribute(String name)
Check the object has an attribute. |
boolean |
isAcquired()
Check if shared object currently is acquired. |
protected boolean |
isConnectionAllowed()
Call handlers and check if connection to the existing SO is allowed. |
protected boolean |
isDeleteAllowed(String key)
Call handlers and check if deleting a property from the SO is allowed. |
boolean |
isLocked()
Returns the locked state of this SharedObject. |
boolean |
isPersistentObject()
Check if the object has been created as persistent shared object by the client. |
protected boolean |
isSendAllowed(String message,
List<?> arguments)
Call handlers and check if sending a message to the clients connected to the SO is allowed. |
protected boolean |
isWriteAllowed(String key,
Object value)
Call handlers and check if writing to the SO is allowed. |
void |
lock()
Locks the shared object instance. |
void |
registerServiceHandler(Object handler)
Register an object that provides methods which handle calls without a service name to a shared object. |
void |
registerServiceHandler(String name,
Object handler)
Register an object that provides methods which can be called from a client. |
void |
registerSharedObjectSecurity(ISharedObjectSecurity handler)
Add handler that protects shared objects. |
void |
release()
Release previously acquired shared object. |
boolean |
removeAttribute(String name)
Removes attribute |
void |
removeAttributes()
Removes all attributes and sets modified flag |
void |
removeEventListener(IEventListener listener)
Remove event listener from list of listeners |
void |
removeSharedObjectListener(ISharedObjectListener listener)
Unregister object to not longer receive update events. |
void |
sendMessage(String handler,
List<?> arguments)
Send a message to a handler of the shared object. |
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 |
String |
toString()
|
void |
unlock()
Unlocks a shared object instance that was locked with SharedObject.lock(). |
void |
unregisterServiceHandler()
|
void |
unregisterServiceHandler(String name)
Unregister the shared object handler for calls without a service name. |
void |
unregisterSharedObjectSecurity(ISharedObjectSecurity handler)
Remove handler that protects shared objects. |
| Methods inherited from class org.red5.server.BasicScope |
|---|
getDepth, getEventListeners, getParent, handleEvent, hasEventListeners, hasParent, iterator, notifyEvent, setKeepDelay |
| Methods inherited from class org.red5.server.PersistableAttributeStore |
|---|
deserialize, getLastModified, isPersistent, modified, serialize, setPersistent, setStore |
| Methods inherited from class org.red5.server.AttributeStore |
|---|
filterNull, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.red5.server.api.IBasicScope |
|---|
getDepth, getParent, hasParent, setKeepDelay |
| Methods inherited from interface org.red5.server.api.ICastingAttributeStore |
|---|
getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute |
| Methods inherited from interface org.red5.server.api.event.IEventHandler |
|---|
handleEvent |
| Methods inherited from interface org.red5.server.api.event.IEventListener |
|---|
notifyEvent |
| Methods inherited from interface org.red5.server.api.event.IEventObservable |
|---|
getEventListeners |
| Methods inherited from interface java.lang.Iterable |
|---|
iterator |
| Methods inherited from interface org.red5.server.api.persistence.IPersistable |
|---|
deserialize, getLastModified, isPersistent, serialize, setPersistent, setStore |
| Field Detail |
|---|
protected SharedObject so
| Constructor Detail |
|---|
public SharedObjectScope(IScope parent,
String name,
boolean persistent,
IPersistenceStore store)
parent - Parent scopename - Namepersistent - Persistence flag statestore - Persistence store| Method Detail |
|---|
public void registerSharedObjectSecurity(ISharedObjectSecurity handler)
registerSharedObjectSecurity in interface ISharedObjectSecurityServicehandler - Handler to add.public void unregisterSharedObjectSecurity(ISharedObjectSecurity handler)
unregisterSharedObjectSecurity in interface ISharedObjectSecurityServicehandler - Handler to remove.public Set<ISharedObjectSecurity> getSharedObjectSecurity()
getSharedObjectSecurity in interface ISharedObjectSecurityServicepublic IPersistenceStore getStore()
getStore in interface IPersistablegetStore in class PersistableAttributeStorepublic String getName()
getName in interface IBasicScopegetName in interface IPersistablegetName in class PersistableAttributeStorepublic void setName(String name)
setName in interface IPersistablesetName in class PersistableAttributeStorename - Namepublic String getPath()
getPath in interface IBasicScopegetPath in interface IPersistablegetPath in class BasicScopepublic void setPath(String path)
setPath in interface IPersistablesetPath in class PersistableAttributeStorepath - Pathpublic String getType()
getType in interface IBasicScopegetType in interface IPersistablegetType in class PersistableAttributeStorepublic boolean isPersistentObject()
isPersistentObject in interface ISharedObjectBasepublic void beginUpdate()
beginUpdate in interface ISharedObjectBasepublic void beginUpdate(IEventListener listener)
beginUpdate in interface ISharedObjectBaselistener - Update events listenerpublic void endUpdate()
endUpdate in interface ISharedObjectBasepublic int getVersion()
getVersion in interface ISharedObjectBase
public void sendMessage(String handler,
List<?> arguments)
sendMessage in interface ISharedObjectBasehandler - the name of the handler to callarguments - a list of objects that should be passed as arguments to the
handlerpublic boolean removeAttribute(String name)
removeAttribute in interface AttributeStoreMBeanremoveAttribute in interface IAttributeStoreremoveAttribute in class PersistableAttributeStorename - Attribute name
public void removeAttributes()
removeAttributes in interface AttributeStoreMBeanremoveAttributes in interface IAttributeStoreremoveAttributes in class PersistableAttributeStorepublic void addEventListener(IEventListener listener)
addEventListener in interface IEventObservableaddEventListener in class BasicScopelistener - Listening objectpublic void removeEventListener(IEventListener listener)
removeEventListener in interface IEventObservableremoveEventListener in class BasicScopelistener - Listener to removepublic boolean hasAttribute(String name)
hasAttribute in interface AttributeStoreMBeanhasAttribute in interface IAttributeStorehasAttribute in class AttributeStorename - the name of the attribute to check
public Object getAttribute(String name)
getAttribute in interface AttributeStoreMBeangetAttribute in interface IAttributeStoregetAttribute in class AttributeStorename - the name of the attribute to get
public Object getAttribute(String name,
Object value)
getAttribute in interface AttributeStoreMBeangetAttribute in interface IAttributeStoregetAttribute in class PersistableAttributeStorename - the name of the attribute to getvalue - the value of the attribute to set if the attribute doesn't
exist
public Map<String,Object> getAttributes()
getAttributes in interface AttributeStoreMBeangetAttributes in interface IAttributeStoregetAttributes in class AttributeStorepublic Set<String> getAttributeNames()
getAttributeNames in interface AttributeStoreMBeangetAttributeNames in interface IAttributeStoregetAttributeNames in class AttributeStorepublic Map<String,Object> getData()
getData in interface ISharedObjectBaseprotected boolean isConnectionAllowed()
protected boolean isWriteAllowed(String key,
Object value)
key - keyvalue - value
protected boolean isDeleteAllowed(String key)
key - key
protected boolean isSendAllowed(String message,
List<?> arguments)
message - messagearguments - arguments
public void dispatchEvent(IEvent e)
dispatchEvent in interface IEventDispatcherdispatchEvent in class BasicScopee - Event to dispatch
public boolean setAttribute(String name,
Object value)
setAttribute in interface AttributeStoreMBeansetAttribute in interface IAttributeStoresetAttribute in class PersistableAttributeStorename - Attribute namevalue - Attribute value
public void setAttributes(IAttributeStore values)
setAttributes in interface IAttributeStoresetAttributes in class PersistableAttributeStorevalues - Attributes storepublic void setAttributes(Map<String,Object> values)
setAttributes in interface IAttributeStoresetAttributes in class PersistableAttributeStorevalues - Attributes as Mappublic String toString()
toString in class Objectpublic void addSharedObjectListener(ISharedObjectListener listener)
addSharedObjectListener in interface ISharedObjectBaselistener - the object to notifypublic void removeSharedObjectListener(ISharedObjectListener listener)
removeSharedObjectListener in interface ISharedObjectBaselistener - the object to unregisterpublic void registerServiceHandler(Object handler)
registerServiceHandler in interface ISharedObjectHandlerProviderhandler - the handler object
public void registerServiceHandler(String name,
Object handler)
Example:
If you registered a handler with the name "one.two" that
provides a method "callMe", you can call a method
"one.two.callMe" from the client.
registerServiceHandler in interface IServiceHandlerProvidername - the name of the handlerhandler - the handler objectpublic void unregisterServiceHandler()
public void unregisterServiceHandler(String name)
unregisterServiceHandler in interface IServiceHandlerProviderunregisterServiceHandler in interface ISharedObjectHandlerProvidername - the name of the handlerpublic Object getServiceHandler(String name)
getServiceHandler in interface IServiceHandlerProvidername - the name of the handler to return
public Set<String> getServiceHandlerNames()
getServiceHandlerNames in interface IServiceHandlerProviderpublic void lock()
lock in interface IBasicScopelock in interface ISharedObjectBasepublic void unlock()
unlock in interface IBasicScopeunlock in interface ISharedObjectBasepublic boolean isLocked()
isLocked in interface ISharedObjectBasepublic boolean clear()
clear in interface ISharedObjectBasepublic void close()
close in interface ISharedObjectBasepublic void acquire()
acquire
must be paired with a call to release so the SO isn't held
forever.
This method basically is a noop for persistent SOs as their data is stored
and they can be released without losing their contents.
acquire in interface ISharedObjectpublic boolean isAcquired()
isAcquired in interface ISharedObjecttrue if the SO is acquired, otherwise falsepublic void release()
release in interface ISharedObjectpublic ISharedObjectStatistics getStatistics()
getStatistics in interface ISharedObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||