de.jiac.micro.internal.core
Class AbstractContainer

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

public abstract class AbstractContainer
extends Object
implements IContainer, ILifecycleAware

Author:
Erdene-Ochir Tuguldur, Marcel Patzlaff

Field Summary
protected  List handles
           
 
Constructor Summary
protected AbstractContainer()
           
 
Method Summary
 void addHandle(IHandle handle)
           
abstract  void cleanup()
          This method is invoked once immediately before the current instance is disposed.
 com.github.libxjava.lang.IClassLoader getClassLoader()
           
protected  String getDisplayName()
           
 IHandle getHandle(Class handleClass)
           
 org.slf4j.Logger getLogger()
          Same as IContainer.getLogger(String) with argument null
 org.slf4j.Logger getLogger(String name)
           
abstract  void initialise()
          This method is invoked after the current instance is fully configured.
 void removeHandle(IHandle handle)
           
abstract  void start()
          Start routines like thread or schedulable activation should be done in this method.
abstract  void stop()
          Implementations should ensure that all threads and schedulables of the current instance are stopped when this method returns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handles

protected final List handles
Constructor Detail

AbstractContainer

protected AbstractContainer()
Method Detail

getHandle

public final IHandle getHandle(Class handleClass)
Specified by:
getHandle in interface IContainer

addHandle

public final void addHandle(IHandle handle)
Specified by:
addHandle in interface IContainer

removeHandle

public final void removeHandle(IHandle handle)
Specified by:
removeHandle in interface IContainer

getLogger

public final org.slf4j.Logger getLogger()
Description copied from interface: IContainer
Same as IContainer.getLogger(String) with argument null

Specified by:
getLogger in interface IContainer

getLogger

public final org.slf4j.Logger getLogger(String name)
Specified by:
getLogger in interface IContainer

getClassLoader

public final com.github.libxjava.lang.IClassLoader getClassLoader()
Specified by:
getClassLoader in interface IContainer

cleanup

public abstract 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

initialise

public abstract 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

start

public abstract 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

stop

public abstract 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

getDisplayName

protected final String getDisplayName()


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