org.oddjob.framework
Class ServiceWrapper

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

public class ServiceWrapper
extends BaseWrapper
implements ComponentWrapper

Wraps a Service object and adds state to it.

Author:
Rob Gordon.

Field Summary
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
ServiceWrapper(ServiceAdaptor service, Object proxy)
           
 
Method Summary
protected  void fireDestroyedState()
          Internal method to fire state.
protected  org.apache.commons.beanutils.DynaBean getDynaBean()
          Sub classes must provide a dyna bean for properties.
protected  Object getProxy()
          Subclass must provide the proxy.
protected  ServiceStateChanger getStateChanger()
           
 Object getWrapped()
          Return the object that is being proxied.
 boolean hardReset()
          Perform a hard reset on the job.
 void onStop()
           
 void run()
           
protected  void save(Object compoonent)
          Save this job.
 boolean softReset()
          Perform a soft reset on the job.
protected  ServiceStateHandler stateHandler()
           
 
Methods inherited from class org.oddjob.framework.BaseWrapper
configure, contains, describe, 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, 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

ServiceWrapper

public ServiceWrapper(ServiceAdaptor service,
                      Object proxy)
Method Detail

stateHandler

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

getStateChanger

protected ServiceStateChanger 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()
Description copied from class: BaseWrapper
Sub classes must provide a dyna bean for properties.

Specified by:
getDynaBean in class BaseWrapper
Returns:

getProxy

protected Object getProxy()
Description copied from class: BaseWrapper
Subclass must provide the proxy.

Specified by:
getProxy in class BaseWrapper
Returns:

save

protected void save(Object compoonent)
Description copied from class: BaseComponent
Save this job. If there is no runtime for this component then true is returned.

Overrides:
save in class BaseComponent

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.

fireDestroyedState

protected void fireDestroyedState()
Internal method to fire state.

Specified by:
fireDestroyedState in class BaseComponent