public class StreamInputNode extends Node
A Node
that takes InputStream
s from the client side and makes them available on
the server. The underlying transport mechanism is made transparent due to this class.
The sequence of this node has four phases:
Stream
s to the server via
complete()
must be called to indicate that no more
Stream
s will followAs this node is a data source it must not have a predecessor.
Node.Cardinality
Constructor and Description |
---|
StreamInputNode() |
Modifier and Type | Method and Description |
---|---|
void |
addStream(InputStream is)
Transmit an
InputStream (but no meta data about it) to the server. |
void |
addStream(InputStream is,
StreamDescriptor sd)
Transmit an
InputStream and meta data about it to the server. |
void |
addStream(Stream stream)
Transmit a
Stream to the server. |
void |
complete()
After all
Stream s were initiated to be sent to the server, this method must be called. |
OutputStream |
createOutputStream()
Creates an
OutputStream . |
OutputStream |
createOutputStream(StreamDescriptor sd)
Creates an
OutputStream . |
Node.Cardinality |
getInputCardinality()
Return the input cardinality of this node, i.e.
|
StreamBundle |
getStreamBundle()
Get the
Stream s that the client has sent. |
String |
getWorkerClassName()
Return the node's associated
NodeWorker full qualified class's
name. |
protected void |
initialize(CommunicationSide side) |
addTransportReceiver, appendSuccessor, apply, equals, getJob, getOutputCardinality, getPredecessors, getSubsidiaryNodes, getSuccessors, getTransportSender, getUUID, hashCode, prependPredecessor, remove, validateConfiguration
public String getWorkerClassName()
Node
Return the node's associated
NodeWorker
full qualified class's
name. By default, the worker class name is
This behavior can be overridden in concrete subclasses.
getWorkerClassName
in class Node
public void addStream(InputStream is, StreamDescriptor sd) throws IOException
Transmit an InputStream
and meta data about it to the server.
Must not be called before the underlying job was successfully submitted.
is
- An InputStream
sd
- The InputStream
's meta dataIOException
- If the stream can't be sent.addStream(Stream)
public void addStream(Stream stream) throws IOException
Transmit a Stream
to the server.
Must not be called before the underlying job was successfully submitted.
stream
- A Stream
IOException
- If the stream can't be sent.public void addStream(InputStream is) throws IOException
Transmit an InputStream
(but no meta data about it) to the server.
Must not be called before the underlying job was successfully submitted.
is
- An InputStream
IOException
- If the stream can't be sent.addStream(InputStream, StreamDescriptor)
,
addStream(Stream)
public OutputStream createOutputStream(StreamDescriptor sd) throws IOException
Creates an OutputStream
. Data written herein will be directly transfered to the server.
As each call on thewrite
methods of OutputStream
will result in at least
one message between client and server, it's preferable to write in larger chunks.
Must not be called before the underlying job was successfully submitted.
sd
- The OutputStream
's meta dataIOException
- If the stream can't be sent.public OutputStream createOutputStream() throws IOException
Creates an OutputStream
. Data written herein will be directly transfered to the server.
As each call on thewrite
methods of OutputStream
will result in at least
one message between client and server, it's preferable to write in larger chunks.
Must not be called before the underlying job was successfully submitted.
IOException
- If the stream can't be sent.createOutputStream(StreamDescriptor)
public void complete() throws IOException
After all Stream
s were initiated to be sent to the server, this method must be called.
So, the server knows that no more Stream
s will follow.
Thereafter, calling the methods
will cause an error.IOException
- If the "End-of-Streams" signal cannot be sent.public StreamBundle getStreamBundle()
Stream
s that the client has sent. To be used on the server side only...!Stream
s sent by the clientprotected void initialize(CommunicationSide side)
initialize
in class Node
public Node.Cardinality getInputCardinality()
Node
getInputCardinality
in class Node
Copyright © 2017 levigo holding gmbh. All rights reserved.