jadex.application.space.envsupport.environment
Class SpaceObject

java.lang.Object
  extended by jadex.commons.SimplePropertyObject
      extended by jadex.commons.meta.TypedPropertyObject
          extended by jadex.application.space.envsupport.environment.SynchronizedPropertyObject
              extended by jadex.application.space.envsupport.environment.SpaceObject
All Implemented Interfaces:
ISpaceObject, IPropertyObject, ITypedPropertyObject

public class SpaceObject
extends SynchronizedPropertyObject
implements ISpaceObject

Default implementation of a space object.


Field Summary
protected  SimpleValueFetcher fetcher
          The fetcher.
protected  Object id
          The object's ID.
protected  AbstractEnvironmentSpace space
          The space.
protected  MultiCollection tasklisteners
          The task listeners.
protected  Map tasks
          The object's tasks.
protected  String typename
          The object's typename.
 
Fields inherited from class jadex.application.space.envsupport.environment.SynchronizedPropertyObject
monitor
 
Fields inherited from class jadex.commons.SimplePropertyObject
pcs, properties
 
Fields inherited from interface jadex.application.space.envsupport.environment.ISpaceObject
PROPERTY_OWNER
 
Constructor Summary
SpaceObject()
          Bean constructor.
SpaceObject(Object id, MObjectType type, Map properties, List tasks, Object monitor, AbstractEnvironmentSpace space)
          Creates a new EnvironmentObject.
 
Method Summary
 void addTask(IObjectTask task)
          Adds a new task for the object.
 void addTaskListener(Object taskid, IResultListener listener)
          Add a result listener to a task.
 void clearTasks()
          Removes all tasks from the object.
 Object getId()
          Get the objects id.
 Map getProperties()
          Bean accessor.
 Object getProperty(String name)
          Returns a property.
 IObjectTask getTask(Object id)
          Get a specific task.
 Collection getTasks()
          Returns all tasks of the object for introspection.
 String getType()
          Returns the type of the object.
 void removeTask(Object taskid, Exception e)
          Removes a task from the object.
 void removeTaskListener(Object taskid, IResultListener listener)
          Remove a result listener from a task.
 void setId(Object id)
          Set the id of the object.
 void setProperty(String name, Object value)
          Only for debugging.
 void setType(String type)
          Set the type of the object.
 String toString()
          Get the string representation.
 void updateObject(IEnvironmentSpace space, long progress, IClockService clock)
          Updates the object to the current time.
 
Methods inherited from class jadex.application.space.envsupport.environment.SynchronizedPropertyObject
addPropertyChangeListener, getMonitor, getPropertyNames, hasProperty, removePropertyChangeListener
 
Methods inherited from class jadex.commons.meta.TypedPropertyObject
getMetaData, getMetaDatas
 
Methods inherited from class jadex.commons.SimplePropertyObject
setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jadex.commons.meta.ITypedPropertyObject
getMetaData, getMetaDatas
 
Methods inherited from interface jadex.commons.IPropertyObject
getPropertyNames, hasProperty
 

Field Detail

id

protected Object id
The object's ID.


typename

protected String typename
The object's typename.


tasks

protected Map tasks
The object's tasks.


tasklisteners

protected MultiCollection tasklisteners
The task listeners.


fetcher

protected SimpleValueFetcher fetcher
The fetcher.


space

protected AbstractEnvironmentSpace space
The space.

Constructor Detail

SpaceObject

public SpaceObject(Object id,
                   MObjectType type,
                   Map properties,
                   List tasks,
                   Object monitor,
                   AbstractEnvironmentSpace space)
Creates a new EnvironmentObject.

Parameters:
objectId - the object's ID
typename - the object's type
properties - initial properties (may be null)
propertiesMeta - the meta data of the properties
tasks - initial task list (may be null)

SpaceObject

public SpaceObject()
Bean constructor.

Method Detail

getProperty

public Object getProperty(String name)
Returns a property.

Specified by:
getProperty in interface IPropertyObject
Overrides:
getProperty in class SynchronizedPropertyObject
Parameters:
name - name of the property
Returns:
the property

setProperty

public void setProperty(String name,
                        Object value)
Only for debugging.

Specified by:
setProperty in interface IPropertyObject
Overrides:
setProperty in class SynchronizedPropertyObject
Parameters:
name - name of the property
value - value of the property

getId

public Object getId()
Get the objects id.

Specified by:
getId in interface ISpaceObject
Returns:
The object id.

setId

public void setId(Object id)
Set the id of the object.


getType

public String getType()
Returns the type of the object.

Specified by:
getType in interface ISpaceObject
Returns:
the type

setType

public void setType(String type)
Set the type of the object.


addTask

public void addTask(IObjectTask task)
Adds a new task for the object.

Parameters:
task - new task

removeTask

public void removeTask(Object taskid,
                       Exception e)
Removes a task from the object.

Parameters:
task - The task.

getTasks

public Collection getTasks()
Returns all tasks of the object for introspection.

Returns:
all tasks of the object

getTask

public IObjectTask getTask(Object id)
Get a specific task.

Parameters:
id - The task id.
Returns:
The task.

clearTasks

public void clearTasks()
Removes all tasks from the object.


addTaskListener

public void addTaskListener(Object taskid,
                            IResultListener listener)
Add a result listener to a task. The result will be the task id. If the task is already finished, the listener will be notified.


removeTaskListener

public void removeTaskListener(Object taskid,
                               IResultListener listener)
Remove a result listener from a task.


updateObject

public void updateObject(IEnvironmentSpace space,
                         long progress,
                         IClockService clock)
Updates the object to the current time. time the current time

Parameters:
progress - The time that has passed according to the environment executor.
clock - The clock service.

getProperties

public Map getProperties()
Bean accessor. For serializing a space object, replace dynamic expressions with current values.

Overrides:
getProperties in class SimplePropertyObject

toString

public String toString()
Get the string representation.

Overrides:
toString in class Object
Returns:
The string representation.


Copyright © 2010. All Rights Reserved.