org.red5.server.scope

## Class Scope

- java.lang.Object
- - org.red5.server.scope.BasicScope
  - - org.red5.server.scope.Scope

All Implemented Interfaces:
  IEventDispatcher, IEventHandler, IEventListener, IEventObservable, ICoreObject, IBasicScope, IScope, IServiceHandlerProvider, IScopeStatistics, IStatisticsBase, ScopeMXBean, org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver

Direct Known Subclasses:
  GlobalScope, RoomScope, WebScope

    @ManagedResource(objectName="org.red5.server:type=Scope",
                     description="Scope")
    public class Scope
    extends BasicScope
    implements IScope, IScopeStatistics, ScopeMXBean

The scope object.

A stateful object shared between a group of clients connected to the same context path. Scopes are arranged in a hierarchical way, so its possible for a scope to have a parent. If a client is connect to a scope then they are also connected to its parent scope. The scope object is used to access resources, shared object, streams, etc.

Scope layout:

      /Global scope - Contains application scopes
          /Application scope - Contains room, shared object, and stream scopes
              /Room scope - Contains other room, shared object, and / or stream scopes
                  /Shared object scope - Contains shared object
                  /Broadcast stream scope - Contains a broadcast stream

Author:
  The Red5 Project (red5@osflash.org), Paul Gregoire (mondain@gmail.com), Nathan Smith (nathgs@gmail.com)

### Nested Class Summary

Nested Classes
`static class` `Scope.Builder` Builder pattern

### Field Summary

Fields
`protected AttributeStore` `attributes` Storage for scope attributes
`protected StatisticsCounter` `clientStats` Statistics about clients connected to the scope.
`protected StatisticsCounter` `connectionStats` Statistics about connections to the scope.
`protected Semaphore` `lock` Lock for critical sections, to prevent concurrent modification.
`protected static org.slf4j.Logger` `log`
`protected ObjectName` `oName` Mbean object name.
`protected StatisticsCounter` `subscopeStats` Statistics about sub-scopes.

### Fields inherited from class org.red5.server.scope.BasicScope

`keepDelay, keepOnDisconnect, listeners, name, parent, persistenceClass, persistent, store, type`

### Fields inherited from interface org.red5.server.api.scope.IScope

`SEPARATOR`

### Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver

`CLASSPATH_ALL_URL_PREFIX`

### Fields inherited from interface org.springframework.core.io.ResourceLoader

`CLASSPATH_URL_PREFIX`

### Constructor Summary

Constructors
Constructor and Description
`Scope()` Creates a scope
`Scope(Scope.Builder builder)` Creates scope using a Builder

### Method Summary

