## org.red5.server.adapter
Class MultiThreadedApplicationAdapter

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

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

Direct Known Subclasses:
  ApplicationAdapter

    public class MultiThreadedApplicationAdapter

extends StatefulScopeWrappingAdapter
implements ISharedObjectService, IBroadcastStreamService, IOnDemandStreamService, ISubscriberStreamService, ISchedulingService, IStreamSecurityService, ISharedObjectSecurityService, IStreamAwareScopeHandler, ApplicationMBean

ApplicationAdapter class serves as a base class for your Red5 applications. It provides methods to work with SharedObjects and streams, as well as connections and scheduling services. ApplicationAdapter is an application level IScope. To handle streaming processes in your application you should implement `IStreamAwareScopeHandler` interface and implement handling methods. Application adapter provides you with useful event handlers that can be used to intercept streams, authorize users, etc. Also, all methods added in subclasses can be called from client side with NetConnection.call method. Unlike to Flash Media server which requires you to keep methods on Client object at server side, Red5 offers much more convenient way to add methods for remote invocation to your applications.

EXAMPLE:

`public List<String> getLiveStreams() {
// Implementation goes here, say, use Red5 object to obtain scope and all it's streams
}`

This method added to ApplicationAdapter subclass can be called from client side with the following code:

`var nc:NetConnection = new NetConnection();
nc.connect(...);
nc.call("getLiveStreams", resultHandlerObj);
`

If you want to build a server-side framework this is a place to start and wrap it around ApplicationAdapter subclass.

Author:
  The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de), Paul Gregoire (mondain@gmail.com), Michael Klishin

Field Summary
`protected Logger` `log` Logger object
`protected ISchedulingService` `schedulingService` Scheduling service.

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
`MultiThreadedApplicationAdapter()`

