public abstract class AbstractEnvironmentSpace extends SynchronizedPropertyObject implements IEnvironmentSpace
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractEnvironmentSpace.AtomicCounter
Synchronized counter class
|
Modifier and Type | Field and Description |
---|---|
protected ComponentActionList |
actionlist
The list of scheduled component actions.
|
protected java.util.Map |
actions
Available component actions.
|
protected MultiCollection<java.lang.String,AvatarMapping> |
avatarmappings
Avatar mappings.
|
protected java.lang.ClassLoader |
classloader
The class loader.
|
protected MEnvSpaceInstance |
config |
protected java.util.Map |
dataconsumers
The data consumers.
|
protected java.util.Map |
dataproviders
The data providers (name -> provider).
|
protected MultiCollection<java.lang.String,java.util.Map> |
dataviewmappings
Data view mappings.
|
protected IExternalAccess |
exta
The context.
|
protected SimpleValueFetcher |
fetcher
The fetcher.
|
protected IInternalAccess |
ia |
protected java.util.Map |
initialavatars
Initial avatar settings (cid -> [type, props]).
|
protected java.util.List |
listeners
The environment listeners.
|
protected AbstractEnvironmentSpace.AtomicCounter |
objectidcounter
Object id counter for new ids.
|
protected java.util.Map |
objecttypes
The space object types.
|
protected java.util.Map |
objecttypesMeta
The space object meta data
|
protected java.util.List |
observercenters
The observers.
|
protected java.util.Map |
perceptgenerators
The percept generators.
|
protected PerceptList |
perceptlist
The list of scheduled percepts.
|
protected MultiCollection<java.lang.String,java.lang.Object[]> |
perceptprocessors
The percept processors.
|
protected java.util.Map |
percepttypes
The percepttypes.
|
protected IValueFetcher |
pfetcher |
protected java.util.Map |
processes
The environment processes.
|
protected java.util.Map |
processtypes
The space process types.
|
protected java.util.Map |
spaceobjects
Long/ObjectIDs (keys) and environment objects (values).
|
protected java.util.Map |
spaceobjectsbyowner
Space objects by owner.
|
protected java.util.Map |
spaceobjectsbytype
Types of EnvironmentObjects and lists of EnvironmentObjects of that type (typed view).
|
protected AbstractEnvironmentSpace.AtomicCounter |
taskidcounter
Task id counter for new ids.
|
protected java.util.Map |
tasktypes
The object task types.
|
protected java.util.Map |
views
Available views
|
protected java.util.Map |
zombieobjects
The zombie objects.
|
monitor
pcs, properties
Constructor and Description |
---|
AbstractEnvironmentSpace()
Create an environment space
|
Modifier and Type | Method and Description |
---|---|
void |
addAvatarMappings(AvatarMapping mapping)
Adds an avatar mapping.
|
void |
addDataConsumer(java.lang.String name,
ITableDataConsumer consumer)
Add a new data consumer.
|
void |
addDataProvider(java.lang.String name,
ITableDataProvider provider)
Add a new data provider.
|
void |
addDataView(java.lang.String name,
IDataView view)
Adds a view to the space.
|
void |
addDataViewMapping(java.lang.String objecttype,
java.util.Map view)
Add a mapping from object type to data view
|
void |
addEnvironmentListener(IEnvironmentListener listener)
Add an environment listener.
|
void |
addInitialAvatar(IComponentIdentifier ownerid,
java.lang.String type,
java.util.Map props)
Initial settings for the avatar of a specific component.
|
void |
addObjectTaskType(java.lang.String typename,
java.lang.Class clazz,
java.util.List properties)
Add a object task type.
|
void |
addPerceptGenerator(java.lang.Object id,
IPerceptGenerator gen)
Adds a percept generator.
|
void |
addPerceptProcessor(java.lang.String componenttype,
java.util.Set percepttypes,
IPerceptProcessor proc)
Add a percept processor.
|
void |
addPerceptType(PerceptType percepttype)
Add a space percept type.
|
void |
addSpaceAction(java.lang.String id,
ISpaceAction action)
Adds an space action.
|
void |
addSpaceObjectType(java.lang.String typename,
IPropertyMetaDataSet mobjecttype)
Add a space type.
|
void |
addSpaceProcessType(java.lang.String typename,
java.lang.Class clazz,
java.util.List properties)
Add a space process type.
|
void |
addTaskListener(java.lang.Object taskid,
java.lang.Object objectid,
IResultListener listener)
Add a result listener to an object task.
|
void |
cancelSpaceAction(int id)
Cancel a queued space action.
|
void |
componentAdded(IComponentDescription owner)
Called when an component was added.
|
void |
componentRemoved(IComponentDescription desc)
Called when an component was removed.
|
protected ISpaceObject |
createAvatar(IComponentDescription owner,
java.lang.String fullname,
boolean zombie)
Create an avatar.
|
java.lang.Object |
createObjectTask(java.lang.String typename,
java.util.Map properties,
java.lang.Object objectid)
Creates an object task.
|
void |
createPercept(java.lang.String typename,
java.lang.Object data,
IComponentDescription comp,
ISpaceObject avatar)
Create a percept for the given component.
|
ISpaceObject |
createSpaceObject(java.lang.String typename,
java.util.Map properties,
java.util.List tasks)
Creates an object in this space.
|
ISpaceObject |
createSpaceObjectZombie(java.lang.String typename,
java.util.Map properties,
java.util.List tasks)
Creates a zombie object in this space.
|
void |
createSpaceProcess(java.lang.String typename,
java.util.Map properties)
Creates a space process.
|
void |
destroySpaceObject(java.lang.Object id)
Destroys an object in this space.
|
protected void |
fireEnvironmentEvent(EnvironmentEvent event)
Fire an environment event.
|
protected void |
fireObjectEvent(SpaceObject object,
java.lang.String property,
java.lang.Object value)
Fire an object event.
|
ISpaceObject |
getAvatar(IComponentDescription owner)
Get the avatar object.
|
ISpaceObject |
getAvatar(IComponentDescription owner,
java.lang.String fullname)
Get the avatar object.
|
protected AvatarMapping |
getAvatarMapping(java.lang.String componenttype,
java.lang.String avatartype)
Get the avatar mapping for an component avatar combination.
|
ISpaceObject[] |
getAvatars(IComponentDescription owner)
Get the avatar objects.
|
java.lang.ClassLoader |
getClassLoader()
Get the class loader.
|
ComponentActionList |
getComponentActionList()
Get the list of scheduled component actions
|
IComponentDescription[] |
getComponents()
Get the avatar objects.
|
protected IFuture |
getComponentType(IComponentIdentifier cid) |
ITableDataConsumer |
getDataConsumer(java.lang.String name)
Get a data consumer.
|
java.util.Collection |
getDataConsumers()
Get the data consumers.
|
ITableDataProvider |
getDataProvider(java.lang.String name)
Get a data provider.
|
IDataView |
getDataView(java.lang.String name)
Gets a specific view.
|
java.util.Map |
getDataViews()
Get all available dataviews in this space.
|
IExternalAccess |
getExternalAccess()
Get the context.
|
SimpleValueFetcher |
getFetcher()
Get the value fetcher.
|
IComponentDescription |
getOwner(java.lang.Object id)
Get the owner of an object.
|
PerceptList |
getPerceptList()
Get the list of scheduled percepts.
|
PerceptType |
getPerceptType(java.lang.String percepttype)
Get a space percept type.
|
java.util.Collection |
getProcesses()
Get the processes.
|
java.lang.Object |
getProperty(java.lang.String name)
Returns a property.
|
ISpaceAction |
getSpaceAction(java.lang.String id)
Adds an space action.
|
ISpaceObject |
getSpaceObject(java.lang.Object id)
Returns an object in this space.
|
ISpaceObject |
getSpaceObject0(java.lang.Object id)
Returns an object in this space.
|
ISpaceObject[] |
getSpaceObjectsByType(java.lang.String type)
Get all space object of a specific type.
|
java.util.Collection |
getSpaceObjectsCollection()
Get the space objects.
|
MObjectType |
getSpaceObjectType(java.lang.String type)
Get the object type.
|
ISpaceProcess |
getSpaceProcess(java.lang.Object id)
Returns a space process.
|
java.util.Set |
getSpaceProcessNames()
Returns then names of the space processes.
|
java.util.Collection |
getViews()
Get the views.
|
IFuture<java.lang.Void> |
init()
Initialize the extension.
|
IFuture<java.lang.Void> |
initSpace()
Create a space.
|
void |
initSpaceObject(ISpaceObject ret)
Creates an object in this space.
|
protected java.util.Map |
mergeProperties(java.util.Collection typeprops,
java.util.Map properties)
Add type properties to runtime properties.
|
protected java.util.Map |
mergeProperties(IPropertyMetaDataSet mObjectType,
java.util.Map properties)
Add type properties to runtime properties.
|
java.lang.Object |
performSpaceAction(java.lang.String id,
java.util.Map parameters)
Performs a space action.
|
int |
performSpaceAction(java.lang.String id,
java.util.Map parameters,
IResultListener listener)
Schedules an space action.
|
void |
removeAvatarMappings(AvatarMapping mapping)
Remove an avatar mapping.
|
void |
removeDataView(java.lang.String name)
Removes a view from the space.
|
void |
removeEnvironmentListener(IEnvironmentListener listener)
Remove an environment listener.
|
void |
removeObjectTask(java.lang.Object taskid,
java.lang.Object objectid)
Remove an object task.
|
void |
removeObjectTaskType(java.lang.String typename)
Remove an object task type.
|
void |
removePerceptGenerator(java.lang.Object id)
Remove a percept generator.
|
void |
removePerceptProcessor(java.lang.String componenttype,
IPerceptProcessor proc)
remove a percept processor.
|
void |
removePerceptType(java.lang.String typename)
Remove a space process type.
|
void |
removeSpaceAction(java.lang.String id)
Removes an space action.
|
void |
removeSpaceObjectType(java.lang.String typename)
Remove a space object type.
|
void |
removeSpaceProcess(java.lang.Object id)
Removes a space process.
|
void |
removeSpaceProcessType(java.lang.String typename)
Remove a space process type.
|
void |
removeTaskListener(java.lang.Object taskid,
java.lang.Object objectid,
IResultListener listener)
Remove a result listener from an object task.
|
void |
setFetcher(SimpleValueFetcher fetcher)
Set the fetcher.
|
void |
setInitData(IInternalAccess ia,
MEnvSpaceInstance config,
IValueFetcher pfetcher) |
void |
setOwner(java.lang.Object id,
IComponentDescription owner)
Set the owner of an object.
|
IFuture<java.lang.Void> |
terminate()
Terminate the extension.
|
IFuture<java.lang.Void> |
waitForTask(java.lang.Object taskid,
java.lang.Object objectid)
Add a result listener to an object task.
|
addPropertyChangeListener, getMonitor, getPropertyNames, hasProperty, removePropertyChangeListener, setProperty
getMetaData, getMetaDatas
getProperties, setProperties, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPropertyNames, hasProperty, setProperty
protected IExternalAccess exta
protected java.util.Map objecttypes
protected java.util.Map objecttypesMeta
protected java.util.Map tasktypes
protected java.util.Map processtypes
protected java.util.Map percepttypes
protected java.util.Map actions
protected java.util.Map perceptgenerators
protected MultiCollection<java.lang.String,java.lang.Object[]> perceptprocessors
protected MultiCollection<java.lang.String,AvatarMapping> avatarmappings
protected java.util.Map initialavatars
protected MultiCollection<java.lang.String,java.util.Map> dataviewmappings
protected java.util.Map processes
protected java.util.Map spaceobjects
protected java.util.Map spaceobjectsbytype
protected java.util.Map spaceobjectsbyowner
protected AbstractEnvironmentSpace.AtomicCounter objectidcounter
protected AbstractEnvironmentSpace.AtomicCounter taskidcounter
protected ComponentActionList actionlist
protected PerceptList perceptlist
protected java.util.Map views
protected java.util.List listeners
protected SimpleValueFetcher fetcher
protected java.util.Map dataproviders
protected java.util.Map dataconsumers
protected java.util.Map zombieobjects
protected java.util.List observercenters
protected java.lang.ClassLoader classloader
protected IInternalAccess ia
protected MEnvSpaceInstance config
protected IValueFetcher pfetcher
public AbstractEnvironmentSpace()
public void setInitData(IInternalAccess ia, MEnvSpaceInstance config, IValueFetcher pfetcher)
public IFuture<java.lang.Void> initSpace()
public void addSpaceObjectType(java.lang.String typename, IPropertyMetaDataSet mobjecttype)
addSpaceObjectType
in interface IEnvironmentSpace
typename
- The type name.initproperties
- The MobjectType.public void removeSpaceObjectType(java.lang.String typename)
removeSpaceObjectType
in interface IEnvironmentSpace
typename
- The type name.public void addSpaceProcessType(java.lang.String typename, java.lang.Class clazz, java.util.List properties)
addSpaceProcessType
in interface IEnvironmentSpace
typename
- The type name.properties
- The properties.public void removeSpaceProcessType(java.lang.String typename)
removeSpaceProcessType
in interface IEnvironmentSpace
typename
- The type name.public void createSpaceProcess(java.lang.String typename, java.util.Map properties)
createSpaceProcess
in interface IEnvironmentSpace
typename
- The type name.properties
- The properties.public void addObjectTaskType(java.lang.String typename, java.lang.Class clazz, java.util.List properties)
addObjectTaskType
in interface IEnvironmentSpace
typename
- The type name.properties
- The properties.public void removeObjectTaskType(java.lang.String typename)
removeObjectTaskType
in interface IEnvironmentSpace
typename
- The type name.public java.lang.Object createObjectTask(java.lang.String typename, java.util.Map properties, java.lang.Object objectid)
createObjectTask
in interface IEnvironmentSpace
typename
- The type name.properties
- The properties.public void removeObjectTask(java.lang.Object taskid, java.lang.Object objectid)
removeObjectTask
in interface IEnvironmentSpace
typename
- The type name.initproperties
- The properties.public void addTaskListener(java.lang.Object taskid, java.lang.Object objectid, IResultListener listener)
addTaskListener
in interface IEnvironmentSpace
public void removeTaskListener(java.lang.Object taskid, java.lang.Object objectid, IResultListener listener)
removeTaskListener
in interface IEnvironmentSpace
public IFuture<java.lang.Void> waitForTask(java.lang.Object taskid, java.lang.Object objectid)
waitForTask
in interface IEnvironmentSpace
public java.util.Set getSpaceProcessNames()
public ISpaceProcess getSpaceProcess(java.lang.Object id)
getSpaceProcess
in interface IEnvironmentSpace
id
- ID of the space processpublic void removeSpaceProcess(java.lang.Object id)
removeSpaceProcess
in interface IEnvironmentSpace
id
- ID of the space processpublic final ISpaceObject createSpaceObject(java.lang.String typename, java.util.Map properties, java.util.List tasks)
createSpaceObject
in interface IEnvironmentSpace
type
- the object's typeproperties
- initial properties (may be null)tasks
- initial task list (may be null)public ISpaceObject createSpaceObjectZombie(java.lang.String typename, java.util.Map properties, java.util.List tasks)
type
- the object's typeproperties
- initial properties (may be null)tasks
- initial task list (may be null)public void initSpaceObject(ISpaceObject ret)
type
- the object's typeinitproperties
- initial properties (may be null)tasks
- initial task list (may be null)listeners
- initial listeners (may be null)protected java.util.Map mergeProperties(java.util.Collection typeprops, java.util.Map properties)
typeprops
- The type properties (if any).properties
- The runtime properties or null.protected java.util.Map mergeProperties(IPropertyMetaDataSet mObjectType, java.util.Map properties)
typeprops
- The typeproperties
- The runtime properties or null.public void destroySpaceObject(java.lang.Object id)
destroySpaceObject
in interface IEnvironmentSpace
id
- the object's IDpublic ISpaceObject getSpaceObject(java.lang.Object id)
getSpaceObject
in interface IEnvironmentSpace
id
- the object's IDpublic ISpaceObject getSpaceObject0(java.lang.Object id)
id
- the object's IDpublic ISpaceObject[] getSpaceObjectsByType(java.lang.String type)
getSpaceObjectsByType
in interface IEnvironmentSpace
type
- The space object type.public void addAvatarMappings(AvatarMapping mapping)
componenttype
- The component type.objecttype
- The object type to represent the component.public void removeAvatarMappings(AvatarMapping mapping)
componenttype
- The component type.objecttype
- The object type to represent the component.public void addSpaceAction(java.lang.String id, ISpaceAction action)
addSpaceAction
in interface IEnvironmentSpace
actionId
- the action IDaction
- the actionpublic ISpaceAction getSpaceAction(java.lang.String id)
actionId
- the action IDaction
- the actionpublic void removeSpaceAction(java.lang.String id)
removeSpaceAction
in interface IEnvironmentSpace
actionId
- the action IDpublic int performSpaceAction(java.lang.String id, java.util.Map parameters, IResultListener listener)
performSpaceAction
in interface IEnvironmentSpace
id
- Id of the actionparameters
- parameters for the action (may be null)listener
- the result listenerpublic void cancelSpaceAction(int id)
cancelSpaceAction
in interface IEnvironmentSpace
public java.lang.Object performSpaceAction(java.lang.String id, java.util.Map parameters)
id
- Id of the actionparameters
- parameters for the action (may be null)public void createPercept(java.lang.String typename, java.lang.Object data, IComponentDescription comp, ISpaceObject avatar)
typename
- The percept type.data
- The content of the percept (if any).cid
- The component that should receive the percept.public IComponentDescription getOwner(java.lang.Object id)
id
- The id.public void setOwner(java.lang.Object id, IComponentDescription owner)
setOwner
in interface IEnvironmentSpace
id
- The object id.pos
- The object owner.public ISpaceObject[] getAvatars(IComponentDescription owner)
getAvatars
in interface IEnvironmentSpace
public IComponentDescription[] getComponents()
public ISpaceObject getAvatar(IComponentDescription owner)
getAvatar
in interface IEnvironmentSpace
public ISpaceObject getAvatar(IComponentDescription owner, java.lang.String fullname)
protected ISpaceObject createAvatar(IComponentDescription owner, java.lang.String fullname, boolean zombie)
public void addDataView(java.lang.String name, IDataView view)
addDataView
in interface IEnvironmentSpace
name
- name of the viewview
- the viewpublic void removeDataView(java.lang.String name)
removeDataView
in interface IEnvironmentSpace
name
- name of the viewpublic IDataView getDataView(java.lang.String name)
getDataView
in interface IEnvironmentSpace
name
- name of the viewpublic java.util.Map getDataViews()
getDataViews
in interface IEnvironmentSpace
public void addDataViewMapping(java.lang.String objecttype, java.util.Map view)
objecttype
- The object type.view
- Settings for view creation.public void addEnvironmentListener(IEnvironmentListener listener)
addEnvironmentListener
in interface IEnvironmentSpace
listener
- The environment listener.public void removeEnvironmentListener(IEnvironmentListener listener)
removeEnvironmentListener
in interface IEnvironmentSpace
listener
- The environment listener.public void addPerceptGenerator(java.lang.Object id, IPerceptGenerator gen)
addPerceptGenerator
in interface IEnvironmentSpace
id
- The percept generator id.gen
- The percept generator.public void removePerceptGenerator(java.lang.Object id)
removePerceptGenerator
in interface IEnvironmentSpace
id
- The percept generator id.public void addPerceptProcessor(java.lang.String componenttype, java.util.Set percepttypes, IPerceptProcessor proc)
componenttype
- The component type.proc
- The percept processor.public void removePerceptProcessor(java.lang.String componenttype, IPerceptProcessor proc)
componenttype
- The component type.proc
- The percept processor.public void addPerceptType(PerceptType percepttype)
addPerceptType
in interface IEnvironmentSpace
typename
- The percept name.objecttypes
- The objecttypes.componenttypes
- The componenttypes.public void removePerceptType(java.lang.String typename)
removePerceptType
in interface IEnvironmentSpace
typename
- The type name.public PerceptType getPerceptType(java.lang.String percepttype)
getPerceptType
in interface IEnvironmentSpace
percepttype
- The name of the percept type.public void componentAdded(IComponentDescription owner)
public void componentRemoved(IComponentDescription desc)
protected IFuture getComponentType(IComponentIdentifier cid)
public IExternalAccess getExternalAccess()
getExternalAccess
in interface IEnvironmentSpace
public java.lang.Object getProperty(java.lang.String name)
getProperty
in interface IPropertyObject
getProperty
in class SynchronizedPropertyObject
name
- name of the propertypublic SimpleValueFetcher getFetcher()
public void setFetcher(SimpleValueFetcher fetcher)
fetcher
- The fetcher to set.public java.util.Collection getSpaceObjectsCollection()
public java.util.Collection getProcesses()
public ComponentActionList getComponentActionList()
public PerceptList getPerceptList()
public java.util.Collection getViews()
protected void fireEnvironmentEvent(EnvironmentEvent event)
event
- The event.protected void fireObjectEvent(SpaceObject object, java.lang.String property, java.lang.Object value)
object
- The object.property
- The changed property.value
- The new property value.public void addInitialAvatar(IComponentIdentifier ownerid, java.lang.String type, java.util.Map props)
ownerid
- The component id.type
- The object type.props
- The properties for the object (if any).protected AvatarMapping getAvatarMapping(java.lang.String componenttype, java.lang.String avatartype)
public void addDataProvider(java.lang.String name, ITableDataProvider provider)
name
- The name.provider
- The provider.public ITableDataProvider getDataProvider(java.lang.String name)
name
- The name.public void addDataConsumer(java.lang.String name, ITableDataConsumer consumer)
consumer
- The consumer.public ITableDataConsumer getDataConsumer(java.lang.String name)
name
- The name.public java.util.Collection getDataConsumers()
public IFuture<java.lang.Void> init()
public IFuture<java.lang.Void> terminate()
public java.lang.ClassLoader getClassLoader()
public MObjectType getSpaceObjectType(java.lang.String type)