Methods
`boolean` `addChildScope(IBasicScope scope)` Add child scope to this scope
`boolean` `connect(IConnection conn)` Connect to scope
`boolean` `connect(IConnection conn, Object[] params)` Connect to scope with parameters.
`boolean` `createChildScope(String name)` Create child scope with given name
`void` `destroy()` Destroys scope
`void` `disconnect(IConnection conn)` Disconnect connection from scope
`void` `dispatchEvent(IEvent event)` Dispatches event (notifies all listeners)
`void` `dump()`
`static Scope` `from(CompositeData cd)` Allows for reconstruction via CompositeData.
`int` `getActiveClients()` Return current number of clients connected to the scope.
`int` `getActiveConnections()` Return current number of connections to the scope.
`int` `getActiveSubscopes()` Return number of currently existing subscopes.
`Object` `getAttribute(String name)` Get attribute by name
`Set<String>` `getAttributeNames()` Return attribute names
`Map<String,Object>` `getAttributes()` Return scope attributes
`IBasicScope` `getBasicScope(ScopeType type, String name)` Return base scope of given type with given name
`Set<String>` `getBasicScopeNames(ScopeType type)` Return basic scope names matching given type
`IBroadcastScope` `getBroadcastScope(String name)` Return the broadcast scope for a given name
`ClassLoader` `getClassLoader()` Return current thread context classloader
`Set<IClient>` `getClients()` Return set of clients
`Collection<Set<IConnection>>` `getConnections()` Return connection iterator
`IContext` `getContext()` Return scope context.
`String` `getContextPath()` Return scope context path
`long` `getCreationTime()` Return the timestamp the object was created.
`int` `getDepth()` return scope depth
`boolean` `getEnabled()` Here for JMX only, uses isEnabled()
`IScopeHandler` `getHandler()` Return scope handler or parent's scope handler if this scope doesn't have one
`int` `getMaxClients()` Return maximum number of clients concurrently connected to the scope.
`int` `getMaxConnections()` Return maximum number of concurrent connections to the scope.
`int` `getMaxSubscopes()` Return maximum number of concurrently existing subscopes.
`IScope` `getParent()` Return parent scope
`String` `getPath()` Return scope path calculated from parent path and parent scope name
`org.springframework.core.io.Resource` `getResource(String path)` Return resource located at given path
`org.springframework.core.io.Resource[]` `getResources(String path)` Return array of resources from path string, usually used with pattern path
`boolean` `getRunning()` Here for JMX only, uses isEnabled()
`IScope` `getScope(String name)` Return child scope by name
`Set<String>` `getScopeNames()` Return child scope names iterator
`IServer` `getServer()` Return the server instance connected to this scope.
`Object` `getServiceHandler(String name)` Return service handler by name
`Set<String>` `getServiceHandlerNames()` Return set of service handler names.
`protected Map<String,Object>` `getServiceHandlers()` Return map of service handlers.
`protected Map<String,Object>` `getServiceHandlers(boolean allowCreate)` Return map of service handlers and optionally created it if it doesn't exist.
`IScopeStatistics` `getStatistics()` Return statistics informations about the scope.
`int` `getTotalClients()` Return total number of clients connected to the scope.
`int` `getTotalConnections()` Return total number of connections to the scope.
`int` `getTotalSubscopes()` Return total number of subscopes created.
`boolean` `handleEvent(IEvent event)` Handles event.
`boolean` `hasAttribute(String name)` Whether or not an attribute exists, keyed by the given name
`boolean` `hasChildScope(ScopeType type, String name)` Check whether scope has child scope with given name and type
`boolean` `hasChildScope(String name)` Check whether scope has child scope with given name
`boolean` `hasContext()` Check if scope has a context
`boolean` `hasHandler()` Check if scope or it's parent has handler
`boolean` `hasParent()` Check if scope has parent scope
`void` `init()` Initialization actions, start if autostart is set to `true`
`boolean` `isEnabled()` Check if scope is enabled
`boolean` `isRunning()` Check if scope is in running state
`Set<IConnection>` `lookupConnections(IClient client)` Looks up connections for client
`protected void` `registerJMX()`
`void` `registerServiceHandler(String name, Object handler)` Register service handler by name
`boolean` `removeAttribute(String name)` Remove attribute by name
`void` `removeChildren()` Removes all the child scopes
`void` `removeChildScope(IBasicScope scope)` Removes child scope
`boolean` `setAttribute(String name, Object value)` Set attribute by name
`void` `setAutoStart(boolean autoStart)` Setter for autostart flag
`void` `setChildLoadPath(String pattern)` Setter for child load path.
`void` `setContext(IContext context)` Setter for context
`void` `setDepth(int depth)` Set scope depth
`void` `setEnabled(boolean enabled)` Enable or disable scope by setting enable flag
`void` `setHandler(IScopeHandler handler)` Setter for scope event handler
`void` `setName(String name)` Setter for scope name
`void` `setParent(IScope parent)` Setter for parent scope
`void` `setPersistenceClass(String persistenceClass)` Set scope persistence class
`boolean` `start()` Starts scope
`void` `stop()` Stops scope
`String` `toString()`
`void` `uninit()` Uninitialize scope and unregister from parent.
`protected void` `unregisterJMX()`
`void` `unregisterServiceHandler(String name)` Unregisters service handler by name

### Methods inherited from class org.red5.server.scope.BasicScope

`addEventListener, equals, getEventListeners, getName, getStore, getType, hasEventListeners, hashCode, isValid, notifyEvent, removeEventListener, setKeepDelay`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.red5.server.api.scope.IBasicScope

`getName, getStore, getType, isValid, setKeepDelay`

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

`notifyEvent`

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

`addEventListener, getEventListeners, removeEventListener`

### Methods inherited from interface org.red5.server.api.statistics.IScopeStatistics

`getName`

### Field Detail

#### log

    protected static org.slf4j.Logger log

#### attributes

    protected final AttributeStore attributes

Storage for scope attributes

#### clientStats

    protected final StatisticsCounter clientStats

Statistics about clients connected to the scope.

#### connectionStats

    protected final StatisticsCounter connectionStats

Statistics about connections to the scope.

#### subscopeStats

    protected final StatisticsCounter subscopeStats

