org.datamanager.tools.kernelproxy
Class KernelProxy

java.lang.Object
  |
  +--org.datamanager.tools.kernelproxy.KernelProxy

public class KernelProxy
extends Object

KernelProxy serves as a wrapper around the functionality of the kernel.

Author:
Gordon Murphy gpmurphy@indiana.edu
, Bryan Dawson bdawson@indiana.edu
See Also:
Thread, Entity, EventConstraint

Field Summary
static String IGNORED_ENTITY
          Entities with this Attribute can be ignored by Interface.
 
Method Summary
 void addEntity(Entity entity)
          Adds an entity to the pool.
 void addEvent(DataManagerEvent event)
          Add a DataManagerEvent to the pool.
 void attachEntity(Entity base, Entity attribute)
          Attaches an Entity as an attribute to another Entity.
 Entity createAttribute(String name)
          Creates a new Entity with an attached entity specifying that it is to be ignored by the interface.
 Entity createEntity(String name)
          Creates a new Entity with the specified name.
 void detachEntity(Entity base, Entity attribute)
          Detaches an Entity as an attribute from another Entity.
 Entity[] getAttributes(Entity entity, EntityConstraint constraint)
          Retrieve all the attributes of an entity that match the given constraint.
 Entity[] getBases(Entity entity, EntityConstraint constraint)
          Retrieve all the bases of an entity that match the given constraint.
 String getEntityName(Entity entity)
          Searches for all Entities that match the given constraint.
 EntityValue getEntityValue(Entity entity)
          Sets the specified entity's value to the specified value.
 EventGenerator getEventGenerator()
          Gets an EventGenerator from the Pool.
 EntityConstraint getIgnoredByInterfaceConstraint()
          Gets the constraint for entities that are to ignored.
static KernelProxy getInstance()
          Gets the instance of the singleton KernelProxy.
 void removeEntity(Entity entity)
          Removes an entity from the pool.
 void setEntityValue(Entity entity, EntityValue value)
          Sets the specified entity's value to the specified value.
 void subscribeToEvent(Class event, EventHandler handler)
          Subscribe handler to the event whose Class is class.
 void subscribeToEvent(EventConstraint constraint, EventHandler handler)
          Subscribe handler to the event described by the constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IGNORED_ENTITY

public static final String IGNORED_ENTITY
Entities with this Attribute can be ignored by Interface.

See Also:
Constant Field Values
Method Detail

getInstance

public static KernelProxy getInstance()
Gets the instance of the singleton KernelProxy.


addEntity

public void addEntity(Entity entity)
Adds an entity to the pool.

Parameters:
entity - the entity to add.

removeEntity

public void removeEntity(Entity entity)
Removes an entity from the pool.

Parameters:
entity - the entity to remove.

getEntityName

public String getEntityName(Entity entity)
Searches for all Entities that match the given constraint.

Returns:
the results of the search

attachEntity

public void attachEntity(Entity base,
                         Entity attribute)
Attaches an Entity as an attribute to another Entity.

Parameters:
base - the base Entity to which the attribute will be attached
attribute - the attribute to attach

detachEntity

public void detachEntity(Entity base,
                         Entity attribute)
Detaches an Entity as an attribute from another Entity.

Parameters:
base - the base Entity to which the attribute will be detached
attribute - the attribute to detach

createEntity

public Entity createEntity(String name)
Creates a new Entity with the specified name.

Parameters:
name - the name of the new Entity
Returns:
the new Entity

createAttribute

public Entity createAttribute(String name)
Creates a new Entity with an attached entity specifying that it is to be ignored by the interface.

Parameters:
name - the name of the new Entity
Returns:
the new Entity

setEntityValue

public void setEntityValue(Entity entity,
                           EntityValue value)
Sets the specified entity's value to the specified value.

Parameters:
entity - the entity whose value will be changed
value - the value to be added

getEntityValue

public EntityValue getEntityValue(Entity entity)
Sets the specified entity's value to the specified value.

Parameters:
entity - the entity whose value will be changed

getBases

public Entity[] getBases(Entity entity,
                         EntityConstraint constraint)
Retrieve all the bases of an entity that match the given constraint.

Parameters:
entity - the entity to find the bases of
constraint - the constraint that the bases much match
Returns:
the bases that match the constraint

getAttributes

public Entity[] getAttributes(Entity entity,
                              EntityConstraint constraint)
Retrieve all the attributes of an entity that match the given constraint.

Parameters:
entity - the entity to find the attributes of
constraint - the constraint that the attributes much match
Returns:
the attributes that match the constraint

addEvent

public void addEvent(DataManagerEvent event)
Add a DataManagerEvent to the pool.

Parameters:
event - the event to add to the pool

subscribeToEvent

public void subscribeToEvent(EventConstraint constraint,
                             EventHandler handler)
Subscribe handler to the event described by the constraint.

Parameters:
constraint - the constraint describing the event
handler - the EventHandler to be called when an event happens

subscribeToEvent

public void subscribeToEvent(Class event,
                             EventHandler handler)
Subscribe handler to the event whose Class is class.

Parameters:
event - the Class class of the Event to be subscribe to.
handler - the EventHandler to be called when an event happens

getIgnoredByInterfaceConstraint

public EntityConstraint getIgnoredByInterfaceConstraint()
Gets the constraint for entities that are to ignored.


getEventGenerator

public EventGenerator getEventGenerator()
                                 throws DataManagerException
Gets an EventGenerator from the Pool.

DataManagerException


See the Helium Website