public class BasicBusService extends StructuralJob<java.lang.Object> implements ConductorServiceProvider, java.util.function.Consumer<java.lang.Object>, java.io.Flushable
Consumer either by
being an Outbound or by marking a setter with the Destination
annotation. Components accept data by being a Consumer. Components
can be both.
This component parent provides the following features over other component parents
such as SequentialJob:
Consumer will appear in the bus as a service with
appropriate icons and state.AutoCloseable then
one will be set automatically allowing the component to stop the bus.Flushable then
one will be set automatically allowing the component to flush the bus.Flushable will be flushed when a
component flushes the bus. Flush will be called in component order.
Flush will always be called when the bus stops, unless it crashes.BusConductor and one will be set automatically
<oddjob>
<job>
<bus:bus id="bean-bus" xmlns:bus="oddjob:beanbus">
<of>
<bus:driver>
<values>
<list>
<values>
<bean class="org.oddjob.beanbus.example.Fruit" quantity="42" type="Apple" price="25.5"/>
<bean class="org.oddjob.beanbus.example.Fruit" quantity="24" type="Banana" price="36.2"/>
<bean class="org.oddjob.beanbus.example.Fruit" quantity="15" type="Pear" price="40.4"/>
</values>
</list>
</values>
</bus:driver>
<bus:map>
<function>
<bean class="org.oddjob.beanbus.example.DoublePrice"/>
</function>
</bus:map>
<bus:collect id="results"/>
</of>
</bus:bus>
</job>
</oddjob>
childHelper, destroy, stop, structuralState| Constructor and Description |
|---|
BasicBusService()
Only constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(java.lang.Object bean) |
protected void |
execute()
Execute this job.
|
void |
flush() |
BusConductor |
getBusConductor() |
protected StateOperator |
getInitialStateOp()
Subclasses must provide the
StateOperator that will decide
how to evaluate the children's state. |
ConductorService |
getServices()
Provider the services.
|
java.util.function.Consumer<java.lang.Object> |
getTo() |
boolean |
isNoAutoLink() |
protected void |
maybeSetConsumerOnOutbound(java.lang.Object maybeOutbound,
java.util.function.Consumer<?> consumer) |
protected void |
onReset()
Allow sub classes to do something on reset.
|
protected void |
onStop()
Allow sub classes to do something on stop.
|
void |
setBusConductor(BusConductor busConductor) |
void |
setNoAutoLink(boolean noAutoLink) |
void |
setOf(int index,
java.lang.Object child)
Add a child.
|
void |
setTo(java.util.function.Consumer<java.lang.Object> to) |
addStructuralListener, fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, onHardReset, onSoftReset, postStop, removeStructuralListener, run, softReset, startChildStateReflector, stateHandler, stop, stopChildStateReflector, waitForChildrenOnStopconfigure, getName, logger, logger, loggerName, save, setName, toStringaddIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSessionclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddStateListener, lastStateEvent, removeStateListenerprotected StateOperator getInitialStateOp()
StructuralJobStateOperator that will decide
how to evaluate the children's state.getInitialStateOp in class StructuralJob<java.lang.Object>public void setOf(int index,
java.lang.Object child)
Property: of
Description: The components of a Bus.
Required: No, but pointless if missing.
child - A childprotected void execute()
throws java.lang.Exception
StructuralJobexecute in class StructuralJob<java.lang.Object>java.lang.Exception - If the unexpected occurs.protected void maybeSetConsumerOnOutbound(java.lang.Object maybeOutbound,
java.util.function.Consumer<?> consumer)
public void accept(java.lang.Object bean)
accept in interface java.util.function.Consumer<java.lang.Object>protected void onReset()
StructuralJobonReset in class StructuralJob<java.lang.Object>protected void onStop()
throws FailedToStopException
StructuralJobonStop in class StructuralJob<java.lang.Object>FailedToStopExceptionpublic void flush()
flush in interface java.io.Flushablepublic ConductorService getServices()
ServiceProvidergetServices in interface ServiceProvidergetServices in interface ConductorServiceProviderProperty: services
Description: Provides services to other components of a bus. Exposed for advance use only.
Required: Read Only.
public BusConductor getBusConductor()
public void setBusConductor(BusConductor busConductor)
public boolean isNoAutoLink()
public void setNoAutoLink(boolean noAutoLink)
public java.util.function.Consumer<java.lang.Object> getTo()
public void setTo(java.util.function.Consumer<java.lang.Object> to)