Statistics about sub-scopes.

#### lock

    protected Semaphore lock

Lock for critical sections, to prevent concurrent modification. A "fairness" policy is used wherein the longest waiting thread will be granted access before others.

#### oName

    protected ObjectName oName

Mbean object name.

### Constructor Detail

#### Scope

    @ConstructorProperties(value="")
    public Scope()

Creates a scope

#### Scope

    @ConstructorProperties(value="builder")
    public Scope(Scope.Builder builder)

Creates scope using a Builder

Parameters:
  `builder` -

### Method Detail

#### addChildScope

    public boolean addChildScope(IBasicScope scope)

Add child scope to this scope

Specified by:
  `addChildScope` in interface `IScope`
Parameters:
  `scope` - Child scope
Returns:
  `true` on success (if scope has handler and it accepts child scope addition), `false` otherwise

#### connect

    public boolean connect(IConnection conn)

Connect to scope

Specified by:
  `connect` in interface `IScope`
Parameters:
  `conn` - Connection object
Returns:
  `true` on success, `false` otherwise

#### connect

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

Connect to scope with parameters. To successfully connect to scope it must have handler that will accept this connection with given set of parameters. Client associated with connection is added to scope clients set, connection is registered as scope event listener.

Specified by:
  `connect` in interface `IScope`
Parameters:
  `conn` - Connection object
  `params` - Parameters passed with connection
Returns:
  `true` on success, `false` otherwise

#### createChildScope

    public boolean createChildScope(String name)

Create child scope with given name

Specified by:
  `createChildScope` in interface `IScope`
Specified by:
  `createChildScope` in interface `ScopeMXBean`
Parameters:
  `name` - Child scope name
Returns:
  `true` on success, `false` otherwise

#### destroy

    public void destroy()

Destroys scope

Specified by:
  `destroy` in interface `ScopeMXBean`

#### disconnect

    public void disconnect(IConnection conn)

Disconnect connection from scope

Specified by:
  `disconnect` in interface `IScope`
Parameters:
  `conn` - Connection object

#### dispatchEvent

    public void dispatchEvent(IEvent event)

Dispatches event (notifies all listeners)

Specified by:
  `dispatchEvent` in interface `IEventDispatcher`
Overrides:
  `dispatchEvent` in class `BasicScope`
Parameters:
  `event` - Event to dispatch

#### getAttribute

    public Object getAttribute(String name)

Get attribute by name

Specified by:
  `getAttribute` in interface `IScope`
Returns:
  value for the given name in the attributes or null if not found

#### setAttribute

    public boolean setAttribute(String name,
                       Object value)

Set attribute by name

Specified by:
  `setAttribute` in interface `IScope`
Returns:
  true if added, false if not added

#### hasAttribute

    public boolean hasAttribute(String name)

Whether or not an attribute exists, keyed by the given name

Specified by:
  `hasAttribute` in interface `IScope`
Returns:
  true if it exists, false otherwise

#### removeAttribute

    public boolean removeAttribute(String name)

Remove attribute by name

Specified by:
  `removeAttribute` in interface `IScope`
Returns:
  true if removed, false otherwise

#### getAttributeNames

    public Set<String> getAttributeNames()

Return attribute names

Specified by:
  `getAttributeNames` in interface `IScope`
Returns:
  attribute names

#### getAttributes

    public Map<String,Object> getAttributes()

Return scope attributes

Specified by:
  `getAttributes` in interface `IScope`
Returns:
  attributes

#### getActiveClients

    public int getActiveClients()

Return current number of clients connected to the scope.

Specified by:
  `getActiveClients` in interface `IScopeStatistics`
Specified by:
  `getActiveClients` in interface `ScopeMXBean`
Returns:
  number of clients

#### getActiveConnections

    public int getActiveConnections()

Return current number of connections to the scope.

Specified by:
  `getActiveConnections` in interface `IScopeStatistics`
Specified by:
  `getActiveConnections` in interface `ScopeMXBean`
Returns:
  number of connections

#### getActiveSubscopes

    public int getActiveSubscopes()

Return number of currently existing subscopes.

Specified by:
  `getActiveSubscopes` in interface `IScopeStatistics`
Specified by:
  `getActiveSubscopes` in interface `ScopeMXBean`
Returns:
  number of subscopes

#### getBroadcastScope

    public IBroadcastScope getBroadcastScope(String name)

Return the broadcast scope for a given name

