Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.red5.server.so
Class ClientSharedObject

    java.lang.Object
      org.red5.server.AttributeStore
          org.red5.server.so.SharedObject
              org.red5.server.so.ClientSharedObject

All Implemented Interfaces:
  AttributeStoreMBean, IEventDispatcher, IAttributeStore, ICastingAttributeStore, IPersistable, IServiceHandlerProvider, IClientSharedObject, ISharedObjectBase, ISharedObjectHandlerProvider, ISharedObjectStatistics, IStatisticsBase, Constants

    public class ClientSharedObject

extends SharedObject
implements IClientSharedObject, IEventDispatcher

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, executor, lastModified, listenerStats, modified, name, ownerMessage, path, persistent, persistentSO, 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`

Fields inherited from interface org.red5.server.net.rtmp.message.Constants
`HANDSHAKE_SIZE, HEADER_CONTINUE, HEADER_NEW, HEADER_SAME_SOURCE, HEADER_TIMER_CHANGE, MEDIUM_INT_MAX, SO_CLIENT_CLEAR_DATA, SO_CLIENT_DELETE_DATA, SO_CLIENT_INITIAL_DATA, SO_CLIENT_SEND_MESSAGE, SO_CLIENT_STATUS, SO_CLIENT_UPDATE_ATTRIBUTE, SO_CLIENT_UPDATE_DATA, SO_CONNECT, SO_DELETE_ATTRIBUTE, SO_DISCONNECT, SO_SEND_MESSAGE, SO_SET_ATTRIBUTE, SOURCE_TYPE_LIVE, SOURCE_TYPE_VOD, TYPE_ABORT, TYPE_AGGREGATE, TYPE_AUDIO_DATA, TYPE_BYTES_READ, TYPE_CHUNK_SIZE, TYPE_CLIENT_BANDWIDTH, TYPE_FLEX_MESSAGE, TYPE_FLEX_SHARED_OBJECT, TYPE_FLEX_STREAM_SEND, TYPE_INVOKE, TYPE_NOTIFY, TYPE_PING, TYPE_SERVER_BANDWIDTH, TYPE_SHARED_OBJECT, TYPE_STREAM_METADATA, TYPE_VIDEO_DATA`

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 value of attribute with given name
`void` | `setAttributes(IAttributeStore values)` Set attributes as attributes store.
`void` | `setAttributes(Map<String,Object> values)` Set attributes as map.
`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, isPersistentObject, notifyModified, register, release, returnAttributeValue, returnError, sendUpdates, serialize, setName, setPath, setPersistent, setStore, unregister`

Methods inherited from class org.red5.server.AttributeStore
`filterNull, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute`

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, isPersistentObject`

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`

Field Detail

### log

    protected static Logger log

  Logger

Constructor Detail

### ClientSharedObject

    public ClientSharedObject(String name,
                              boolean persistent)

  Create new client SO with

  Parameters:
    `name` - Shared Object name
    `persistent` - Persistence flag

Method Detail

### connect

    public void connect(IConnection conn)

  Connect the shared object using the passed connection.

  Specified by:
    `connect` in interface `IClientSharedObject`
  Parameters:
    `conn` - Attach SO to given connection

### disconnect

    public void disconnect()

  Disconnect the shared object.

  Specified by:
    `disconnect` in interface `IClientSharedObject`

### isConnected

    public boolean isConnected()

  Check if the shared object is connected to the server.

  Specified by:
    `isConnected` in interface `IClientSharedObject`
  Returns:
    is connected

### addSharedObjectListener

    public void addSharedObjectListener(ISharedObjectListener listener)

  Register object that will be notified about update events.

  Specified by:
    `addSharedObjectListener` in interface `ISharedObjectBase`
  Parameters:
    `listener` - the object to notify

### removeSharedObjectListener

    public void removeSharedObjectListener(ISharedObjectListener listener)

  Unregister object to not longer receive update events.

  Specified by:
    `removeSharedObjectListener` in interface `ISharedObjectBase`
  Parameters:
    `listener` - the object to unregister

### dispatchEvent

    public void dispatchEvent(IEvent e)

  Dispatches event

  Specified by:
    `dispatchEvent` in interface `IEventDispatcher`
  Parameters:
    `e` - Event object

### notifyConnect

    protected void notifyConnect()

  Notify listeners on event

### notifyDisconnect

    protected void notifyDisconnect()

  Notify listeners on disconnect

### notifyUpdate

    protected void notifyUpdate(String key,
                                Object value)

  Notify listeners on update

  Parameters:
    `key` - Updated attribute key
    `value` - Updated attribute value

### notifyUpdate

    protected void notifyUpdate(String key,
                                Map<String,Object> value)

  Notify listeners on map attribute update

  Parameters:
    `key` - Updated attribute key
    `value` - Updated attribute value

### notifyDelete

    protected void notifyDelete(String key)

  Notify listeners on attribute delete

  Parameters:
    `key` - Attribute name

### notifyClear

    protected void notifyClear()

  Notify listeners on clear

### notifySendMessage

    protected void notifySendMessage(String method,
                                     List<?> params)

  Broadcast send event to listeners

  Parameters:
    `method` - Method name
    `params` - Params

### setAttribute

    public boolean setAttribute(String name,
                                Object value)

  Set value of attribute with given name

  Specified by:
    `setAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `setAttribute` in interface `IAttributeStore`
  Overrides:
    `setAttribute` in class `SharedObject`
  Parameters:
    `name` - Attribute name
    `value` - Attribute value
  Returns:
    `true` if there's such attribute and value was set, `false` otherwise