Method Summary
`void` `addListener(IApplication listener)` Register listener that will get notified about application events.
`String` `addScheduledJob(int interval, IScheduledJob job)` Wrapper around ISchedulingService, adds a scheduled job to be run periodically.
`String` `addScheduledJobAfterDelay(int interval, IScheduledJob job, int delay)` Adds a scheduled job which starts after the specified delay period and fires periodically.
`String` `addScheduledOnceJob(Date date, IScheduledJob job)` Adds a scheduled job that's gonna be executed once on given date.
`String` `addScheduledOnceJob(long timeDelta, IScheduledJob job)` Adds a scheduled job that's gonna be executed once.
`boolean` `appConnect(IConnection conn, Object[] params)` Handler method.
`void` `appDisconnect(IConnection conn)` Handler method.
`boolean` `appJoin(IClient client, IScope app)`
`void` `appLeave(IClient client, IScope app)` Handler method.
`boolean` `appStart(IScope app)` Called once on scope (that is, application or application room) start.
`void` `appStop(IScope app)` Handler method.
`void` `cancelGhostConnectionsCleanup()` Cancel ghost connections cleanup period
`boolean` `clearSharedObjects(IScope scope, String name)` Deletes persistent shared objects specified by name and clears all properties from active shared objects (persistent and nonpersistent).
`boolean` `connect(IConnection conn, IScope scope, Object[] params)` Returns connection result for given scope and parameters.
`boolean` `createSharedObject(IScope scope, String name, boolean persistent)` Creates a new shared object for given scope.
`void` `disconnect(IConnection conn, IScope scope)` Returns disconnection result for given scope and parameters.
`void` `FCPublish(String streamName)` Notification method that is sent by FME just before publishing starts.
`void` `FCUnpublish()` Notification method that is sent by FME when publishing of a stream ends.
`void` `FCUnpublish(String streamName)` Notification method that is sent by FME when publishing of a stream ends.
`IBroadcastStream` `getBroadcastStream(IScope scope, String name)` Get a broadcast stream by name
`List<String>` `getBroadcastStreamNames(IScope scope)` Returns list of stream names broadcasted in
`long` `getClientTTL()` Client time to live is max allowed connection ping return time in seconds
`int` `getGhostConnsCleanupPeriod()` Return period of ghost connections cleanup task call
`Set<IApplication>` `getListeners()` Return handlers that get notified about application events.
`IOnDemandStream` `getOnDemandStream(IScope scope, String name)` Returns VOD stream with given name from specified scope.
`List<String>` `getScheduledJobNames()` Returns list of scheduled job names
`ISharedObject` `getSharedObject(IScope scope, String name)` Returns shared object from given scope by name.
`ISharedObject` `getSharedObject(IScope scope, String name, boolean persistent)` Returns shared object from given scope by name.
`Set<String>` `getSharedObjectNames(IScope scope)` Returns available SharedObject names as List
`Set<ISharedObjectSecurity>` `getSharedObjectSecurity()` Get handlers that protect shared objects.
`double` `getStreamLength(String name)` Returns stream length.
`Set<IStreamPlaybackSecurity>` `getStreamPlaybackSecurity()` Get handlers that protect stream plaback.
`Set<IStreamPublishSecurity>` `getStreamPublishSecurity()` Get handlers that protect stream publishing.
`ISubscriberStream` `getSubscriberStream(IScope scope, String name)` Returns subscriber stream with given name from specified scope.
`boolean` `hasBroadcastStream(IScope scope, String name)` Does the scope have a broadcast stream registered with a given name
`boolean` `hasOnDemandStream(IScope scope, String name)` Check whether scope has VOD stream with given name or not
`boolean` `hasSharedObject(IScope scope, String name)` Checks whether there's a SO with given scope and name
`boolean` `join(IClient client, IScope scope)` Adds client to scope.
`protected void` `killGhostConnections()` Cleans up ghost connections
`void` `leave(IClient client, IScope scope)` Disconnects client from scope.
`void` `measureBandwidth()` Try to measure bandwidth of current connection.
`void` `measureBandwidth(IConnection conn)` Try to measure bandwidth of given connection.
`void` `pauseScheduledJob(String name)` Pauses a scheduled job
`void` `registerSharedObjectSecurity(ISharedObjectSecurity handler)` Add handler that protects shared objects.
`void` `registerStreamPlaybackSecurity(IStreamPlaybackSecurity handler)` Add handler that protects stream playback.
`void` `registerStreamPublishSecurity(IStreamPublishSecurity handler)` Add handler that protects stream publishing.
`protected boolean` `rejectClient()` Reject the currently connecting client without a special error message.
`protected boolean` `rejectClient(Object reason)` Reject the currently connecting client with an error message.
`void` `removeListener(IApplication listener)` Unregister handler that will not get notified about application events any longer.
`void` `removeScheduledJob(String name)` Removes scheduled job from scheduling service list
`void` `resumeScheduledJob(String name)` Resumes a scheduled job
`boolean` `roomConnect(IConnection conn, Object[] params)` Handler method.
`void` `roomDisconnect(IConnection conn)` Handler method.
`boolean` `roomJoin(IClient client, IScope room)`
`void` `roomLeave(IClient client, IScope room)` Handler method.
`boolean` `roomStart(IScope room)` Handler method.
`void` `roomStop(IScope room)` Handler method.
`void` `scheduleGhostConnectionsCleanup()` Schedules new ghost connections cleanup using current cleanup period
`void` `setClientTTL(int clientTTL)` Client time to live is max allowed connection ping return time in seconds
`void` `setGhostConnsCleanupPeriod(int ghostConnsCleanupPeriod)` Set new ghost connections cleanup period
`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).
`void` `streamBroadcastClose(IBroadcastStream stream)` Notification that a broadcasting stream is closing.
`void` `streamBroadcastStart(IBroadcastStream stream)` Notified when a broadcaster starts.
`void` `streamPlaylistItemPlay(IPlaylistSubscriberStream stream, IPlayItem item, boolean isLive)` Notified when a playlist item plays.
`void` `streamPlaylistItemStop(IPlaylistSubscriberStream stream, IPlayItem item)` Notified when a playlist item stops.
`void` `streamPlaylistVODItemPause(IPlaylistSubscriberStream stream, IPlayItem item, int position)` Notified when a playlist vod item pauses.
`void` `streamPlaylistVODItemResume(IPlaylistSubscriberStream stream, IPlayItem item, int position)` Notified when a playlist vod item resumes.
`void` `streamPlaylistVODItemSeek(IPlaylistSubscriberStream stream, IPlayItem item, int position)` Notified when a playlist vod item seeks.
`void` `streamPublishStart(IBroadcastStream stream)` A broadcast stream starts being published.
`void` `streamRecordStart(IBroadcastStream stream)` A broadcast stream starts being recorded.
`void` `streamSubscriberClose(ISubscriberStream stream)` Notified when a subscriber closes.
`void` `streamSubscriberStart(ISubscriberStream stream)` Notified when a subscriber starts.
`void` `unregisterSharedObjectSecurity(ISharedObjectSecurity handler)` Remove handler that protects shared objects.
`void` `unregisterStreamPlaybackSecurity(IStreamPlaybackSecurity handler)` Remove handler that protects stream playback.
`void` `unregisterStreamPublishSecurity(IStreamPublishSecurity handler)` Remove handler that protects stream publishing.

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, 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.IScopeHandler
`addChildScope, removeChildScope, serviceCall`

Methods inherited from interface org.red5.server.api.event.IEventHandler
`handleEvent`

Field Detail

### log

    protected Logger log

  Logger object

### schedulingService

    protected ISchedulingService schedulingService

  Scheduling service. Uses Quartz. Adds and removes scheduled jobs.

Constructor Detail

### MultiThreadedApplicationAdapter

    public MultiThreadedApplicationAdapter()

Method Detail

### addListener

    public void addListener(IApplication listener)

  Register listener that will get notified about application events. Please note that return values (e.g. from `IApplication.appStart(IScope)`) will be ignored for listeners.

  Parameters:
    `listener` - object to register

### removeListener

    public void removeListener(IApplication listener)

  Unregister handler that will not get notified about application events any longer.

  Parameters:
    `listener` - object to unregister

### getListeners

    public Set<IApplication> getListeners()

  Return handlers that get notified about application events.

  Returns:
    list of handlers

### registerStreamPublishSecurity

    public void registerStreamPublishSecurity(IStreamPublishSecurity handler)

  Add handler that protects stream publishing.

  Specified by:
    `registerStreamPublishSecurity` in interface `IStreamSecurityService`
  Parameters:
    `handler` - Handler to add.

### unregisterStreamPublishSecurity

    public void unregisterStreamPublishSecurity(IStreamPublishSecurity handler)

  Remove handler that protects stream publishing.

  Specified by:
    `unregisterStreamPublishSecurity` in interface `IStreamSecurityService`
  Parameters:
    `handler` - Handler to remove.

### getStreamPublishSecurity

    public Set<IStreamPublishSecurity> getStreamPublishSecurity()

  Get handlers that protect stream publishing.

  Specified by:
    `getStreamPublishSecurity` in interface `IStreamSecurityService`
  Returns:
    list of handlers

### registerStreamPlaybackSecurity

    public void registerStreamPlaybackSecurity(IStreamPlaybackSecurity handler)

  Add handler that protects stream playback.

  Specified by:
    `registerStreamPlaybackSecurity` in interface `IStreamSecurityService`
  Parameters:
    `handler` - Handler to add.

### unregisterStreamPlaybackSecurity

    public void unregisterStreamPlaybackSecurity(IStreamPlaybackSecurity handler)

  Remove handler that protects stream playback.

  Specified by:
    `unregisterStreamPlaybackSecurity` in interface `IStreamSecurityService`
  Parameters:
    `handler` - Handler to remove.

### getStreamPlaybackSecurity

    public Set<IStreamPlaybackSecurity> getStreamPlaybackSecurity()

  Get handlers that protect stream plaback.

  Specified by:
    `getStreamPlaybackSecurity` in interface `IStreamSecurityService`
  Returns:
    list of handlers

### registerSharedObjectSecurity

    public void registerSharedObjectSecurity(ISharedObjectSecurity handler)

  Add handler that protects shared objects.

  Specified by:
    `registerSharedObjectSecurity` in interface `ISharedObjectSecurityService`
  Parameters:
    `handler` - Handler to add.

### unregisterSharedObjectSecurity

    public void unregisterSharedObjectSecurity(ISharedObjectSecurity handler)

  Remove handler that protects shared objects.

  Specified by:
    `unregisterSharedObjectSecurity` in interface `ISharedObjectSecurityService`
  Parameters:
    `handler` - Handler to remove.

### getSharedObjectSecurity

    public Set<ISharedObjectSecurity> getSharedObjectSecurity()

  Get handlers that protect shared objects.

  Specified by:
    `getSharedObjectSecurity` in interface `ISharedObjectSecurityService`
  Returns:
    list of handlers

### rejectClient

    protected boolean rejectClient()
                            throws ClientRejectedException

  Reject the currently connecting client without a special error message. This method throws `ClientRejectedException` exception.

  Returns:
    never returns
  Throws:
    `ClientRejectedException` - Thrown when client connection must be rejected by application logic

### rejectClient

    protected boolean rejectClient(Object reason)
                            throws ClientRejectedException

  Reject the currently connecting client with an error message. The passed object will be available as "application" property of the information object that is returned to the caller.

  Parameters:
    `reason` - Additional error message to return to client-side Flex/Flash application
  Returns:
    never returns
  Throws:
    `ClientRejectedException` - Thrown when client connection must be rejected by application logic

### 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 `appConnect(IConnection, Object[])` or `roomConnect(IConnection, Object[])` in your application to make it act the way you want.

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

### 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 `AbstractScopeAdapter`
  Parameters:
    `scope` - Scope object
  Returns:
    `true` if scope can be started, `false` otherwise. See `AbstractScopeAdapter.start(IScope)` for details.

### 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 `AbstractScopeAdapter`
  Parameters:
    `conn` - Connection object
    `scope` - Scope

### 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 `appStop(IScope)` or `roomStop(IScope)` handlers respectively.

  Specified by:
    `stop` in interface `IScopeHandler`
  Overrides:
    `stop` in class `AbstractScopeAdapter`
  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 `appJoin(IClient, IScope)` or `roomJoin(IClient, IScope)` handlers respectively.

  Specified by:
    `join` in interface `IScopeHandler`
  Overrides:
    `join` in class `AbstractScopeAdapter`
  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 `appLeave(IClient, IScope)` or `roomLeave(IClient, IScope)` handlers respectively.

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

### appStart

    public boolean appStart(IScope app)

  Called once on scope (that is, application or application room) start. You override `appStart(IScope)` or `roomStart(IScope)` in your application to make it act the way you want.

  Specified by:
    `appStart` in interface `ApplicationMBean`
  Parameters:
    `app` - Application scope object
  Returns:
    `true` if scope can be started, `false` otherwise

### appStop

    public void appStop(IScope app)

  Handler method. Called when application is stopped.

  Specified by:
    `appStop` in interface `ApplicationMBean`
  Parameters:
    `app` - Scope object

### roomStart

    public boolean roomStart(IScope room)

  Handler method. Called when room scope is started.

  Specified by:
    `roomStart` in interface `ApplicationMBean`
  Parameters:
    `room` - Room scope
  Returns:
    Boolean value

### roomStop

    public void roomStop(IScope room)

  Handler method. Called when room scope is stopped.

  Specified by:
    `roomStop` in interface `ApplicationMBean`
  Parameters:
    `room` - Room scope.

### appConnect

    public boolean appConnect(IConnection conn,
                              Object[] params)

  Handler method. Called every time new client connects (that is, new IConnection object is created after call from a SWF movie) to the application. You override this method to pass additional data from client to server application using `NetConnection.connect` method.

  EXAMPLE:
  In this simple example we pass user's skin of choice identifier from client to the server.

  Client-side:
  `NetConnection.connect("rtmp://localhost/killerred5app", "silver");`

  Server-side:
  `if (params.length > 0) log.debug("Theme selected: {}", params[0]);`

  Specified by:
    `appConnect` in interface `ApplicationMBean`
  Parameters:
    `conn` - Connection object
    `params` - List of parameters after connection URL passed to `NetConnection.connect` method.
  Returns:
    Boolean value

### roomConnect

    public boolean roomConnect(IConnection conn,
                               Object[] params)

  Handler method. Called every time new client connects (that is, new IConnection object is created after call from a SWF movie) to the application. You override this method to pass additional data from client to server application using `NetConnection.connect` method. See `appConnect(IConnection, Object[])` for code example.

  Specified by:
    `roomConnect` in interface `ApplicationMBean`
  Parameters:
    `conn` - Connection object
    `params` - List of params passed to room scope
  Returns:
    Boolean value

### appDisconnect

    public void appDisconnect(IConnection conn)

  Handler method. Called every time client disconnects from the application.

  Specified by:
    `appDisconnect` in interface `ApplicationMBean`
  Parameters:
    `conn` - Disconnected connection object

### roomDisconnect

    public void roomDisconnect(IConnection conn)

  Handler method. Called every time client disconnects from the room.

  Specified by:
    `roomDisconnect` in interface `ApplicationMBean`
  Parameters:
    `conn` - Disconnected connection object

### appJoin

    public boolean appJoin(IClient client,
                           IScope app)

  Specified by:
    `appJoin` in interface `ApplicationMBean`

### appLeave

    public void appLeave(IClient client,
                         IScope app)

  Handler method. Called every time client leaves application scope.

  Specified by:
    `appLeave` in interface `ApplicationMBean`
  Parameters:
    `client` - Client object that left
    `app` - Application scope

### roomJoin

    public boolean roomJoin(IClient client,
                            IScope room)

  Specified by:
    `roomJoin` in interface `ApplicationMBean`

### roomLeave

    public void roomLeave(IClient client,
                          IScope room)

  Handler method. Called every time client leaves room scope.

  Specified by:
    `roomLeave` in interface `ApplicationMBean`
  Parameters:
    `client` - Disconnected client object
    `room` - Room scope

### measureBandwidth

    public void measureBandwidth()

  Try to measure bandwidth of current connection. This is required for some FLV player to work because they require the "onBWDone" method to be called on the connection.

### measureBandwidth

    public void measureBandwidth(IConnection conn)

  Try to measure bandwidth of given connection. This is required for some FLV player to work because they require the "onBWDone" method to be called on the connection.

  Parameters:
    `conn` - the connection to measure the bandwidth for

### createSharedObject

    public boolean createSharedObject(IScope scope,
                                      String name,
                                      boolean persistent)

  Creates a new shared object for given scope. Server-side shared objects (also known as Remote SO) are special kind of objects those variable are synchronized between clients. To get an instance of RSO at client-side, use `SharedObject.getRemote()`. SharedObjects can be persistent and transient. Persistent RSO are stateful, i.e. store their data between sessions. If you need to store some data on server while clients go back and forth use persistent SO (just use `true` ), otherwise prefer usage of transient for extra performance.

  Specified by:
    `createSharedObject` in interface `ISharedObjectService`
  Parameters:
    `scope` - Scope that shared object belongs to
    `name` - Name of SharedObject
    `persistent` - Whether SharedObject instance should be persistent or not
  Returns:
    `true` if SO was created, `false` otherwise

### getSharedObject

    public ISharedObject getSharedObject(IScope scope,
                                         String name)

  Returns shared object from given scope by name.

  Specified by:
    `getSharedObject` in interface `ISharedObjectService`
  Parameters:
    `scope` - Scope that shared object belongs to
    `name` - Name of SharedObject
  Returns:
    Shared object instance with name given

### getSharedObject

    public ISharedObject getSharedObject(IScope scope,
                                         String name,
                                         boolean persistent)

  Returns shared object from given scope by name.

  Specified by:
    `getSharedObject` in interface `ISharedObjectService`
  Parameters:
    `scope` - Scope that shared object belongs to
    `name` - Name of SharedObject
    `persistent` - Whether SharedObject instance should be persistent or not
  Returns:
    Shared object instance with name given

### getSharedObjectNames

    public Set<String> getSharedObjectNames(IScope scope)

  Returns available SharedObject names as List

  Specified by:
    `getSharedObjectNames` in interface `ISharedObjectService`
  Parameters:
    `scope` - Scope that SO belong to
  Returns:
    set containing the shared object names

### hasSharedObject

    public boolean hasSharedObject(IScope scope,
                                   String name)

  Checks whether there's a SO with given scope and name

  Specified by:
    `hasSharedObject` in interface `ISharedObjectService`
  Parameters:
    `scope` - Scope that SO belong to
    `name` - Name of SharedObject
  Returns:
    `true` if the shared object exists, otherwise `false`

### hasBroadcastStream

    public boolean hasBroadcastStream(IScope scope,
                                      String name)

  Does the scope have a broadcast stream registered with a given name

  Specified by:
    `hasBroadcastStream` in interface `IBroadcastStreamService`
  Parameters:
    `scope` - the scope to check for the stream
    `name` - name of the broadcast
  Returns:
    true is a stream exists, otherwise false

### getBroadcastStream

    public IBroadcastStream getBroadcastStream(IScope scope,
                                               String name)

  Get a broadcast stream by name

  Specified by:
    `getBroadcastStream` in interface `IBroadcastStreamService`
  Parameters:
    `scope` - the scope to return the stream from
    `name` - the name of the broadcast
  Returns:
    broadcast stream object

### getBroadcastStreamNames

    public List<String> getBroadcastStreamNames(IScope scope)

  Returns list of stream names broadcasted in

       scope

  . Broadcast stream name is somewhat different from server stream name. Server stream name is just an ID assigned by Red5 to every created stream. Broadcast stream name is the name that is being used to subscribe to the stream at client side, that is, in `NetStream.play` call.

  Specified by:
    `getBroadcastStreamNames` in interface `IBroadcastStreamService`
  Parameters:
    `scope` - Scope to retrieve broadcasted stream names
  Returns:
    List of broadcasted stream names.

### hasOnDemandStream

    public boolean hasOnDemandStream(IScope scope,
                                     String name)

  Check whether scope has VOD stream with given name or not

  Specified by:
    `hasOnDemandStream` in interface `IOnDemandStreamService`
  Parameters:
    `scope` - Scope
    `name` - VOD stream name
  Returns:
    `true` if scope has VOD stream with given name, `false` otherwise.

### getOnDemandStream

    public IOnDemandStream getOnDemandStream(IScope scope,
                                             String name)

  Returns VOD stream with given name from specified scope.

  Specified by:
    `getOnDemandStream` in interface `IOnDemandStreamService`
  Parameters:
    `scope` - Scope object
    `name` - VOD stream name
  Returns:
    IOnDemandStream object that represents stream that can be played on demand, seekable and so forth. See `IOnDemandStream` for details.

### getSubscriberStream

    public ISubscriberStream getSubscriberStream(IScope scope,
                                                 String name)

  Returns subscriber stream with given name from specified scope. Subscriber stream is a stream that clients can subscribe to.

  Specified by:
    `getSubscriberStream` in interface `ISubscriberStreamService`
  Parameters:
    `scope` - Scope
    `name` - Stream name
  Returns:
    ISubscriberStream object

### addScheduledJob

    public String addScheduledJob(int interval,
                                  IScheduledJob job)

  Wrapper around ISchedulingService, adds a scheduled job to be run periodically. We store this service in the scope as it can be shared across all rooms of the applications.

  Specified by:
    `addScheduledJob` in interface `ISchedulingService`
  Parameters:
    `interval` - Time interval to run the scheduled job
    `job` - Scheduled job object
  Returns:
    Name of the scheduled job

### addScheduledOnceJob

    public String addScheduledOnceJob(long timeDelta,
                                      IScheduledJob job)

  Adds a scheduled job that's gonna be executed once. Please note that the jobs are not saved if Red5 is restarted in the meantime.

  Specified by:
    `addScheduledOnceJob` in interface `ISchedulingService`
  Parameters:
    `timeDelta` - Time offset in milliseconds from the current date when given job should be run
    `job` - Scheduled job object
  Returns:
    Name of the scheduled job

### addScheduledOnceJob

    public String addScheduledOnceJob(Date date,
                                      IScheduledJob job)

  Adds a scheduled job that's gonna be executed once on given date. Please note that the jobs are not saved if Red5 is restarted in the meantime.

  Specified by:
    `addScheduledOnceJob` in interface `ISchedulingService`
  Parameters:
    `date` - When to run scheduled job
    `job` - Scheduled job object
  Returns:
    Name of the scheduled job

### addScheduledJobAfterDelay

    public String addScheduledJobAfterDelay(int interval,
                                            IScheduledJob job,
                                            int delay)

  Adds a scheduled job which starts after the specified delay period and fires periodically.

  Specified by:
    `addScheduledJobAfterDelay` in interface `ISchedulingService`
  Parameters:
    `interval` - time in milliseconds between two notifications of the job
    `job` - the job to trigger periodically
    `delay` - time in milliseconds to pass before first execution.
  Returns:
    the name of the scheduled job

### pauseScheduledJob

    public void pauseScheduledJob(String name)

  Pauses a scheduled job

  Specified by:
    `pauseScheduledJob` in interface `ISchedulingService`
  Parameters:
    `name` - Scheduled job name

### resumeScheduledJob

    public void resumeScheduledJob(String name)

  Resumes a scheduled job

  Specified by:
    `resumeScheduledJob` in interface `ISchedulingService`
  Parameters:
    `name` - Scheduled job name

### removeScheduledJob

    public void removeScheduledJob(String name)

  Removes scheduled job from scheduling service list

  Specified by:
    `removeScheduledJob` in interface `ISchedulingService`
  Parameters:
    `name` - Scheduled job name

### getScheduledJobNames

    public List<String> getScheduledJobNames()

  Returns list of scheduled job names

  Specified by:
    `getScheduledJobNames` in interface `ISchedulingService`
  Returns:
    List of scheduled job names as list of Strings.

### getStreamLength

    public double getStreamLength(String name)

  Returns stream length. This is a hook so it may be removed.

  Parameters:
    `name` - Stream name
  Returns:
    Stream length in seconds (?)

### clearSharedObjects

    public boolean clearSharedObjects(IScope scope,
                                      String name)

  Deletes persistent shared objects specified by name and clears all properties from active shared objects (persistent and nonpersistent). The name parameter specifies the name of a shared object, which can include a slash (/) as a delimiter between directories in the path. The last element in the path can contain wildcard patterns (for example, a question mark [?] and an asterisk [*]) or a shared object name. The clearSharedObjects() method traverses the shared object hierarchy along the specified path and clears all the shared objects. Specifying a slash (/) clears all the shared objects associated with an application instance.

  The following values are possible for the soPath parameter:
  / clears all local and persistent shared objects associated with the instance.
  /foo/bar clears the shared object /foo/bar; if bar is a directory name, no shared objects are deleted.
  /foo/bar/* clears all shared objects stored under the instance directory /foo/bar. The bar directory is also deleted if no persistent shared objects are in use within this namespace.
  /foo/bar/XX?? clears all shared objects that begin with XX, followed by any two characters. If a directory name matches this specification, all the shared objects within this directory are cleared.

  If you call the clearSharedObjects() method and the specified path matches a shared object that is currently active, all its properties are deleted, and a "clear" event is sent to all subscribers of the shared object. If it is a persistent shared object, the persistent store is also cleared.

  Specified by:
    `clearSharedObjects` in interface `ISharedObjectService`
  Parameters:
    `scope` - the scope to check for the shared object
    `name` - the name of the shared object
  Returns:
    true if the shared object at the specified path was deleted; otherwise, false. If using wildcard characters to delete multiple files, the method returns true only if all the shared objects matching the wildcard pattern were successfully deleted; otherwise, it will return false.

### getClientTTL

    public long getClientTTL()

  Client time to live is max allowed connection ping return time in seconds

  Returns:
    TTL value used in seconds

### setClientTTL

    public void setClientTTL(int clientTTL)

  Client time to live is max allowed connection ping return time in seconds

  Parameters:
    `clientTTL` - New TTL value in seconds

### getGhostConnsCleanupPeriod

    public int getGhostConnsCleanupPeriod()

  Return period of ghost connections cleanup task call

  Returns:
    Ghost connections cleanup period

### setGhostConnsCleanupPeriod

    public void setGhostConnsCleanupPeriod(int ghostConnsCleanupPeriod)

  Set new ghost connections cleanup period

  Parameters:
    `ghostConnsCleanupPeriod` - New ghost connections cleanup period

### scheduleGhostConnectionsCleanup

    public void scheduleGhostConnectionsCleanup()

  Schedules new ghost connections cleanup using current cleanup period

### cancelGhostConnectionsCleanup

    public void cancelGhostConnectionsCleanup()

  Cancel ghost connections cleanup period

### killGhostConnections

    protected void killGhostConnections()

  Cleans up ghost connections

### FCPublish

    public void FCPublish(String streamName)

  Notification method that is sent by FME just before publishing starts.

  Parameters:
    `streamName` - Name of stream that is about to be published.

### FCUnpublish

    public void FCUnpublish()

  Notification method that is sent by FME when publishing of a stream ends.

### FCUnpublish

    public void FCUnpublish(String streamName)

  Notification method that is sent by FME when publishing of a stream ends.

### streamBroadcastClose

    public void streamBroadcastClose(IBroadcastStream stream)

  Notification that a broadcasting stream is closing.

  Specified by:
    `streamBroadcastClose` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` -

