de.jiac.micro.internal.core
Class AbstractAgent

java.lang.Object
  extended by de.jiac.micro.internal.core.AbstractContainer
      extended by de.jiac.micro.internal.core.AbstractAgent
All Implemented Interfaces:
IAgent, IContainer, ILifecycleAware

public abstract class AbstractAgent
extends AbstractContainer
implements IAgent

Author:
Erdene-Ochir Tuguldur, Marcel Patzlaff

Nested Class Summary
protected static class AbstractAgent.ElementContext
           
 
Field Summary
protected  List installedElements
           
protected  Hashtable properties
           
 
Fields inherited from class de.jiac.micro.internal.core.AbstractContainer
handles
 
Constructor Summary
AbstractAgent()
           
 
Method Summary
 void addAgentElement(IAgentElement agentElement)
           
 void cleanup()
          This method is invoked once immediately before the current instance is disposed.
protected  void cleanupElement(AbstractAgent.ElementContext context)
           
 Object getProperty(String key)
          Obtains an agent property associated with the specified key.
protected abstract  IShortTermMemory getShortTermMemory()
           
 void initialise()
          This method is invoked after the current instance is fully configured.
protected  void initialiseElement(AbstractAgent.ElementContext context)
           
 void setProperty(String key, Object value)
          Associates a property key with the specified value.
 void start()
          Start routines like thread or schedulable activation should be done in this method.
protected  void startElement(AbstractAgent.ElementContext context)
           
 void stop()
          Implementations should ensure that all threads and schedulables of the current instance are stopped when this method returns.
protected  void stopElement(AbstractAgent.ElementContext context)
           
 
Methods inherited from class de.jiac.micro.internal.core.AbstractContainer
addHandle, getClassLoader, getDisplayName, getHandle, getLogger, getLogger, removeHandle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.jiac.micro.core.IContainer
addHandle, getClassLoader, getHandle, getLogger, getLogger, removeHandle
 

Field Detail

installedElements

protected List installedElements

properties

protected Hashtable properties
Constructor Detail

AbstractAgent

public AbstractAgent()
Method Detail

getProperty

public final Object getProperty(String key)
Description copied from interface: IAgent
Obtains an agent property associated with the specified key.

Specified by:
getProperty in interface IAgent
Parameters:
key - the key for the property (= property name)
Returns:
the value of the property or null if not set

setProperty

public final void setProperty(String key,
                              Object value)
Description copied from interface: IAgent
Associates a property key with the specified value.

If value is null then this method just removes the property.

Specified by:
setProperty in interface IAgent
Parameters:
key - the key for the property (= property name)
value - the value for the property or null if the property should be removed

initialise

public void initialise()
Description copied from interface: ILifecycleAware
This method is invoked after the current instance is fully configured. It is safe to acquire system resources or handles here. Nevertheless container handles should not be acquired here because the associated handle provider is most likely not intialised yet.

If the current instance is also a handle provider, the handle must be available after this method completes!

Specified by:
initialise in interface ILifecycleAware
Specified by:
initialise in class AbstractContainer

start

public void start()
Description copied from interface: ILifecycleAware
Start routines like thread or schedulable activation should be done in this method. It is safe to acquire container handles in this method because each component of the container is fully initialised!

Specified by:
start in interface ILifecycleAware
Specified by:
start in class AbstractContainer

stop

public void stop()
Description copied from interface: ILifecycleAware
Implementations should ensure that all threads and schedulables of the current instance are stopped when this method returns.

Specified by:
stop in interface ILifecycleAware
Specified by:
stop in class AbstractContainer

cleanup

public void cleanup()
Description copied from interface: ILifecycleAware
This method is invoked once immediately before the current instance is disposed. Implementers have to ensure that every resource that was obtained during the call of ILifecycleAware.initialise() is released!

Specified by:
cleanup in interface ILifecycleAware
Specified by:
cleanup in class AbstractContainer

addAgentElement

public void addAgentElement(IAgentElement agentElement)

initialiseElement

protected void initialiseElement(AbstractAgent.ElementContext context)

startElement

protected void startElement(AbstractAgent.ElementContext context)

stopElement

protected void stopElement(AbstractAgent.ElementContext context)

cleanupElement

protected void cleanupElement(AbstractAgent.ElementContext context)

getShortTermMemory

protected abstract IShortTermMemory getShortTermMemory()


Copyright © 2008-2011 DAI-Labor. All Rights Reserved.