### setAttributes

    public void setAttributes(IAttributeStore values)

  Set attributes as attributes store.

  Specified by:
    `setAttributes` in interface `IAttributeStore`
  Overrides:
    `setAttributes` in class `SharedObject`
  Parameters:
    `values` - Attributes.

### setAttributes

    public void setAttributes(Map<String,Object> values)

  Set attributes as map.

  Specified by:
    `setAttributes` in interface `IAttributeStore`
  Overrides:
    `setAttributes` in class `SharedObject`
  Parameters:
    `values` - Attributes.

### removeAttribute

    public boolean removeAttribute(String name)

  Removes attribute with given name

  Specified by:
    `removeAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `removeAttribute` in interface `IAttributeStore`
  Overrides:
    `removeAttribute` in class `SharedObject`
  Parameters:
    `name` - Attribute
  Returns:
    `true` if there's such an attribute and it was removed, `false` otherwise

### sendMessage

    public void sendMessage(String handler,
                            List<?> arguments)

  Broadcast event to event handler

  Specified by:
    `sendMessage` in interface `ISharedObjectBase`
  Overrides:
    `sendMessage` in class `SharedObject`
  Parameters:
    `handler` - Event handler
    `arguments` - Arguments

### removeAttributes

    public void removeAttributes()

  Remove all attributes (clear Shared Object)

  Specified by:
    `removeAttributes` in interface `AttributeStoreMBean`
  Specified by:
    `removeAttributes` in interface `IAttributeStore`
  Overrides:
    `removeAttributes` in class `SharedObject`

### clear

    public boolean clear()

  Deletes all the attributes and sends a clear event to all listeners. The persistent data object is also removed from a persistent shared object.

  Specified by:
    `clear` in interface `ISharedObjectBase`
  Overrides:
    `clear` in class `SharedObject`
  Returns:
    `true` on success, `false` otherwise

### close

    public void close()

  Detaches a reference from this shared object, reset it's state, this will destroy the reference immediately. This is useful when you don't want to proxy a shared object any longer.

  Specified by:
    `close` in interface `ISharedObjectBase`
  Overrides:
    `close` in class `SharedObject`

### beginUpdate

    public void beginUpdate()

  Begin update of this Shared Object. Increases number of pending update operations

  Specified by:
    `beginUpdate` in interface `ISharedObjectBase`
  Overrides:
    `beginUpdate` in class `SharedObject`

### beginUpdate

    public void beginUpdate(IEventListener listener)

  Begin update of this Shared Object and setting listener

  Specified by:
    `beginUpdate` in interface `ISharedObjectBase`
  Overrides:
    `beginUpdate` in class `SharedObject`
  Parameters:
    `listener` - Update with listener

### endUpdate

    public void endUpdate()

  End update of this Shared Object. Decreases number of pending update operations and broadcasts modified event if it is equal to zero (i.e. no more pending update operations).

  Specified by:
    `endUpdate` in interface `ISharedObjectBase`
  Overrides:
    `endUpdate` in class `SharedObject`

### lock

    public void lock()

  Locks the shared object instance. Prevents any changes to this object by clients until the SharedObject.unlock() method is called.

  Specified by:
    `lock` in interface `ISharedObjectBase`

### unlock

    public void unlock()

  Unlocks a shared object instance that was locked with SharedObject.lock().

  Specified by:
    `unlock` in interface `ISharedObjectBase`

### isLocked

    public boolean isLocked()

  Returns the locked state of this SharedObject.

  Specified by:
    `isLocked` in interface `ISharedObjectBase`
  Returns:
    true if in a locked state; false otherwise

### registerServiceHandler

    public void registerServiceHandler(Object handler)

  Register an object that provides methods which handle calls without a service name to a shared object.

  Specified by:
    `registerServiceHandler` in interface `ISharedObjectHandlerProvider`
  Parameters:
    `handler` - the handler object

### unregisterServiceHandler

    public void unregisterServiceHandler(String name)

  Unregister the shared object handler for calls without a service name.

  Specified by:
    `unregisterServiceHandler` in interface `IServiceHandlerProvider`
  Specified by:
    `unregisterServiceHandler` in interface `ISharedObjectHandlerProvider`
  Parameters:
    `name` - the name of the handler

### registerServiceHandler

    public void registerServiceHandler(String name,
                                       Object handler)

  Register an object that provides methods which can be called from a client.

  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.

  Specified by:
    `registerServiceHandler` in interface `IServiceHandlerProvider`
  Parameters:
    `name` - the name of the handler
    `handler` - the handler object

### getServiceHandler

    public Object getServiceHandler(String name)

  Return a previously registered service handler.

  Specified by:
    `getServiceHandler` in interface `IServiceHandlerProvider`
  Parameters:
    `name` - the name of the handler to return
  Returns:
    the previously registered handler

### getServiceHandlerNames

    public Set<String> getServiceHandlerNames()

  Get list of registered service handler names.

  Specified by:
    `getServiceHandlerNames` in interface `IServiceHandlerProvider`
  Returns:
    the names of the registered handlers

### getAttribute

    public Object getAttribute(String name,
                               Object defaultValue)

  Return attribute by name and set if it doesn't exist yet.

  Specified by:
    `getAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `getAttribute` in interface `IAttributeStore`
  Overrides:
    `getAttribute` in class `SharedObject`
  Parameters:
    `name` - Attribute name
    `defaultValue` - Value to set if attribute doesn't exist
  Returns:
    Attribute value

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 The Red5 Project