org.red5.server.so

## Class SharedObjectMessage

- java.lang.Object
- - org.red5.server.net.rtmp.event.BaseEvent
  - - org.red5.server.so.SharedObjectMessage

All Implemented Interfaces:
  Externalizable, Serializable, IEvent, IRTMPEvent, Constants, ISharedObjectMessage

Direct Known Subclasses:
  FlexSharedObjectMessage

    public class SharedObjectMessage
    extends BaseEvent
    implements ISharedObjectMessage

Shared object event

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.red5.server.api.event.IEvent

`IEvent.Type`

### Field Summary

### Fields inherited from class org.red5.server.net.rtmp.event.BaseEvent

`header, object, refcount, source, timestamp`

### 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_EDGE_ORIGIN, 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

Constructors
Constructor and Description
`SharedObjectMessage()`
`SharedObjectMessage(IEventListener source, String name, int version, boolean persistent)` Creates Shared Object event with given listener, name, SO version and persistence flag
`SharedObjectMessage(String name, int version, boolean persistent)` Creates Shared Object event with given name, version and persistence flag

### Method Summary

Methods
`void` `addEvent(ISharedObjectEvent.Type type, String key, Object value)` Addition event handler
`void` `addEvent(ISharedObjectEvent event)` Add event handler
`void` `addEvents(List<ISharedObjectEvent> events)`
`void` `addEvents(Queue<ISharedObjectEvent> events)`
`void` `clear()` Clear shared object
`byte` `getDataType()` Getter for data type
`ConcurrentLinkedQueue<ISharedObjectEvent>` `getEvents()` Returns a set of ISharedObjectEvent objects containing informations what to change.
`String` `getName()` Returns the name of the shared object this message belongs to.
`Object` `getObject()` Returns event context object
`IEvent.Type` `getType()` Returns even type
`int` `getVersion()` Returns the version to modify.
`boolean` `isEmpty()` Is empty?
`boolean` `isPersistent()` Does the message affect a persistent shared object?
`void` `readExternal(ObjectInput in)`
`protected void` `releaseInternal()` Release event
`protected void` `setName(String name)` Setter for name
`protected void` `setPersistent(boolean persistent)` Setter for persistence flag
`protected void` `setVersion(int version)` Setter for version
`String` `toString()`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class org.red5.server.net.rtmp.event.BaseEvent

`getHeader, getSource, getSourceType, getTimestamp, hasSource, release, retain, setHeader, setSource, setSourceType, setTimestamp, setType`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.red5.server.net.rtmp.event.IRTMPEvent

`getHeader, getSourceType, getTimestamp, release, retain, setHeader, setSource, setSourceType, setTimestamp`

### Methods inherited from interface org.red5.server.api.event.IEvent

`getSource, hasSource`

### Constructor Detail

#### SharedObjectMessage

    public SharedObjectMessage()

#### SharedObjectMessage

    public SharedObjectMessage(String name,
                       int version,
                       boolean persistent)

Creates Shared Object event with given name, version and persistence flag

Parameters:
  `name` - Event name
  `version` - SO version
  `persistent` - SO persistence flag

#### SharedObjectMessage

    public SharedObjectMessage(IEventListener source,
                       String name,
                       int version,
                       boolean persistent)

Creates Shared Object event with given listener, name, SO version and persistence flag

Parameters:
  `source` - Event listener
  `name` - Event name
  `version` - SO version
  `persistent` - SO persistence flag

### Method Detail

#### getDataType

    public byte getDataType()

Getter for data type

Specified by:
  `getDataType` in interface `IRTMPEvent`
Specified by:
  `getDataType` in class `BaseEvent`
Returns:
  Data type

#### getVersion

    public int getVersion()

Returns the version to modify.

Specified by:
  `getVersion` in interface `ISharedObjectMessage`
Returns:
  version to modify

#### setVersion

    protected void setVersion(int version)

Setter for version

Parameters:
  `version` - New version

#### getName

    public String getName()

Returns the name of the shared object this message belongs to.

Specified by:
  `getName` in interface `ISharedObjectMessage`
Returns:
  name of the shared object

#### setName

    protected void setName(String name)

Setter for name

Parameters:
  `name` - Event name

#### isPersistent

    public boolean isPersistent()

Does the message affect a persistent shared object?

Specified by:
  `isPersistent` in interface `ISharedObjectMessage`
Returns:
  true if a persistent shared object should be updated otherwise false

#### setPersistent

    protected void setPersistent(boolean persistent)

Setter for persistence flag

Parameters:
  `persistent` - Persistence flag

#### addEvent

    public void addEvent(ISharedObjectEvent event)

Add event handler

Specified by:
  `addEvent` in interface `ISharedObjectMessage`
Parameters:
  `event` - SO event

#### addEvents

    public void addEvents(List<ISharedObjectEvent> events)

#### addEvents

    public void addEvents(Queue<ISharedObjectEvent> events)

#### getEvents

    public ConcurrentLinkedQueue<ISharedObjectEvent> getEvents()

Returns a set of ISharedObjectEvent objects containing informations what to change.

Specified by:
  `getEvents` in interface `ISharedObjectMessage`
Returns:
  set of ISharedObjectEvents

#### addEvent

    public void addEvent(ISharedObjectEvent.Type type,
                String key,
                Object value)

Addition event handler

Specified by:
  `addEvent` in interface `ISharedObjectMessage`
Parameters:
  `type` - Event type
  `key` - Handler key
  `value` - Event value (like arguments)

#### clear

    public void clear()

Clear shared object

Specified by:
  `clear` in interface `ISharedObjectMessage`

#### isEmpty

    public boolean isEmpty()

Is empty?

Specified by:
  `isEmpty` in interface `ISharedObjectMessage`
Returns:
  `true` if shared object is empty, `false` otherwise

#### getType

    public IEvent.Type getType()

Returns even type

Specified by:
  `getType` in interface `IEvent`
Overrides:
  `getType` in class `BaseEvent`
Returns:
  Event type enumeration

#### getObject

    public Object getObject()

Returns event context object

Specified by:
  `getObject` in interface `IEvent`
Overrides:
  `getObject` in class `BaseEvent`
Returns:
  Event context object

#### releaseInternal

    protected void releaseInternal()

Release event

Specified by:
  `releaseInternal` in class `BaseEvent`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Overrides:
  `readExternal` in class `BaseEvent`
Throws:
  `IOException`
  `ClassNotFoundException`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Overrides:
  `writeExternal` in class `BaseEvent`
Throws:
  `IOException`