### streamBroadcastStart

    public void streamBroadcastStart(IBroadcastStream stream)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a broadcaster starts.

  Specified by:
    `streamBroadcastStart` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream

### streamPlaylistItemPlay

    public void streamPlaylistItemPlay(IPlaylistSubscriberStream stream,
                                       IPlayItem item,
                                       boolean isLive)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a playlist item plays.

  Specified by:
    `streamPlaylistItemPlay` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream
    `item` - item
    `isLive` - treu if live TODO

### streamPlaylistItemStop

    public void streamPlaylistItemStop(IPlaylistSubscriberStream stream,
                                       IPlayItem item)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a playlist item stops.

  Specified by:
    `streamPlaylistItemStop` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream
    `item` - item

### streamPlaylistVODItemPause

    public void streamPlaylistVODItemPause(IPlaylistSubscriberStream stream,
                                           IPlayItem item,
                                           int position)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a playlist vod item pauses.

  Specified by:
    `streamPlaylistVODItemPause` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream
    `item` - item
    `position` - position

### streamPlaylistVODItemResume

    public void streamPlaylistVODItemResume(IPlaylistSubscriberStream stream,
                                            IPlayItem item,
                                            int position)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a playlist vod item resumes.

  Specified by:
    `streamPlaylistVODItemResume` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream
    `item` - item
    `position` - position

