Package com.levigo.jadice.server.nodes
Class StreamOutputNode
- java.lang.Object
-
- com.levigo.jadice.server.internal.NodeInternal
-
- com.levigo.jadice.server.Node
-
- com.levigo.jadice.server.nodes.StreamOutputNode
-
public class StreamOutputNode extends Node
ANode
for making the resultStream
s available on the client side. Clients have two options for accessing the streams:- active/synchronous
- The client must retrieve a
StreamBundle
via the methodgetStreamBundle()
and iterate over itsStream
s. This is similar to how jadice server works internally. - passive/asynchronous
- The client must add any number of
StreamListener
s. Those listeners are notified upon arrival of a newStream
.
The underlying transport mechanism is made transparent due to this class.
As this node is a data sink it must not have a successor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.levigo.jadice.server.Node
Node.Cardinality
-
-
Constructor Summary
Constructors Constructor Description StreamOutputNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStreamResultListener(StreamListener listener)
Adds a listener to this node.Node.Cardinality
getOutputCardinality()
Return the output cardinality of this node, i.e.StreamBundle
getStreamBundle()
String
getWorkerClassName()
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name.protected void
initialize(CommunicationSide side)
void
removeStreamResultListener(StreamListener listener)
Removes a listener from this node.-
Methods inherited from class com.levigo.jadice.server.Node
addTransportReceiver, appendSuccessor, apply, equals, getInputCardinality, getJob, getPredecessors, getSubsidiaryNodes, getSuccessors, getTransportSender, getUUID, hashCode, prependPredecessor, remove, validateConfiguration
-
-
-
-
Method Detail
-
addStreamResultListener
public void addStreamResultListener(StreamListener listener)
Adds a listener to this node.- Parameters:
listener
- This listener will be notified if a newStream
is available or if no more will follow.
-
getWorkerClassName
public String getWorkerClassName()
Description copied from class:Node
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name. By default, the worker class name is- The same as the node name with the trailing "Node" replaced by "Worker" if the node name ends in "Node"
- The node class name with an appended "Worker" otherwise.
This behavior can be overridden in concrete subclasses.
- Overrides:
getWorkerClassName
in classNode
- Returns:
- the full qualified class name of the worker of this node.
-
removeStreamResultListener
public void removeStreamResultListener(StreamListener listener)
Removes a listener from this node.- Parameters:
listener
- This listener will no longer receive events- See Also:
addStreamResultListener(StreamListener)
-
getStreamBundle
public StreamBundle getStreamBundle()
- Returns:
- A
StreamBundle
that contains theStream
s the server sends.
-
initialize
protected void initialize(CommunicationSide side)
- Overrides:
initialize
in classNode
-
getOutputCardinality
public Node.Cardinality getOutputCardinality()
Description copied from class:Node
Return the output cardinality of this node, i.e. how many bundles (not streams!) it expects to produce. By default, nodes are "pipe-style", i.e. one input, one output.- Overrides:
getOutputCardinality
in classNode
- Returns:
- output cardinality
-
-