Specified by:
  `getBroadcastScope` in interface `IScope`
Parameters:
  `name` -
Returns:
  broadcast scope or null if not found

#### getBasicScope

    public IBasicScope getBasicScope(ScopeType type,
                            String name)

Return base scope of given type with given name

Specified by:
  `getBasicScope` in interface `IScope`
Parameters:
  `type` - Scope type
  `name` - Scope name
Returns:
  Basic scope object

#### getBasicScopeNames

    public Set<String> getBasicScopeNames(ScopeType type)

Return basic scope names matching given type

Specified by:
  `getBasicScopeNames` in interface `IScope`
Parameters:
  `type` - Scope type
Returns:
  set of scope names

#### getClassLoader

    public ClassLoader getClassLoader()

Return current thread context classloader

Specified by:
  `getClassLoader` in interface `org.springframework.core.io.ResourceLoader`
Returns:
  Current thread context classloader

#### getClients

    public Set<IClient> getClients()

Return set of clients

Specified by:
  `getClients` in interface `IScope`
Returns:
  Set of clients bound to scope
See Also:
  `IClient.getConnections(IScope)`

#### getConnections

    public Collection<Set<IConnection>> getConnections()

Return connection iterator

Specified by:
  `getConnections` in interface `IScope`
Returns:
  Connections iterator

#### getContext

    public IContext getContext()

Return scope context. If scope doesn't have context, parent's context is returns, and so forth.

Specified by:
  `getContext` in interface `IScope`
Returns:
  Scope context or parent context

#### getContextPath

    public String getContextPath()

Return scope context path

Specified by:
  `getContextPath` in interface `IScope`
Specified by:
  `getContextPath` in interface `ScopeMXBean`
Returns:
  Scope context path

#### getCreationTime

    public long getCreationTime()

Return the timestamp the object was created.

Specified by:
  `getCreationTime` in interface `IStatisticsBase`
Returns:
  the timestamp in milliseconds since midnight, January 1, 1970 UTC.

#### getDepth

    public int getDepth()

return scope depth

Specified by:
  `getDepth` in interface `IBasicScope`
Specified by:
  `getDepth` in interface `IScopeStatistics`
Specified by:
  `getDepth` in interface `ScopeMXBean`
Overrides:
  `getDepth` in class `BasicScope`
Returns:
  Scope depth

#### getHandler

    public IScopeHandler getHandler()

Return scope handler or parent's scope handler if this scope doesn't have one

Specified by:
  `getHandler` in interface `IScope`
