Package com.attivio.transport
Class DestinationQueue
- java.lang.Object
-
- com.attivio.transport.DestinationQueue
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<java.net.URI>
public class DestinationQueue extends java.lang.Object implements java.lang.Iterable<java.net.URI>, java.lang.Cloneable
WorkflowQueues model the message flow for their associated message.A queue has an ordered list of workflow names to execute as well as flags to indicate when and how that routing should occur.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_ROUTE_IMMEDIATELY
Default value for route immediately
-
Constructor Summary
Constructors Constructor Description DestinationQueue(boolean routeImmediately, java.net.URI... wfs)
Constructor.DestinationQueue(java.net.URI... wfs)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(java.net.URI... dests)
Adds an ordered list of workflows to the end of this queue.DestinationQueue
clone()
boolean
equals(java.lang.Object o)
Checks for equal based on routing flags and workflow names.java.net.URI
getFirst()
Gets but does not remove the first entry from the destination list.int
hashCode()
void
insert(java.net.URI dst, int position)
Adds the destinationdst
to the queue at the specifiedposition
.boolean
isRouteImmediately()
boolean
isSameEndpointOrder(DestinationQueue queue)
Determines if the passed in DestinationQueue has the same workflows in the same order as this.java.util.Iterator<java.net.URI>
iterator()
Gets an iterator that iterates over all the destinations in the queue.void
prepend(DestinationQueue wfq)
adds all the workflows inwfq
to the start of our queuevoid
prepend(java.net.URI dest)
Adds a new workflow to the start of this queue.boolean
remove(java.lang.String wf)
Removes the first occurrence a specific workflow from this queue.java.net.URI
removeFirst()
Gets and removes the first entry from the queue.void
setRouteImmediately(boolean routeImmediately)
Sets the 'route immediately' flag.int
size()
Gets the size of the queue.java.lang.String
toString()
A simple single line representation.
-
-
-
Field Detail
-
DEFAULT_ROUTE_IMMEDIATELY
public static final boolean DEFAULT_ROUTE_IMMEDIATELY
Default value for route immediately- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DestinationQueue
public DestinationQueue(java.net.URI... wfs)
Constructor. Creates a queue based on a given set of workflow names.- Parameters:
wfs
- the workflow names
-
DestinationQueue
public DestinationQueue(boolean routeImmediately, java.net.URI... wfs)
Constructor. Creates a queue based on a given set of workflow names.- Parameters:
routeImmediately
-wfs
- the workflow names
-
-
Method Detail
-
append
public void append(java.net.URI... dests)
Adds an ordered list of workflows to the end of this queue.Performs basic checking for null and empty string workflow names.
-
insert
public void insert(java.net.URI dst, int position)
Adds the destinationdst
to the queue at the specifiedposition
.- Parameters:
dst
-position
- where to insert thedst
. if invalid, thedst
is added at the end.
-
removeFirst
public java.net.URI removeFirst()
Gets and removes the first entry from the queue.- Returns:
- the first entry
-
prepend
public void prepend(java.net.URI dest)
Adds a new workflow to the start of this queue.- Parameters:
dest
- the workflow to add
-
remove
public boolean remove(java.lang.String wf) throws java.net.URISyntaxException
Removes the first occurrence a specific workflow from this queue.- Parameters:
wf
- the workflow to remove- Returns:
- true if successfully removed
- Throws:
java.net.URISyntaxException
-
getFirst
public java.net.URI getFirst()
Gets but does not remove the first entry from the destination list.- Returns:
- the first entry
-
iterator
public java.util.Iterator<java.net.URI> iterator()
Gets an iterator that iterates over all the destinations in the queue.- Specified by:
iterator
in interfacejava.lang.Iterable<java.net.URI>
- Returns:
- the iterator
-
size
public int size()
Gets the size of the queue.- Returns:
- the size
-
isRouteImmediately
public boolean isRouteImmediately()
-
setRouteImmediately
public void setRouteImmediately(boolean routeImmediately)
Sets the 'route immediately' flag.- Parameters:
routeImmediately
- the route immediately flag
-
equals
public boolean equals(java.lang.Object o)
Checks for equal based on routing flags and workflow names.- Overrides:
equals
in classjava.lang.Object
-
isSameEndpointOrder
public boolean isSameEndpointOrder(DestinationQueue queue)
Determines if the passed in DestinationQueue has the same workflows in the same order as this.- Parameters:
queue
- the workflow queue- Returns:
- true if the workflow queue has the same workflows in the same order
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
clone
public DestinationQueue clone()
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
A simple single line representation.- Overrides:
toString
in classjava.lang.Object
-
prepend
public void prepend(DestinationQueue wfq)
adds all the workflows inwfq
to the start of our queue- Parameters:
wfq
-
-
-