|
||||||||||
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.so.SharedObject
org.red5.server.so.ClientSharedObject
public class ClientSharedObject
Works with client-side shared object
Field Summary | |
---|---|
protected static Logger |
log
Logger |
Fields inherited from class org.red5.server.so.SharedObject |
---|
acquireCount, changeStats, deleteStats, lastModified, listenerStats, modified, name, ownerMessage, path, persistent, sendStats, source, storage, syncEvents, updateCounter, version |
Fields inherited from class org.red5.server.AttributeStore |
---|
attributes |
Fields inherited from interface org.red5.server.api.persistence.IPersistable |
---|
TRANSIENT_PREFIX |
Constructor Summary | |
---|---|
ClientSharedObject(String name,
boolean persistent)
Create new client SO with |
Method Summary | |
---|---|
void |
addSharedObjectListener(ISharedObjectListener listener)
Register object that will be notified about update events. |
void |
beginUpdate()
Begin update of this Shared Object. |
void |
beginUpdate(IEventListener listener)
Begin update of this Shared Object and setting listener |
boolean |
clear()
Deletes all the attributes and sends a clear event to all listeners. |
void |
close()
Detaches a reference from this shared object, reset it's state, this will destroy the reference immediately. |
void |
connect(IConnection conn)
Connect the shared object using the passed connection. |
void |
disconnect()
Disconnect the shared object. |
void |
dispatchEvent(IEvent e)
Dispatches event |
void |
endUpdate()
End update of this Shared Object. |
Object |
getAttribute(String name,
Object defaultValue)
Return attribute by name and set if it doesn't exist yet. |
Object |
getServiceHandler(String name)
Return a previously registered service handler. |
Set<String> |
getServiceHandlerNames()
Get list of registered service handler names. |
boolean |
isConnected()
Check if the shared object is connected to the server. |
boolean |
isLocked()
Returns the locked state of this SharedObject. |
void |
lock()
Locks the shared object instance. |
protected void |
notifyClear()
Notify listeners on clear |
protected void |
notifyConnect()
Notify listeners on event |
protected void |
notifyDelete(String key)
Notify listeners on attribute delete |
protected void |
notifyDisconnect()
Notify listeners on disconnect |
protected void |
notifySendMessage(String method,
List<?> params)
Broadcast send event to listeners |
protected void |
notifyUpdate(String key,
Map<String,Object> value)
Notify listeners on map attribute update |
protected void |
notifyUpdate(String key,
Object value)
Notify listeners on update |
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. |
boolean |
removeAttribute(String name)
Removes attribute with given name |
void |
removeAttributes()
Remove all attributes (clear Shared Object) |
void |
removeSharedObjectListener(ISharedObjectListener listener)
Unregister object to not longer receive update events. |
void |
sendMessage(String handler,
List<?> arguments)
Broadcast event to event handler |
boolean |
setAttribute(String name,
Object value)
Set an attribute on this object. |
boolean |
setAttributes(IAttributeStore values)
Set multiple attributes on this object. |
boolean |
setAttributes(Map<String,Object> values)
Set multiple attributes on this object. |
void |
unlock()
Unlocks a shared object instance that was locked with SharedObject.lock(). |
void |
unregisterServiceHandler(String name)
Unregister the shared object handler for calls without a service name. |
Methods inherited from class org.red5.server.so.SharedObject |
---|
acquire, checkRelease, deserialize, getActiveListeners, getCreationTime, getData, getLastModified, getListeners, getMaxListeners, getName, getPath, getStore, getTotalChanges, getTotalDeletes, getTotalListeners, getTotalSends, getType, getVersion, isAcquired, isPersistent, notifyModified, register, release, returnAttributeValue, returnError, sendUpdates, serialize, setName, setPath, setPersistent, setStore, unregister |
Methods inherited from class org.red5.server.AttributeStore |
---|
filterNull, from, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.red5.server.api.so.ISharedObjectBase |
---|
getData, getVersion, isPersistent |
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.IAttributeStore |
---|
getAttribute, getAttributeNames, getAttributes, hasAttribute, size |
Field Detail |
---|
protected static Logger log
Constructor Detail |
---|
public ClientSharedObject(String name, boolean persistent)
name
- Shared Object namepersistent
- Persistence flagMethod Detail |
---|
public void connect(IConnection conn)
connect
in interface IClientSharedObject
conn
- Attach SO to given connectionpublic void disconnect()
disconnect
in interface IClientSharedObject
public boolean isConnected()
isConnected
in interface IClientSharedObject
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 dispatchEvent(IEvent e)
dispatchEvent
in interface IEventDispatcher
e
- Event objectprotected void notifyConnect()
protected void notifyDisconnect()
protected void notifyUpdate(String key, Object value)
key
- Updated attribute keyvalue
- Updated attribute valueprotected void notifyUpdate(String key, Map<String,Object> value)
key
- Updated attribute keyvalue
- Updated attribute valueprotected void notifyDelete(String key)
key
- Attribute nameprotected void notifyClear()
protected void notifySendMessage(String method, List<?> params)
method
- Method nameparams
- Paramspublic boolean setAttribute(String name, Object value)
setAttribute
in interface IAttributeStore
setAttribute
in class SharedObject
name
- the name of the attribute to changevalue
- the new value of the attribute
public boolean setAttributes(IAttributeStore values)
setAttributes
in interface IAttributeStore
setAttributes
in class SharedObject
values
- the attributes to set
public boolean setAttributes(Map<String,Object> values)
setAttributes
in interface IAttributeStore
setAttributes
in class SharedObject
values
- the attributes to set
public boolean removeAttribute(String name)
removeAttribute
in interface IAttributeStore
removeAttribute
in interface AttributeStoreMXBean
removeAttribute
in class SharedObject
name
- Attribute
true
if there's such an attribute and it was removed, false
otherwisepublic void sendMessage(String handler, List<?> arguments)
sendMessage
in interface ISharedObjectBase
sendMessage
in class SharedObject
handler
- Event handlerarguments
- Argumentspublic void removeAttributes()
removeAttributes
in interface IAttributeStore
removeAttributes
in interface AttributeStoreMXBean
removeAttributes
in class SharedObject
public boolean clear()
clear
in interface ISharedObjectBase
clear
in class SharedObject
true
on success, false
otherwisepublic void close()
close
in interface ISharedObjectBase
close
in class SharedObject
public void beginUpdate()
beginUpdate
in interface ISharedObjectBase
beginUpdate
in class SharedObject
public void beginUpdate(IEventListener listener)
beginUpdate
in interface ISharedObjectBase
beginUpdate
in class SharedObject
listener
- Update with listenerpublic void endUpdate()
endUpdate
in interface ISharedObjectBase
endUpdate
in class SharedObject
public void lock()
lock
in interface ISharedObjectBase
public void unlock()
unlock
in interface ISharedObjectBase
public boolean isLocked()
isLocked
in interface ISharedObjectBase
public void registerServiceHandler(Object handler)
registerServiceHandler
in interface ISharedObjectHandlerProvider
handler
- the handler objectpublic void unregisterServiceHandler(String name)
unregisterServiceHandler
in interface IServiceHandlerProvider
unregisterServiceHandler
in interface ISharedObjectHandlerProvider
name
- the name of the handlerpublic 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 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 Object getAttribute(String name, Object defaultValue)
getAttribute
in interface IAttributeStore
getAttribute
in class SharedObject
name
- Attribute namedefaultValue
- Value to set if attribute doesn't exist
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |