org.red5.server.net.rtmp.status

## Class StatusObjectService

- java.lang.Object
- - org.red5.server.net.rtmp.status.StatusObjectService

All Implemented Interfaces:
  StatusCodes, org.springframework.beans.factory.InitializingBean

    public class StatusObjectService
    extends Object
    implements StatusCodes, org.springframework.beans.factory.InitializingBean

Service that works with status objects. Note all status object should aim to be under 128 bytes.

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard, Codegent Ltd (luke@codegent.com)

### Field Summary

Fields
`protected Map<String,byte[]>` `cachedStatusObjects` Cached status objects map
`protected static org.slf4j.Logger` `log` Logger
`protected Serializer` `serializer` Serializer
`protected Map<String,StatusObject>` `statusObjects` Status objects map

### Fields inherited from interface org.red5.server.net.rtmp.status.StatusCodes

`APP_GC, APP_RESOURCE_LOWMEMORY, APP_SCRIPT_ERROR, APP_SCRIPT_WARNING, APP_SHUTDOWN, NC_CALL_BADVERSION, NC_CALL_FAILED, NC_CONNECT_APPSHUTDOWN, NC_CONNECT_CLOSED, NC_CONNECT_FAILED, NC_CONNECT_INVALID_APPLICATION, NC_CONNECT_REJECTED, NC_CONNECT_SUCCESS, NS_BUFFER_EMPTY, NS_CLEAR_FAILED, NS_CLEAR_SUCCESS, NS_DATA_START, NS_FAILED, NS_INVALID_ARGUMENT, NS_PAUSE_NOTIFY, NS_PLAY_COMPLETE, NS_PLAY_FAILED, NS_PLAY_FILE_STRUCTURE_INVALID, NS_PLAY_INSUFFICIENT_BW, NS_PLAY_NO_SUPPORTED_TRACK_FOUND, NS_PLAY_PUBLISHNOTIFY, NS_PLAY_RESET, NS_PLAY_START, NS_PLAY_STOP, NS_PLAY_STREAMNOTFOUND, NS_PLAY_SWITCH, NS_PLAY_TRANSITION, NS_PLAY_TRANSITION_COMPLETE, NS_PLAY_UNPUBLISHNOTIFY, NS_PUBLISH_BADNAME, NS_PUBLISH_START, NS_RECORD_FAILED, NS_RECORD_NOACCESS, NS_RECORD_START, NS_RECORD_STOP, NS_SEEK_FAILED, NS_SEEK_NOTIFY, NS_TRANSITION_FORCED, NS_TRANSITION_SUCCESS, NS_UNPAUSE_NOTIFY, NS_UNPUBLISHED_SUCCESS, SO_CREATION_FAILED, SO_NO_READ_ACCESS, SO_NO_WRITE_ACCESS, SO_PERSISTENCE_MISMATCH`

### Constructor Summary

Constructors
Constructor and Description
`StatusObjectService()`

### Method Summary

Methods
`void` `afterPropertiesSet()` Initialization
`void` `cacheStatusObjects()` Cache status objects
`byte[]` `getCachedStatusObjectAsByteArray(String statusCode)` Return status object by code as byte array
`StatusObject` `getStatusObject(String statusCode)` Return status object by code
`void` `loadStatusObjects()` Creates all status objects and adds them to status objects map
`void` `serializeStatusObject(IoBuffer out, StatusObject statusObject)` Serializes status object
`void` `setSerializer(Serializer serializer)` Setter for serializer

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

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

### Field Detail

#### log

    protected static org.slf4j.Logger log

Logger

#### serializer

    protected Serializer serializer

Serializer

#### statusObjects

    protected Map<String,StatusObject> statusObjects

Status objects map

#### cachedStatusObjects

    protected Map<String,byte[]> cachedStatusObjects

Cached status objects map

### Constructor Detail

#### StatusObjectService

    public StatusObjectService()

### Method Detail

#### setSerializer

    public void setSerializer(Serializer serializer)

Setter for serializer

Parameters:
  `serializer` - Serializer object

#### afterPropertiesSet

    public void afterPropertiesSet()
                            throws Exception

Initialization

Specified by:
  `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
Throws:
  `Exception`

#### loadStatusObjects

    public void loadStatusObjects()

Creates all status objects and adds them to status objects map

#### cacheStatusObjects

    public void cacheStatusObjects()

Cache status objects

#### serializeStatusObject

    public void serializeStatusObject(IoBuffer out,
                             StatusObject statusObject)

Serializes status object

Parameters:
  `out` - Byte buffer for output object
  `statusObject` - Status object to serialize

#### getStatusObject

    public StatusObject getStatusObject(String statusCode)

Return status object by code

Parameters:
  `statusCode` - Status object code
Returns:
  Status object with given code

#### getCachedStatusObjectAsByteArray

    public byte[] getCachedStatusObjectAsByteArray(String statusCode)

Return status object by code as byte array

Parameters:
  `statusCode` - Status object code
Returns:
  Status object with given code as byte array