org.red5.server.api

## Class Red5

- java.lang.Object
- - org.red5.server.api.Red5

    public final class Red5
    extends Object

Utility class for accessing Red5 API objects. This class uses a thread local, and will be setup by the service invoker. The code below shows various uses.

     IConnection conn = Red5.getConnectionLocal();
     Red5 r5 = new Red5();
     IScope scope = r5.getScope();
     conn = r5.getConnection();
     r5 = new Red5(conn);
     IClient client = r5.getClient();

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard (luke@codegent.com), Paul Gregoire (mondain@gmail.com)

### Field Summary

Fields
`IConnection` `conn` Connection local to the current thread
`static Map<String,Object>` `DATA_VERSION` Data version for NetStatusEvents
`static String` `FMS_VERSION` Current server version for fmsVer requests
`static String` `VERSION` Current server version with revision

### Constructor Summary

Constructors
Constructor and Description
`Red5()` Create a new Red5 object using the connection local to the current thread A bit of magic that lets you access the red5 scope from anywhere
`Red5(IConnection conn)` Create a new Red5 object using given connection.

### Method Summary

Methods
`static Red5` `from(CompositeData cd)` Allows for reconstruction via CompositeData.
`IClient` `getClient()` Get the client
`IConnection` `getConnection()` Get the connection object.
`static IConnection` `getConnectionLocal()` Get the connection associated with the current thread.
`IContext` `getContext()` Get the spring application context
`static Object` `getDataVersion()`
`static String` `getFMSVersion()` Returns the current version for fmsVer requests
`IScope` `getScope()` Get the scope
`static long` `getUpTime()` Returns server uptime in milliseconds.
`static String` `getVersion()` Returns the current version with revision number
`static void` `setConnectionLocal(IConnection connection)` Setter for connection

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

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

### Field Detail

#### conn

    public IConnection conn

Connection local to the current thread

#### VERSION

    public static final String VERSION

Current server version with revision

See Also:
  Constant Field Values

#### FMS_VERSION

    public static final String FMS_VERSION

Current server version for fmsVer requests

See Also:
  Constant Field Values

#### DATA_VERSION

    public static final Map<String,Object> DATA_VERSION

Data version for NetStatusEvents

### Constructor Detail

#### Red5

    public Red5(IConnection conn)

Create a new Red5 object using given connection.

Parameters:
  `conn` - Connection object.

#### Red5

    public Red5()

Create a new Red5 object using the connection local to the current thread A bit of magic that lets you access the red5 scope from anywhere

### Method Detail

#### setConnectionLocal

    public static void setConnectionLocal(IConnection connection)

Setter for connection

Parameters:
  `connection` - Thread local connection

#### getConnectionLocal

    public static IConnection getConnectionLocal()

Get the connection associated with the current thread. This method allows you to get connection object local to current thread. When you need to get a connection associated with event handler and so forth, this method provides you with it.

Returns:
  Connection object

#### getConnection

    public IConnection getConnection()

Get the connection object.

Returns:
  Connection object

#### getScope

    public IScope getScope()

Get the scope

Returns:
  Scope object

#### getClient

    public IClient getClient()

Get the client

Returns:
  Client object

#### getContext

    public IContext getContext()

Get the spring application context

Returns:
  Application context

#### getVersion

    public static String getVersion()

Returns the current version with revision number

Returns:
  String version

#### getFMSVersion

    public static String getFMSVersion()

Returns the current version for fmsVer requests

Returns:
  String fms version

#### getDataVersion

    public static Object getDataVersion()

#### getUpTime

    public static long getUpTime()

Returns server uptime in milliseconds.

Returns:
  String version

#### from

    public static Red5 from(CompositeData cd)

Allows for reconstruction via CompositeData.

Parameters:
  `cd` - composite data
Returns:
  Red5 class instance