### streamPlaylistVODItemSeek

    public void streamPlaylistVODItemSeek(IPlaylistSubscriberStream stream,
                                          IPlayItem item,
                                          int position)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a playlist vod item seeks.

  Specified by:
    `streamPlaylistVODItemSeek` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream
    `item` - item
    `position` - position

### streamPublishStart

    public void streamPublishStart(IBroadcastStream stream)

  Description copied from interface: `IStreamAwareScopeHandler`
  A broadcast stream starts being published. This will be called when the first video packet has been received.

  Specified by:
    `streamPublishStart` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream

### streamRecordStart

    public void streamRecordStart(IBroadcastStream stream)

  Description copied from interface: `IStreamAwareScopeHandler`
  A broadcast stream starts being recorded. This will be called when the first video packet has been received.

  Specified by:
    `streamRecordStart` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream

### streamSubscriberClose

    public void streamSubscriberClose(ISubscriberStream stream)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a subscriber closes.

  Specified by:
    `streamSubscriberClose` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream

### streamSubscriberStart

    public void streamSubscriberStart(ISubscriberStream stream)

  Description copied from interface: `IStreamAwareScopeHandler`
  Notified when a subscriber starts.

  Specified by:
    `streamSubscriberStart` in interface `IStreamAwareScopeHandler`
  Parameters:
    `stream` - stream

Copyright © 2006-2010 The Red5 Project