public abstract class BasicScope extends Object implements IBasicScope, Comparable<BasicScope>
| Modifier and Type | Field and Description |
|---|---|
protected long |
creation
Creation timestamp
|
protected int |
keepDelay
Set to amount of time (in seconds) the scope will be kept before being freed, after the last disconnect.
|
protected boolean |
keepOnDisconnect
Set to true to prevent the scope from being freed upon disconnect.
|
protected CopyOnWriteArraySet<IEventListener> |
listeners
List of event listeners
|
protected static org.slf4j.Logger |
log |
protected String |
name
String identifier for this scope
|
protected IScope |
parent
Parent scope.
|
protected String |
persistenceClass
Scope persistence storage type
|
protected boolean |
persistent
Whether or not to persist attributes
|
protected CopyOnWriteArraySet<IScopeSecurityHandler> |
securityHandlers
List of security handlers
|
protected IPersistenceStore |
store
Storage for persistable attributes
|
protected ScopeType |
type
Scope type.
|
| Constructor and Description |
|---|
BasicScope()
Creates unnamed scope
|
BasicScope(IScope parent,
ScopeType type,
String name,
boolean persistent)
Constructor for basic scope
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEventListener(IEventListener listener)
Add event listener to list of notified objects
|
int |
compareTo(BasicScope that) |
void |
dispatchEvent(IEvent event)
Dispatches event (notifies all listeners)
|
boolean |
equals(Object obj)
Equality is based on the scope's name and type.
|
int |
getDepth()
Get the scopes depth, how far down the scope tree is it.
|
Set<IEventListener> |
getEventListeners()
Return listeners list iterator
|
String |
getName()
Get the name of this scope.
|
IScope |
getParent()
Get this scopes parent.
|
String |
getPath()
Get the full absolute path.
|
IPersistenceStore |
getStore()
Get the persistable store
|
ScopeType |
getType()
Get the type of the scope.
|
boolean |
handleEvent(IEvent event)
Handles event.
|
boolean |
hasEventListeners()
Returns true if there are event listeners attached to this scope.
|
int |
hashCode()
Hash code is based on the scope's name and type
|
boolean |
hasParent()
Does this scope have a parent? You can think of scopes as of tree items where scope may have a parent and children (child).
|
boolean |
isConnectionAllowed(IConnection conn)
Provides a means to allow a scope to perform processing on a connection prior to the actual
connection attempt or other handling.
|
boolean |
isScopeAllowed(IScope scope)
Provides a means to allow a scope to perform processing on another scope prior to additional scope handling.
|
boolean |
isValid()
Validates a scope based on its name and type
|
void |
notifyEvent(IEvent event)
Notifies listeners on event.
|
boolean |
removeEventListener(IEventListener listener)
Remove event listener from list of listeners
|
void |
setKeepDelay(int keepDelay)
Sets the amount of time to keep the scope available after the last disconnect.
|
void |
setSecurityHandlers(Set<IScopeSecurityHandler> handlers)
Sets the scope security handlers.
|
protected static org.slf4j.Logger log
protected String name
protected long creation
protected boolean persistent
protected IPersistenceStore store
protected String persistenceClass
protected boolean keepOnDisconnect
protected int keepDelay
protected transient CopyOnWriteArraySet<IScopeSecurityHandler> securityHandlers
protected transient CopyOnWriteArraySet<IEventListener> listeners
@ConstructorProperties(value="") public BasicScope()
@ConstructorProperties(value={"parent","type","name","persistent"}) public BasicScope(IScope parent, ScopeType type, String name, boolean persistent)
parent - Parent scopetype - Scope typename - Scope name. Used to identify scopes in application, must be unique among scopes of one levelpersistent - Whether scope is persistentpublic boolean hasParent()
hasParent in interface IBasicScopepublic IScope getParent()
getParent in interface IBasicScopepublic ScopeType getType()
IBasicScopegetType in interface IBasicScopepublic String getName()
IBasicScopegetName in interface IBasicScopepublic IPersistenceStore getStore()
IBasicScopegetStore in interface IBasicScopepublic int getDepth()
getDepth in interface IBasicScopepublic String getPath()
getPath in interface IBasicScopepublic void setKeepDelay(int keepDelay)
setKeepDelay in interface IBasicScopekeepDelay - delaypublic boolean isValid()
isValid in interface IBasicScopepublic boolean isConnectionAllowed(IConnection conn)
isConnectionAllowed in interface IBasicScopeconn - connectionpublic boolean isScopeAllowed(IScope scope)
isScopeAllowed in interface IBasicScopescope - scopepublic void setSecurityHandlers(Set<IScopeSecurityHandler> handlers)
setSecurityHandlers in interface IBasicScopehandlers - scope security handlerspublic boolean addEventListener(IEventListener listener)
addEventListener in interface IEventObservablelistener - Listening objectpublic boolean removeEventListener(IEventListener listener)
removeEventListener in interface IEventObservablelistener - Listener to removepublic Set<IEventListener> getEventListeners()
getEventListeners in interface IEventObservablepublic boolean hasEventListeners()
public boolean handleEvent(IEvent event)
handleEvent in interface IEventHandlerevent - Event contextpublic void notifyEvent(IEvent event)
notifyEvent in interface IEventListenerevent - Event to broadcastpublic void dispatchEvent(IEvent event)
dispatchEvent in interface IEventDispatcherevent - Event to dispatchpublic int hashCode()
public boolean equals(Object obj)
public int compareTo(BasicScope that)
compareTo in interface Comparable<BasicScope>Copyright © 2005–2017 Red5. All rights reserved.