org.red5.server.adapter

## Class ApplicationAdapter

- java.lang.Object
- - org.red5.server.adapter.AbstractScopeAdapter
  - - org.red5.server.adapter.StatefulScopeWrappingAdapter
    - - org.red5.server.adapter.MultiThreadedApplicationAdapter
      - - org.red5.server.adapter.ApplicationAdapter

All Implemented Interfaces:
  IEventHandler, IAttributeStore, ISchedulingService, IScopeAware, IScopeHandler, IScopeService, ISharedObjectSecurityService, ISharedObjectService, IBroadcastStreamService, IOnDemandStreamService, IStreamAwareScopeHandler, IStreamSecurityService, ISubscriberStreamService, ApplicationMXBean, AttributeStoreMXBean

    public class ApplicationAdapter
    extends MultiThreadedApplicationAdapter

Base class for applications, takes care that callbacks are executed single-threaded. If you want to have maximum performance, use `MultiThreadedApplicationAdapter` instead. Using this class may lead to problems if accepting a client in the `*Connect` or `*Join` methods takes too long, so using the multi-threaded version is preferred.

Author:
  The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de)

### Field Summary

### Fields inherited from class org.red5.server.adapter.MultiThreadedApplicationAdapter

`log, schedulingService`

### Fields inherited from class org.red5.server.adapter.StatefulScopeWrappingAdapter

`plugins, scope`

### Fields inherited from interface org.red5.server.api.so.ISharedObjectService

`BEAN_NAME`

### Fields inherited from interface org.red5.server.api.stream.IBroadcastStreamService

`BROADCAST_STREAM_SERVICE`

### Fields inherited from interface org.red5.server.api.stream.IOnDemandStreamService

`BEAN_NAME`

### Fields inherited from interface org.red5.server.api.stream.ISubscriberStreamService

`BEAN_NAME`

### Fields inherited from interface org.red5.server.api.scheduling.ISchedulingService

`BEAN_NAME`

### Fields inherited from interface org.red5.server.api.stream.IStreamSecurityService

`BEAN_NAME`

### Fields inherited from interface org.red5.server.api.so.ISharedObjectSecurityService

`BEAN_NAME`

### Constructor Summary

Constructors
Constructor and Description
`ApplicationAdapter()`

### Method Summary

Methods
`boolean` `connect(IConnection conn, IScope scope, Object[] params)` Returns connection result for given scope and parameters.
`void` `disconnect(IConnection conn, IScope scope)` Returns disconnection result for given scope and parameters.
`boolean` `join(IClient client, IScope scope)` Adds client to scope.
`void` `leave(IClient client, IScope scope)` Disconnects client from scope.
`boolean` `start(IScope scope)` Starts scope.
`void` `stop(IScope scope)` Stops scope handling (that is, stops application if given scope is app level scope and stops room handling if given scope has lower scope level).

### Methods inherited from class org.red5.server.adapter.MultiThreadedApplicationAdapter

`addListener, addScheduledJob, addScheduledJobAfterDelay, addScheduledOnceJob, addScheduledOnceJob, appConnect, appDisconnect, appJoin, appLeave, appStart, appStop, cancelGhostConnectionsCleanup, clearSharedObjects, createSharedObject, FCPublish, FCSubscribe, FCUnpublish, FCUnpublish, getBroadcastStream, getBroadcastStreamNames, getClientTTL, getGhostConnsCleanupPeriod, getListeners, getOnDemandStream, getScheduledJobNames, getSharedObject, getSharedObject, getSharedObjectNames, getSharedObjectSecurity, getStreamLength, getStreamPlaybackSecurity, getStreamPublishSecurity, getSubscriberStream, hasBroadcastStream, hasOnDemandStream, hasSharedObject, killGhostConnections, measureBandwidth, measureBandwidth, pauseScheduledJob, registerSharedObjectSecurity, registerStreamPlaybackSecurity, registerStreamPublishSecurity, rejectClient, rejectClient, removeListener, removeScheduledJob, resumeScheduledJob, roomConnect, roomDisconnect, roomJoin, roomLeave, roomStart, roomStop, scheduleGhostConnectionsCleanup, setClientTTL, setGhostConnsCleanupPeriod, streamBroadcastClose, streamBroadcastStart, streamPlayItemPause, streamPlayItemPlay, streamPlayItemResume, streamPlayItemSeek, streamPlayItemStop, streamPublishStart, streamRecordStart, streamSubscriberClose, streamSubscriberStart, unregisterSharedObjectSecurity, unregisterStreamPlaybackSecurity, unregisterStreamPublishSecurity`

