org.eclipse.jetty.util.component
Class AggregateLifeCycle

java.lang.Object
  extended by org.eclipse.jetty.util.component.AbstractLifeCycle
      extended by org.eclipse.jetty.util.component.AggregateLifeCycle
All Implemented Interfaces:
Destroyable, Dumpable, LifeCycle
Direct Known Subclasses:
AbstractHandler, DeploymentManager, TemplateContext

public class AggregateLifeCycle
extends AbstractLifeCycle
implements Destroyable, Dumpable

An AggregateLifeCycle is an AbstractLifeCycle with a collection of dependent beans.

Dependent beans are started and stopped with the LifeCycle and if they are destroyed if they are also Destroyable.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
 
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
 
Field Summary
 
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
Constructor Summary
AggregateLifeCycle()
           
 
Method Summary
 boolean addBean(Object o)
          Add an associated bean.
 void destroy()
           
protected  void doStart()
           
protected  void doStop()
           
 String dump()
           
 void dump(Appendable out)
           
 void dump(Appendable out, String indent)
           
static void dump(Appendable out, String indent, Collection<?>... collections)
           
static String dump(Dumpable dumpable)
           
 void dumpStdErr()
           
protected  void dumpThis(Appendable out)
           
<T> T
getBean(Class<T> clazz)
          Get dependent bean of a specific class.
 Collection<Object> getBeans()
          Get dependent beans
<T> List<T>
getBeans(Class<T> clazz)
          Get dependent beans of a specific class
 boolean removeBean(Object o)
          Remove an associated bean.
 void removeBeans()
          Remove all associated bean.
 
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateLifeCycle

public AggregateLifeCycle()
Method Detail

destroy

public void destroy()
Specified by:
destroy in interface Destroyable

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class AbstractLifeCycle
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class AbstractLifeCycle
Throws:
Exception

addBean

public boolean addBean(Object o)
Add an associated bean. The bean will be added to this LifeCycle and if it is also a LifeCycle instance, it will be started/stopped. Any beans that are also Destroyable, will be destroyed with the server.

Parameters:
o - the bean object to add

getBeans

public Collection<Object> getBeans()
Get dependent beans

Returns:
List of beans.

getBeans

public <T> List<T> getBeans(Class<T> clazz)
Get dependent beans of a specific class

Parameters:
clazz -
Returns:
List of beans.
See Also:
addBean(Object)

getBean

public <T> T getBean(Class<T> clazz)
Get dependent bean of a specific class. If more than one bean of the type exist, the first is returned.

Parameters:
clazz -
Returns:
bean or null
See Also:
addBean(Object)

removeBeans

public void removeBeans()
Remove all associated bean.


removeBean

public boolean removeBean(Object o)
Remove an associated bean.


dumpStdErr

public void dumpStdErr()

dump

public String dump()
Specified by:
dump in interface Dumpable

dump

public static String dump(Dumpable dumpable)

dump

public void dump(Appendable out)
          throws IOException
Throws:
IOException

dumpThis

protected void dumpThis(Appendable out)
                 throws IOException
Throws:
IOException

dump

public void dump(Appendable out,
                 String indent)
          throws IOException
Specified by:
dump in interface Dumpable
Throws:
IOException

dump

public static void dump(Appendable out,
                        String indent,
                        Collection<?>... collections)
                 throws IOException
Throws:
IOException


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.