Returns:
  Scope handler (or parent's one)

#### getMaxClients

    public int getMaxClients()

Return maximum number of clients concurrently connected to the scope.

Specified by:
  `getMaxClients` in interface `IScopeStatistics`
Specified by:
  `getMaxClients` in interface `ScopeMXBean`
Returns:
  number of clients

#### getMaxConnections

    public int getMaxConnections()

Return maximum number of concurrent connections to the scope.

Specified by:
  `getMaxConnections` in interface `IScopeStatistics`
Specified by:
  `getMaxConnections` in interface `ScopeMXBean`
Returns:
  number of connections

#### getMaxSubscopes

    public int getMaxSubscopes()

Return maximum number of concurrently existing subscopes.

Specified by:
  `getMaxSubscopes` in interface `IScopeStatistics`
Specified by:
  `getMaxSubscopes` in interface `ScopeMXBean`
Returns:
  number of subscopes

#### getParent

    public IScope getParent()

Return parent scope

Specified by:
  `getParent` in interface `IBasicScope`
Overrides:
  `getParent` in class `BasicScope`
Returns:
  Parent scope

#### getPath

    public String getPath()

Return scope path calculated from parent path and parent scope name

Specified by:
  `getPath` in interface `IBasicScope`
Specified by:
  `getPath` in interface `IScopeStatistics`
Specified by:
  `getPath` in interface `ScopeMXBean`
Overrides:
  `getPath` in class `BasicScope`
Returns:
  Scope path

#### getResource

    public org.springframework.core.io.Resource getResource(String path)

Return resource located at given path

Specified by:
  `getResource` in interface `org.springframework.core.io.ResourceLoader`
Parameters:
  `path` - Resource path
Returns:
  Resource

#### getResources

    public org.springframework.core.io.Resource[] getResources(String path)
                                                        throws IOException

Return array of resources from path string, usually used with pattern path

Specified by:
  `getResources` in interface `org.springframework.core.io.support.ResourcePatternResolver`
Parameters:
  `path` - Resources path
Returns:
  Resources
Throws:
  `IOException` - I/O exception

#### getScope

    public IScope getScope(String name)

Return child scope by name

Specified by:
  `getScope` in interface `IScope`
Parameters:
  `name` - Scope name
Returns:
  Child scope with given name

#### getScopeNames

    public Set<String> getScopeNames()

Return child scope names iterator

Specified by:
  `getScopeNames` in interface `IScope`
Returns:
  Child scope names iterator

#### getServiceHandler

    public Object getServiceHandler(String name)

Return service handler by name

Specified by:
  `getServiceHandler` in interface `IServiceHandlerProvider`
Parameters:
  `name` - Handler name
Returns:
  Service handler with given name

#### getServiceHandlerNames

    public Set<String> getServiceHandlerNames()

Return set of service handler names. Removing entries from the set unregisters the corresponding service handler.

Specified by:
  `getServiceHandlerNames` in interface `IServiceHandlerProvider`
Specified by:
  `getServiceHandlerNames` in interface `ScopeMXBean`
Returns:
  Set of service handler names

#### getServiceHandlers

    protected Map<String,Object> getServiceHandlers()

Return map of service handlers. The map is created if it doesn't exist yet.

Returns:
  Map of service handlers

#### getServiceHandlers

    protected Map<String,Object> getServiceHandlers(boolean allowCreate)

Return map of service handlers and optionally created it if it doesn't exist.

Parameters:
  `allowCreate` - Should the map be created if it doesn't exist?
Returns:
  Map of service handlers

#### getStatistics

    public IScopeStatistics getStatistics()

Return statistics informations about the scope.

Specified by:
  `getStatistics` in interface `IScope`
Returns:
  statistics

#### getTotalClients

    public int getTotalClients()

Return total number of clients connected to the scope.

Specified by:
  `getTotalClients` in interface `IScopeStatistics`
Specified by:
  `getTotalClients` in interface `ScopeMXBean`
Returns:
  number of clients

#### getTotalConnections

    public int getTotalConnections()

Return total number of connections to the scope.

Specified by:
  `getTotalConnections` in interface `IScopeStatistics`
Specified by:
  `getTotalConnections` in interface `ScopeMXBean`
Returns:
  number of connections

#### getTotalSubscopes

    public int getTotalSubscopes()

Return total number of subscopes created.

Specified by:
  `getTotalSubscopes` in interface `IScopeStatistics`
Specified by:
  `getTotalSubscopes` in interface `ScopeMXBean`
Returns:
  number of subscopes created

#### handleEvent

    public boolean handleEvent(IEvent event)

Handles event. To be implemented in subclasses.

Specified by:
  `handleEvent` in interface `IEventHandler`
Overrides:
  `handleEvent` in class `BasicScope`
Parameters:
  `event` - Event to handle
Returns:
  `true` on success, `false` otherwise

#### hasChildScope

    public boolean hasChildScope(String name)

Check whether scope has child scope with given name

Specified by:
  `hasChildScope` in interface `IScope`
Specified by:
  `hasChildScope` in interface `ScopeMXBean`
Parameters:
  `name` - Child scope name
Returns:
  `true` if scope has child node with given name, `false` otherwise

#### hasChildScope

    public boolean hasChildScope(ScopeType type,
                        String name)

Check whether scope has child scope with given name and type

Specified by:
  `hasChildScope` in interface `IScope`
Specified by:
  `hasChildScope` in interface `ScopeMXBean`
Parameters:
  `type` - Child scope type
  `name` - Child scope name
Returns:
  `true` if scope has child node with given name and type, `false` otherwise

#### hasContext

    public boolean hasContext()

Check if scope has a context

Specified by:
  `hasContext` in interface `ScopeMXBean`
Returns:
  `true` if scope has context, `false` otherwise

#### hasHandler

    public boolean hasHandler()

Check if scope or it's parent has handler

Specified by:
  `hasHandler` in interface `IScope`
Specified by:
  `hasHandler` in interface `ScopeMXBean`
Returns:
  `true` if scope or it's parent scope has a handler, `false` otherwise

#### hasParent

    public boolean hasParent()

Check if scope has parent scope

Specified by:
  `hasParent` in interface `IBasicScope`
Specified by:
  `hasParent` in interface `ScopeMXBean`
Overrides:
  `hasParent` in class `BasicScope`
Returns:
  `true` if scope has parent scope, `false` otherwise`

#### init

    public void init()

Initialization actions, start if autostart is set to `true`

Specified by:
  `init` in interface `ScopeMXBean`

#### uninit

    public void uninit()

Uninitialize scope and unregister from parent.

#### isEnabled

    public boolean isEnabled()

Check if scope is enabled

Returns:
  `true` if scope is enabled, `false` otherwise

#### getEnabled

    public boolean getEnabled()

Here for JMX only, uses isEnabled()

Specified by:
  `getEnabled` in interface `ScopeMXBean`
Returns:
  `true` if scope is enabled, `false` otherwise

#### isRunning

    public boolean isRunning()

Check if scope is in running state

Returns:
  `true` if scope is in running state, `false` otherwise

#### getRunning

    public boolean getRunning()

Here for JMX only, uses isEnabled()

Specified by:
  `getRunning` in interface `ScopeMXBean`
Returns:
  `true` if scope is in running state, `false` otherwise

#### lookupConnections

    public Set<IConnection> lookupConnections(IClient client)

Looks up connections for client

Specified by:
  `lookupConnections` in interface `IScope`
Parameters:
  `client` - Client
Returns:
  Connection

#### registerServiceHandler

    public void registerServiceHandler(String name,
                              Object handler)

Register service handler by name

Specified by:
  `registerServiceHandler` in interface `IServiceHandlerProvider`
Parameters:
  `name` - Service handler name
  `handler` - Service handler

#### removeChildScope

    public void removeChildScope(IBasicScope scope)

Removes child scope

Specified by:
  `removeChildScope` in interface `IScope`
Parameters:
  `scope` - Child scope to remove

#### removeChildren

    public void removeChildren()

Removes all the child scopes

Specified by:
  `removeChildren` in interface `IScope`

#### setAutoStart

    public void setAutoStart(boolean autoStart)

Setter for autostart flag

Specified by:
  `setAutoStart` in interface `ScopeMXBean`
Parameters:
  `autoStart` - Autostart flag value

#### setChildLoadPath

    public void setChildLoadPath(String pattern)

Setter for child load path. Should be implemented in subclasses?

Specified by:
  `setChildLoadPath` in interface `ScopeMXBean`
Parameters:
  `pattern` - Load path pattern

#### setContext

    public void setContext(IContext context)

Setter for context

Parameters:
  `context` - Context object

#### setDepth

    public void setDepth(int depth)

Set scope depth

Specified by:
  `setDepth` in interface `ScopeMXBean`
Parameters:
  `depth` - Scope depth

#### setEnabled

    public void setEnabled(boolean enabled)

Enable or disable scope by setting enable flag

Specified by:
  `setEnabled` in interface `ScopeMXBean`
Parameters:
  `enabled` - Enable flag value

#### setHandler

    public void setHandler(IScopeHandler handler)

Setter for scope event handler

Parameters:
  `handler` - Event handler

#### setName

    public void setName(String name)

Setter for scope name

Specified by:
  `setName` in interface `ScopeMXBean`
Parameters:
  `name` - Scope name

#### setParent

    public void setParent(IScope parent)

Setter for parent scope

Parameters:
  `parent` - Parent scope

#### setPersistenceClass

    public void setPersistenceClass(String persistenceClass)
                             throws Exception

Set scope persistence class

Specified by:
  `setPersistenceClass` in interface `ScopeMXBean`
Parameters:
  `persistenceClass` - Scope's persistence class
Throws:
  `Exception` - Exception

#### start

    public boolean start()

Starts scope

Specified by:
  `start` in interface `ScopeMXBean`
Returns:
  `true` if scope has handler and it's start method returned true, `false` otherwise

#### stop

    public void stop()

Stops scope

Specified by:
  `stop` in interface `ScopeMXBean`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### unregisterServiceHandler

    public void unregisterServiceHandler(String name)

Unregisters service handler by name

Specified by:
  `unregisterServiceHandler` in interface `IServiceHandlerProvider`
Specified by:
  `unregisterServiceHandler` in interface `ScopeMXBean`
Parameters:
  `name` - Service handler name

#### getServer

    public IServer getServer()

Return the server instance connected to this scope.

Returns:
  the server instance

#### dump

    public void dump()

#### registerJMX

    protected void registerJMX()

#### unregisterJMX

    protected void unregisterJMX()

#### from

    public static Scope from(CompositeData cd)

Allows for reconstruction via CompositeData.

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