org.red5.server.adapter
Class AbstractScopeAdapter

java.lang.Object
  extended by org.red5.server.adapter.AbstractScopeAdapter
All Implemented Interfaces:
IEventHandler, IScopeHandler
Direct Known Subclasses:
StatefulScopeWrappingAdapter

public abstract class AbstractScopeAdapter
extends Object
implements IScopeHandler

Base scope handler implementation. Meant to be subclassed.


Constructor Summary
AbstractScopeAdapter()
           
 
Method Summary
 boolean addChildScope(IBasicScope scope)
          Called just before a child scope is added.
 void checkBandwidth(Object o)
          Calls the checkBandwidth method on the current client.
 Map<String,Object> checkBandwidthUp(Object[] params)
          Calls the checkBandwidthUp method on the current client.
 boolean connect(IConnection conn, IScope scope, Object[] params)
          Called just before every connection to a scope.
 void disconnect(IConnection conn, IScope scope)
          Called just after the a connection is disconnected.
 boolean handleEvent(IEvent event)
          Handle an event
 boolean join(IClient client, IScope scope)
          Called just before a client enters the scope.
 void leave(IClient client, IScope scope)
          Called just after the client leaves the scope.
 void removeChildScope(IBasicScope scope)
          Called just after a child scope has been removed.
 boolean serviceCall(IConnection conn, IServiceCall call)
          Called when a service is called.
 void setCanCallService(boolean canCallService)
          Setter for can call service flag
 void setCanConnect(boolean canConnect)
          Setter for can connect flag
 void setCanStart(boolean canStart)
          Setter for can start flag.
 void setJoin(boolean canJoin)
          Setter for 'can join' flag
 boolean start(IScope scope)
          Called when a scope is created for the first time.
 void stop(IScope scope)
          Called just before a scope is disposed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractScopeAdapter

public AbstractScopeAdapter()
Method Detail

setCanStart

public void setCanStart(boolean canStart)
Setter for can start flag.

Parameters:
canStart - true if scope is ready to be activated, false otherwise

setCanCallService

public void setCanCallService(boolean canCallService)
Setter for can call service flag

Parameters:
canCallService - true if remote service calls are allowed for the scope, false otherwise

setCanConnect

public void setCanConnect(boolean canConnect)
Setter for can connect flag

Parameters:
canConnect - true if connections to scope are allowed, false otherwise

setJoin

public void setJoin(boolean canJoin)
Setter for 'can join' flag

Parameters:
canJoin - true if scope may be joined by users, false otherwise

start

public boolean start(IScope scope)
Called when a scope is created for the first time.

Specified by:
start in interface IScopeHandler
Parameters:
scope - the new scope object
Returns:
true to allow, false to deny

stop

public void stop(IScope scope)
Called just before a scope is disposed.

Specified by:
stop in interface IScopeHandler
Parameters:
scope - Scope that id disposed

connect

public boolean connect(IConnection conn,
                       IScope scope,
                       Object[] params)
Called just before every connection to a scope. You can pass additional params from client using NetConnection.connect method (see below).

Specified by:
connect in interface IScopeHandler
Parameters:
conn - Connection object
scope - Scope object
params - List of params passed from client via NetConnection.connect method. All parameters but the first one passed to NetConnection.connect method are available as params array.
Returns:
true to allow, false to deny

disconnect

public void disconnect(IConnection conn,
                       IScope scope)
Called just after the a connection is disconnected.

Specified by:
disconnect in interface IScopeHandler
Parameters:
conn - Connection object
scope - Scope object

join

public boolean join(IClient client,
                    IScope scope)
Called just before a client enters the scope.

Specified by:
join in interface IScopeHandler
Parameters:
client - Client object
scope - Scope that is joined by client
Returns:
true to allow, false to deny connection

leave

public void leave(IClient client,
                  IScope scope)
Called just after the client leaves the scope.

Specified by:
leave in interface IScopeHandler
Parameters:
client - Client object
scope - Scope object

serviceCall

public boolean serviceCall(IConnection conn,
                           IServiceCall call)
Called when a service is called.

Specified by:
serviceCall in interface IScopeHandler
Parameters:
conn - The connection object
call - The call object.
Returns:
true to allow, false to deny

addChildScope

public boolean addChildScope(IBasicScope scope)
Called just before a child scope is added.

Specified by:
addChildScope in interface IScopeHandler
Parameters:
scope - Scope that will be added
Returns:
true to allow, false to deny

removeChildScope

public void removeChildScope(IBasicScope scope)
Called just after a child scope has been removed.

Specified by:
removeChildScope in interface IScopeHandler
Parameters:
scope - Scope that has been removed

handleEvent

public boolean handleEvent(IEvent event)
Handle an event

Specified by:
handleEvent in interface IEventHandler
Parameters:
event - event to handle
Returns:
true if event was handled, false if it should bubble

checkBandwidth

public void checkBandwidth(Object o)
Calls the checkBandwidth method on the current client.

Parameters:
o - Object passed from Flash, not used at the moment

checkBandwidthUp

public Map<String,Object> checkBandwidthUp(Object[] params)
Calls the checkBandwidthUp method on the current client.

Parameters:
params - Object passed from Flash


Copyright © 2006-2012 The Red5 Project