|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.red5.server.scope.BasicScope
org.red5.server.so.SharedObjectScope
public class SharedObjectScope
Special scope for shared objects
| Field Summary | |
|---|---|
protected SharedObject |
so
Scoped shared object |
| Fields inherited from class org.red5.server.scope.BasicScope |
|---|
keepDelay, keepOnDisconnect, listeners, name, parent, persistenceClass, persistent, store, type |
| 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. |
Boolean |
getBoolAttribute(String name)
Get Boolean attribute by name |
Byte |
getByteAttribute(String name)
Get Byte attribute by name |
Map<String,Object> |
getData()
Return a map containing all attributes of the shared object. |
Double |
getDoubleAttribute(String name)
Get Double attribute by name |
Integer |
getIntAttribute(String name)
Get Integer attribute by name |
List<?> |
getListAttribute(String name)
Get List attribute by name |
Long |
getLongAttribute(String name)
Get boolean attribute by name |
Map<?,?> |
getMapAttribute(String name)
Get Long attribute by name |
String |
getName()
Get the name of this scope. |
String |
getPath()
Get the full absolute path. |
Object |
getServiceHandler(String name)
Return a previously registered service handler. |
Set<String> |
getServiceHandlerNames()
Get list of registered service handler names. |
Set<?> |
getSetAttribute(String name)
Get Set attribute by name |
Set<ISharedObjectSecurity> |
getSharedObjectSecurity()
Get handlers that protect shared objects. |
Short |
getShortAttribute(String name)
Get Short attribute by name |
ISharedObjectStatistics |
getStatistics()
Return statistics about the shared object. |
IPersistenceStore |
getStore()
Get the persistable store |
String |
getStringAttribute(String name)
Get String attribute by name |
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 |
isPersistent()
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)
Remove an attribute. |
void |
removeAttributes()
Remove all attributes. |
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 an attribute on this object. |
void |
setAttributes(IAttributeStore values)
Set multiple attributes on this object. |
void |
setAttributes(Map<String,Object> values)
Set multiple attributes on this object. |
void |
setPath(String 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.scope.BasicScope |
|---|
equals, getDepth, getEventListeners, getParent, getType, handleEvent, hasEventListeners, hashCode, hasParent, isValid, notifyEvent, setKeepDelay |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.red5.server.api.scope.IBasicScope |
|---|
getDepth, getParent, getType, hasParent, isValid, setKeepDelay |
| 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 |
| Field Detail |
|---|
protected volatile 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 IBasicScopegetStore in class BasicScopepublic String getName()
someroom.
getName in interface IBasicScopegetName in class BasicScopepublic String getPath()
host/myapp/someroom.
getPath in interface IBasicScopegetPath in class BasicScopepublic void setPath(String path)
public boolean isPersistent()
isPersistent 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 IAttributeStoreremoveAttribute in interface AttributeStoreMXBeanname - the name of the attribute to remove
public void removeAttributes()
removeAttributes in interface IAttributeStoreremoveAttributes in interface AttributeStoreMXBeanpublic 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 IAttributeStorehasAttribute in interface AttributeStoreMXBeanname - the name of the attribute to check
public Object getAttribute(String name)
getAttribute in interface IAttributeStorename - the name of the attribute to get
public Object getAttribute(String name,
Object value)
This is a utility function that internally performs the following code:
if (!hasAttribute(name)) setAttribute(name, defaultValue);
return getAttribute(name);
getAttribute in interface IAttributeStorename - 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 IAttributeStorepublic Set<String> getAttributeNames()
getAttributeNames in interface IAttributeStoregetAttributeNames in interface AttributeStoreMXBeanpublic Boolean getBoolAttribute(String name)
getBoolAttribute in interface ICastingAttributeStorename - Attribute name
public Byte getByteAttribute(String name)
getByteAttribute in interface ICastingAttributeStorename - Attribute name
public Double getDoubleAttribute(String name)
getDoubleAttribute in interface ICastingAttributeStorename - Attribute name
public Integer getIntAttribute(String name)
getIntAttribute in interface ICastingAttributeStorename - Attribute name
public List<?> getListAttribute(String name)
getListAttribute in interface ICastingAttributeStorename - Attribute name
public Long getLongAttribute(String name)
getLongAttribute in interface ICastingAttributeStorename - Attribute name
public Map<?,?> getMapAttribute(String name)
getMapAttribute in interface ICastingAttributeStorename - Attribute name
public Set<?> getSetAttribute(String name)
getSetAttribute in interface ICastingAttributeStorename - Attribute name
public Short getShortAttribute(String name)
getShortAttribute in interface ICastingAttributeStorename - Attribute name
public String getStringAttribute(String name)
getStringAttribute in interface ICastingAttributeStorename - Attribute name
public 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 IAttributeStorename - the name of the attribute to changevalue - the new value of the attribute
public void setAttributes(IAttributeStore values)
setAttributes in interface IAttributeStorevalues - the attributes to setpublic void setAttributes(Map<String,Object> values)
setAttributes in interface IAttributeStorevalues - the attributes to setpublic 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 ISharedObjectBasepublic void unlock()
unlock 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 | |||||||||