|
||||||||||
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 storeMethod Detail |
---|
public void registerSharedObjectSecurity(ISharedObjectSecurity handler)
registerSharedObjectSecurity
in interface ISharedObjectSecurityService
handler
- Handler to add.public void unregisterSharedObjectSecurity(ISharedObjectSecurity handler)
unregisterSharedObjectSecurity
in interface ISharedObjectSecurityService
handler
- Handler to remove.public Set<ISharedObjectSecurity> getSharedObjectSecurity()
getSharedObjectSecurity
in interface ISharedObjectSecurityService
public IPersistenceStore getStore()
getStore
in interface IPersistable
getStore
in class PersistableAttributeStore
public String getName()
getName
in interface IBasicScope
getName
in interface IPersistable
getName
in class PersistableAttributeStore
public void setName(String name)
setName
in interface IPersistable
setName
in class PersistableAttributeStore
name
- Namepublic String getPath()
getPath
in interface IBasicScope
getPath
in interface IPersistable
getPath
in class BasicScope
public void setPath(String path)
setPath
in interface IPersistable
setPath
in class PersistableAttributeStore
path
- Pathpublic String getType()
getType
in interface IBasicScope
getType
in interface IPersistable
getType
in class PersistableAttributeStore
public boolean isPersistentObject()
isPersistentObject
in interface ISharedObjectBase
public void beginUpdate()
beginUpdate
in interface ISharedObjectBase
public void beginUpdate(IEventListener listener)
beginUpdate
in interface ISharedObjectBase
listener
- Update events listenerpublic void endUpdate()
endUpdate
in interface ISharedObjectBase
public int getVersion()
getVersion
in interface ISharedObjectBase
public void sendMessage(String handler, List<?> arguments)
sendMessage
in interface ISharedObjectBase
handler
- 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 AttributeStoreMBean
removeAttribute
in interface IAttributeStore
removeAttribute
in class PersistableAttributeStore
name
- Attribute name
public void removeAttributes()
removeAttributes
in interface AttributeStoreMBean
removeAttributes
in interface IAttributeStore
removeAttributes
in class PersistableAttributeStore
public void addEventListener(IEventListener listener)
addEventListener
in interface IEventObservable
addEventListener
in class BasicScope
listener
- Listening objectpublic void removeEventListener(IEventListener listener)
removeEventListener
in interface IEventObservable
removeEventListener
in class BasicScope
listener
- Listener to removepublic boolean hasAttribute(String name)
hasAttribute
in interface AttributeStoreMBean
hasAttribute
in interface IAttributeStore
hasAttribute
in class AttributeStore
name
- the name of the attribute to check
public Object getAttribute(String name)
getAttribute
in interface AttributeStoreMBean
getAttribute
in interface IAttributeStore
getAttribute
in class AttributeStore
name
- the name of the attribute to get
public Object getAttribute(String name, Object value)
getAttribute
in interface AttributeStoreMBean
getAttribute
in interface IAttributeStore
getAttribute
in class PersistableAttributeStore
name
- 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 AttributeStoreMBean
getAttributes
in interface IAttributeStore
getAttributes
in class AttributeStore
public Set<String> getAttributeNames()
getAttributeNames
in interface AttributeStoreMBean
getAttributeNames
in interface IAttributeStore
getAttributeNames
in class AttributeStore
public Map<String,Object> getData()
getData
in interface ISharedObjectBase
protected 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 IEventDispatcher
dispatchEvent
in class BasicScope
e
- Event to dispatchpublic boolean setAttribute(String name, Object value)
setAttribute
in interface AttributeStoreMBean
setAttribute
in interface IAttributeStore
setAttribute
in class PersistableAttributeStore
name
- Attribute namevalue
- Attribute value
public void setAttributes(IAttributeStore values)
setAttributes
in interface IAttributeStore
setAttributes
in class PersistableAttributeStore
values
- Attributes storepublic void setAttributes(Map<String,Object> values)
setAttributes
in interface IAttributeStore
setAttributes
in class PersistableAttributeStore
values
- Attributes as Mappublic String toString()
toString
in class Object
public void addSharedObjectListener(ISharedObjectListener listener)
addSharedObjectListener
in interface ISharedObjectBase
listener
- the object to notifypublic void removeSharedObjectListener(ISharedObjectListener listener)
removeSharedObjectListener
in interface ISharedObjectBase
listener
- the object to unregisterpublic void registerServiceHandler(Object handler)
registerServiceHandler
in interface ISharedObjectHandlerProvider
handler
- the handler objectpublic 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 IServiceHandlerProvider
name
- the name of the handlerhandler
- the handler objectpublic void unregisterServiceHandler()
public void unregisterServiceHandler(String name)
unregisterServiceHandler
in interface IServiceHandlerProvider
unregisterServiceHandler
in interface ISharedObjectHandlerProvider
name
- the name of the handlerpublic Object getServiceHandler(String name)
getServiceHandler
in interface IServiceHandlerProvider
name
- the name of the handler to return
public Set<String> getServiceHandlerNames()
getServiceHandlerNames
in interface IServiceHandlerProvider
public void lock()
lock
in interface IBasicScope
lock
in interface ISharedObjectBase
public void unlock()
unlock
in interface IBasicScope
unlock
in interface ISharedObjectBase
public boolean isLocked()
isLocked
in interface ISharedObjectBase
public boolean clear()
clear
in interface ISharedObjectBase
public void close()
close
in interface ISharedObjectBase
public 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 ISharedObject
public boolean isAcquired()
isAcquired
in interface ISharedObject
true
if the SO is acquired, otherwise false
public void release()
release
in interface ISharedObject
public ISharedObjectStatistics getStatistics()
getStatistics
in interface ISharedObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |