org.oddjob.beanbus.destinations
Class BeanQueue<E>

java.lang.Object
  extended by org.oddjob.beanbus.AbstractDestination<E>
      extended by org.oddjob.beanbus.destinations.BeanQueue<E>
Type Parameters:
E - The type of element on the queue.
All Implemented Interfaces:
Iterable<E>, Collection<E>, Stoppable

public class BeanQueue<E>
extends AbstractDestination<E>
implements Iterable<E>, Stoppable

Description

A Queue for beans. A work in progress.

Example

A simple example.
<oddjob>
    <job>
        <sequential>
            <jobs>
                <variables id="vars">
                    <queue>
                        <bean class="org.oddjob.beanbus.destinations.BeanQueue"/>
                    </queue>
                </variables>
                <parallel id="parallel">
                    <jobs>
                        <bean class="org.oddjob.beanbus.drivers.IterableBusDriver" id="producer" name="Producer">
                            <beans>
                                <list>
                                    <values>
                                        <value value="apple"/>
                                        <value value="orange"/>
                                        <value value="pear"/>
                                    </values>
                                </list>
                            </beans>
                            <to>
                                <value value="${vars.queue}"/>
                            </to>
                        </bean>
                        <bean class="org.oddjob.beanbus.drivers.IterableBusDriver" id="consumer" name="Consumer">
                            <beans>
                                <value value="${vars.queue}"/>
                            </beans>
                            <to>
                                <list/>
                            </to>
                        </bean>
                    </jobs>
                </parallel>
            </jobs>
        </sequential>
    </job>
</oddjob>

Example

An example in BeanBus.
<oddjob>
    <job>
        <parallel id="parallel">
            <jobs>
                <bean-bus>
                    <parts>
                        <bus:iterable-driver xmlns:bus="oddjob:beanbus">
                            <beans>
                                <list>
                                    <values>
                                        <value value="Apple"/>
                                        <value value="Orange"/>
                                        <value value="Banana"/>
                                        <value value="Pear"/>
                                        <value value="Kiwi"/>
                                    </values>
                                </list>
                            </beans>
                        </bus:iterable-driver>
                        <bus:bean-queue id="queue" xmlns:bus="oddjob:beanbus"/>
                    </parts>
                </bean-bus>
                <bean-bus>
                    <parts>
                        <bus:iterable-driver xmlns:bus="oddjob:beanbus">
                            <beans>
                                <value value="${queue}"/>
                            </beans>
                        </bus:iterable-driver>
                        <bus:bean-capture id="results" xmlns:bus="oddjob:beanbus"/>
                    </parts>
                </bean-bus>
            </jobs>
        </parallel>
    </job>
</oddjob>
Author:
rob

Constructor Summary
BeanQueue()
           
 
Method Summary
 boolean add(E bean)
           
 int getCapacity()
           
 String getName()
           
 int getSize()
           
 int getTaken()
           
 int getWaitingConusmers()
           
 void init()
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 void reset()
           
 void setBeanBus(BusConductor busConductor)
           
 void setCapacity(int capacity)
           
 void setName(String name)
           
 void stop()
          Stop executing.
 String toString()
           
 
Methods inherited from class org.oddjob.beanbus.AbstractDestination
addAll, clear, contains, containsAll, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

BeanQueue

public BeanQueue()
Method Detail

setBeanBus

@Inject
public void setBeanBus(BusConductor busConductor)

init

public void init()

reset

public void reset()

stop

public void stop()
Description copied from interface: Stoppable
Stop executing. This method should not return until the Stoppable has actually stopped.

Specified by:
stop in interface Stoppable

add

public boolean add(E bean)
Specified by:
add in interface Collection<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Overrides:
iterator in class AbstractDestination<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Overrides:
isEmpty in class AbstractDestination<E>

getSize

public int getSize()

getName

public String getName()

setName

public void setName(String name)

getTaken

public int getTaken()

getCapacity

public int getCapacity()

setCapacity

public void setCapacity(int capacity)

getWaitingConusmers

public int getWaitingConusmers()

toString

public String toString()
Overrides:
toString in class Object