org.oddjob.framework
Class RunnableWrapper

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.BaseWrapper
          extended by org.oddjob.framework.RunnableWrapper
All Implemented Interfaces:
Serializable, Runnable, org.apache.commons.beanutils.DynaBean, ArooaContextAware, Forceable, ComponentWrapper, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable

public class RunnableWrapper
extends BaseWrapper
implements ComponentWrapper, Serializable, Forceable

Creates a proxy for any Runnable to allow it to be controlled and monitored within Oddjob.

See Also:
Serialized Form
Author:
Rob Gordon.

Field Summary
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
RunnableWrapper(Object wrapped, Object proxy)
          Constructor.
 
Method Summary
protected  void fireDestroyedState()
          Internal method to fire state.
 void force()
          Force the job to COMPLETE.
protected  org.apache.commons.beanutils.DynaBean getDynaBean()
           
protected  Object getProxy()
           
protected  JobStateChanger getStateChanger()
           
 Object getWrapped()
          Return the object that is being proxied.
 boolean hardReset()
          Perform a hard reset on the job.
 void onStop()
           
 void run()
           
 boolean softReset()
          Perform a soft reset on the job.
protected  JobStateHandler stateHandler()
           
 
Methods inherited from class org.oddjob.framework.BaseWrapper
configure, contains, equals, get, get, get, getDynaClass, getResult, interfacesFor, logger, loggerName, onDestroy, remove, save, set, set, set, stop, toString
 
Methods inherited from class org.oddjob.framework.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Constructor Detail

RunnableWrapper

public RunnableWrapper(Object wrapped,
                       Object proxy)
Constructor.

Method Detail

stateHandler

protected JobStateHandler stateHandler()
Specified by:
stateHandler in class BaseComponent

getStateChanger

protected JobStateChanger getStateChanger()

getWrapped

public Object getWrapped()
Description copied from class: BaseWrapper
Return the object that is being proxied.

Specified by:
getWrapped in class BaseWrapper
Returns:
The component being proxied.

getDynaBean

protected org.apache.commons.beanutils.DynaBean getDynaBean()
Specified by:
getDynaBean in class BaseWrapper
Returns:

getProxy

protected Object getProxy()
Specified by:
getProxy in class BaseWrapper

run

public void run()
Specified by:
run in interface Runnable

onStop

public void onStop()
            throws FailedToStopException
Overrides:
onStop in class BaseWrapper
Throws:
FailedToStopException

softReset

public boolean softReset()
Perform a soft reset on the job.

Specified by:
softReset in interface Resetable
Returns:
true if successful.

hardReset

public boolean hardReset()
Perform a hard reset on the job.

Specified by:
hardReset in interface Resetable
Returns:
true if successful.

force

public void force()
Force the job to COMPLETE.

Specified by:
force in interface Forceable

fireDestroyedState

protected void fireDestroyedState()
Internal method to fire state.

Specified by:
fireDestroyedState in class BaseComponent