io.sarl.sre.janus.services.context
Class Context
All Superinterfaces:
AgentContext
class Context
extends AgentTrait
implements AgentContext
Implementation of an agent context in the SRE platform.

This class is thread-safe.
Maven Group Identifier:
io.sarl.sre.janus
Maven Artifact Identifier:
janus.kernel
Property Summary
Modifier and type Property and description
OpenEventSpace defaultSpace
java.util.UUID iD
protected java.util.concurrent.locks.ReadWriteLock lock
Replies the lock to be used.
ConcurrentCollection<T> spaces
Inherited: owner
Constructor Summary
Action Summary
Modifier and type Action and description
void addSpaceRepositoryListener(SpaceRepositoryListener)
Add listener on the space repository changes.
S createSpace(Class<T>,UUID,Object*)
void destroy
Destroy any associated resources.
protected SpaceRepository ensureRepository([Procedure1<Param>])
Replies the space repository and creates it if it does not exist.
OpenEventSpace getDefaultSpace
java.util.UUID getID
protected java.util.concurrent.locks.ReadWriteLock getLock
Replies the lock to be used.
S getOrCreateSpaceWithID(Class<T>,UUID,Object*)
S getOrCreateSpaceWithSpec(Class<T>,UUID,Object*)
S getSpace(UUID)
ConcurrentCollection<T> getSpaces
ConcurrentCollection<T> getSpaces(Class<T>)
void initialize
Initialize the context when it is published to the agents.
boolean isRootContext
void removeSpaceRepositoryListener(SpaceRepositoryListener)
Remove listener on the space repository changes.
void toString(ToStringBuilder)
Property Details
defaultSpace
val defaultSpace : OpenEventSpace

This property is an alias for the action: getDefaultSpace

iD
val iD : java.util.UUID

This property is an alias for the action: getID

lock
protected val lock : java.util.concurrent.locks.ReadWriteLock
Replies the lock to be used.

This property is an alias for the action: getLock

spaces
val spaces : ConcurrentCollection<T>

This property is an alias for the action: getSpaces

Constructor Details
new(UUID,UUID,Agent,Provider<T>,Provider<T>,LoggingService,SpaceRepositoryListenerFactory)
new(UUID,UUID,Agent,Provider<T>,Provider<T>,LoggingService,SpaceRepositoryListenerFactory)
Constructs a Context.
Parameters:
id - identifier of the context.
defaultSpaceID - identifier of the default space in the context.
owner - is the owner of the context. If null, it is the root context.
spaceRepositoryProvider - the provider of space repository
factories - the provider of factories.
loggingService - the logging service.
listenerFactory - the factory of space listeners.
Action Details
addSpaceRepositoryListener(SpaceRepositoryListener)
def addSpaceRepositoryListener(SpaceRepositoryListener)
Add listener on the space repository changes.
Parameters:
listener - the listener to be added.
createSpace(Class<T>,UUID,Object*)
def createSpace(Class<T>,UUID,Object*) : S

with S extends Space

destroy
def destroy
Destroy any associated resources.
ensureRepository([Procedure1<Param>])
protected def ensureRepository([Procedure1<Param>]) : SpaceRepository
Replies the space repository and creates it if it does not exist.

This function is thread-safe.
Parameters:
defaultSpaceCallback - the call back for default space.
Returns:
the space repository.
getDefaultSpace
def getDefaultSpace : OpenEventSpace
getID
def getID : java.util.UUID
getLock
protected def getLock : java.util.concurrent.locks.ReadWriteLock
Replies the lock to be used.
getOrCreateSpaceWithID(Class<T>,UUID,Object*)
def getOrCreateSpaceWithID(Class<T>,UUID,Object*) : S

with S extends Space

getOrCreateSpaceWithSpec(Class<T>,UUID,Object*)
def getOrCreateSpaceWithSpec(Class<T>,UUID,Object*) : S

with S extends Space

getSpace(UUID)
def getSpace(UUID) : S

with S extends Space

getSpaces
def getSpaces : ConcurrentCollection<T>
getSpaces(Class<T>)
def getSpaces(Class<T>) : ConcurrentCollection<T>

with S extends Space

initialize
def initialize
Initialize the context when it is published to the agents.
isRootContext
def isRootContext : boolean
removeSpaceRepositoryListener(SpaceRepositoryListener)
def removeSpaceRepositoryListener(SpaceRepositoryListener)
Remove listener on the space repository changes.
Parameters:
listener - the listener to be removed.
toString(ToStringBuilder)
def toString(ToStringBuilder)