org.picocontainer.lifecycle
Class StartableLifecycleStrategy

java.lang.Object
  extended by org.picocontainer.lifecycle.AbstractMonitoringLifecycleStrategy
      extended by org.picocontainer.lifecycle.StartableLifecycleStrategy
All Implemented Interfaces:
Serializable, ComponentMonitorStrategy, LifecycleStrategy

public class StartableLifecycleStrategy
extends AbstractMonitoringLifecycleStrategy

Startable lifecycle strategy. Starts and stops component if Startable, and disposes it if Disposable. A subclass of this class can define other intrfaces for Startable/Disposable as well as other method names for start/stop/dispose

Author:
Mauro Talevi, Jörg Schaible
See Also:
Startable, Disposable, Serialized Form

Constructor Summary
StartableLifecycleStrategy(ComponentMonitor monitor)
           
 
Method Summary
 void dispose(Object component)
          Invoke the "dispose" method on the component instance if this is disposable.
protected  void disposeComponent(Object component)
           
protected  Class<Disposable> getDisposableInterface()
           
protected  String getDisposeMethodName()
           
protected  Class getStartableInterface()
           
protected  String getStartMethodName()
           
protected  String getStopMethodName()
           
 boolean hasLifecycle(Class type)
          Test if a component instance has a lifecycle.
 void start(Object component)
          Invoke the "start" method on the component instance if this is startable.
protected  void startComponent(Object component)
           
 void stop(Object component)
          Invoke the "stop" method on the component instance if this is stoppable.
protected  void stopComponent(Object component)
           
 
Methods inherited from class org.picocontainer.lifecycle.AbstractMonitoringLifecycleStrategy
changeMonitor, currentMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StartableLifecycleStrategy

public StartableLifecycleStrategy(ComponentMonitor monitor)
Method Detail

getDisposeMethodName

protected String getDisposeMethodName()

getStopMethodName

protected String getStopMethodName()

getStartMethodName

protected String getStartMethodName()

start

public void start(Object component)
Description copied from interface: LifecycleStrategy
Invoke the "start" method on the component instance if this is startable. It is up to the implementation of the strategy what "start" and "startable" means.

Parameters:
component - the instance of the component to start

startComponent

protected void startComponent(Object component)

stopComponent

protected void stopComponent(Object component)

disposeComponent

protected void disposeComponent(Object component)

stop

public void stop(Object component)
Description copied from interface: LifecycleStrategy
Invoke the "stop" method on the component instance if this is stoppable. It is up to the implementation of the strategy what "stop" and "stoppable" means.

Parameters:
component - the instance of the component to stop

dispose

public void dispose(Object component)
Description copied from interface: LifecycleStrategy
Invoke the "dispose" method on the component instance if this is disposable. It is up to the implementation of the strategy what "dispose" and "disposable" means.

Parameters:
component - the instance of the component to dispose

hasLifecycle

public boolean hasLifecycle(Class type)
Description copied from interface: LifecycleStrategy
Test if a component instance has a lifecycle.

Parameters:
type - the component's type
Returns:
true if the component has a lifecycle

getDisposableInterface

protected Class<Disposable> getDisposableInterface()

getStartableInterface

protected Class getStartableInterface()


Copyright © 2003-2007 Codehaus. All Rights Reserved.