### Methods inherited from class org.red5.server.adapter.StatefulScopeWrappingAdapter

`createChildScope, getAttribute, getAttribute, getAttributeNames, getAttributes, getChildScope, getChildScopeNames, getClients, getConnections, getContext, getDepth, getName, getParent, getPath, getPlugins, getResource, getResources, getScope, hasAttribute, hasChildScope, hasParent, lookupConnections, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, setPlugins, setScope`

### Methods inherited from class org.red5.server.adapter.AbstractScopeAdapter

`addChildScope, checkBandwidth, checkBandwidthUp, handleEvent, removeChildScope, serviceCall, setCanCallService, setCanConnect, setCanStart, setJoin`

### 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.scope.IScopeHandler

`addChildScope, removeChildScope, serviceCall`

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

`handleEvent`

### Constructor Detail

#### ApplicationAdapter

    public ApplicationAdapter()

### Method Detail

#### connect

    public boolean connect(IConnection conn,
                  IScope scope,
                  Object[] params)

Returns connection result for given scope and parameters. Whether the scope is room or app level scope, this method distinguishes it and acts accordingly. You override `MultiThreadedApplicationAdapter.appConnect(IConnection, Object[])` or `MultiThreadedApplicationAdapter.roomConnect(IConnection, Object[])` in your application to make it act the way you want.

Specified by:
  `connect` in interface `IScopeHandler`
Overrides:
  `connect` in class `MultiThreadedApplicationAdapter`
Parameters:
  `conn` - Connection object
  `scope` - Scope
  `params` - List of params passed to connection handler
Returns:
  `true` if connect is successful, `false` otherwise

#### disconnect

    public void disconnect(IConnection conn,
                  IScope scope)

Returns disconnection result for given scope and parameters. Whether the scope is room or app level scope, this method distinguishes it and acts accordingly.

Specified by:
  `disconnect` in interface `IScopeHandler`
Overrides:
  `disconnect` in class `MultiThreadedApplicationAdapter`
Parameters:
  `conn` - Connection object
  `scope` - Scope

#### start

    public boolean start(IScope scope)

Starts scope. Scope can be both application or room level.

Specified by:
  `start` in interface `IScopeHandler`
Overrides:
  `start` in class `MultiThreadedApplicationAdapter`
Parameters:
  `scope` - Scope object
Returns:
  `true` if scope can be started, `false` otherwise. See `AbstractScopeAdapter.start(IScope)` for details.

#### stop

    public void stop(IScope scope)

Stops scope handling (that is, stops application if given scope is app level scope and stops room handling if given scope has lower scope level). This method calls `MultiThreadedApplicationAdapter.appStop(IScope)` or `MultiThreadedApplicationAdapter.roomStop(IScope)` handlers respectively.

Specified by:
  `stop` in interface `IScopeHandler`
Overrides:
  `stop` in class `MultiThreadedApplicationAdapter`
Parameters:
  `scope` - Scope to stop

#### join

    public boolean join(IClient client,
               IScope scope)

Adds client to scope. Scope can be both application or room. Can be applied to both application scope and scopes of lower level. This method calls `MultiThreadedApplicationAdapter.appJoin(IClient, IScope)` or `MultiThreadedApplicationAdapter.roomJoin(IClient, IScope)` handlers respectively.

Specified by:
  `join` in interface `IScopeHandler`
Overrides:
  `join` in class `MultiThreadedApplicationAdapter`
Parameters:
  `client` - Client object
  `scope` - Scope object
Returns:
  `true` to allow, `false` to deny connection

#### leave

    public void leave(IClient client,
             IScope scope)

Disconnects client from scope. Can be applied to both application scope and scopes of lower level. This method calls `MultiThreadedApplicationAdapter.appLeave(IClient, IScope)` or `MultiThreadedApplicationAdapter.roomLeave(IClient, IScope)` handlers respectively.

Specified by:
  `leave` in interface `IScopeHandler`
Overrides:
  `leave` in class `MultiThreadedApplicationAdapter`
Parameters:
  `client` - Client object
  `scope` - Scope object