Class ServiceOutputConnection
- java.lang.Object
-
- jadex.bridge.service.types.remote.ServiceOutputConnection
-
- All Implemented Interfaces:
IConnection
,IOutputConnection
public class ServiceOutputConnection extends java.lang.Object implements IOutputConnection
A service output connection can be used to write data to a remote input connection. For this purpose getInputConnection() has to be called and transferred to the remote side.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<byte[]>
buffer
The buffer.protected boolean
closed
The closed flag.protected IOutputConnection
con
The remote output connection.protected boolean
flushed
Flushed flag.protected Future<java.lang.Integer>
readyfuture
The ready future.protected ICommand
transfercommand
The transfer future.
-
Constructor Summary
Constructors Constructor Description ServiceOutputConnection()
Create a new connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the connection.void
flush()
Flush the data.int
getConnectionId()
Get the connection id.IComponentIdentifier
getInitiator()
Get the initiator.IInputConnection
getInputConnection()
java.util.Map<java.lang.String,java.lang.Object>
getNonFunctionalProperties()
Get the non-functional properties of the connection.IComponentIdentifier
getParticipant()
Get the participant.protected void
setOutputConnection(IOutputConnection ocon)
Set the real output connection to the other side.IFuture<java.lang.Integer>
waitForReady()
Wait until the connection is ready for the next write.IFuture<java.lang.Void>
write(byte[] data)
Write the content to the stream.ISubscriptionIntermediateFuture<java.lang.Long>
writeFromInputStream(java.io.InputStream is, IExternalAccess component)
Write all data from input stream to the connection.
-
-
-
Field Detail
-
con
protected IOutputConnection con
The remote output connection.
-
closed
protected boolean closed
The closed flag.
-
flushed
protected boolean flushed
Flushed flag.
-
buffer
protected java.util.List<byte[]> buffer
The buffer.
-
readyfuture
protected Future<java.lang.Integer> readyfuture
The ready future.
-
transfercommand
protected ICommand transfercommand
The transfer future.
-
-
Method Detail
-
write
public IFuture<java.lang.Void> write(byte[] data)
Write the content to the stream.- Specified by:
write
in interfaceIOutputConnection
- Parameters:
data
- The data.
-
flush
public void flush()
Flush the data.- Specified by:
flush
in interfaceIOutputConnection
-
waitForReady
public IFuture<java.lang.Integer> waitForReady()
Wait until the connection is ready for the next write.- Specified by:
waitForReady
in interfaceIOutputConnection
- Returns:
- Calls future when next data can be written.
-
close
public void close()
Close the connection.- Specified by:
close
in interfaceIConnection
-
getConnectionId
public int getConnectionId()
Description copied from interface:IConnection
Get the connection id.- Specified by:
getConnectionId
in interfaceIConnection
- Returns:
- The connection id.
-
getInitiator
public IComponentIdentifier getInitiator()
Description copied from interface:IConnection
Get the initiator.- Specified by:
getInitiator
in interfaceIConnection
- Returns:
- The initiator.
-
getParticipant
public IComponentIdentifier getParticipant()
Description copied from interface:IConnection
Get the participant.- Specified by:
getParticipant
in interfaceIConnection
- Returns:
- The participant.
-
getNonFunctionalProperties
public java.util.Map<java.lang.String,java.lang.Object> getNonFunctionalProperties()
Get the non-functional properties of the connection.- Specified by:
getNonFunctionalProperties
in interfaceIConnection
-
getInputConnection
public IInputConnection getInputConnection()
-
setOutputConnection
protected void setOutputConnection(IOutputConnection ocon)
Set the real output connection to the other side.
-
writeFromInputStream
public ISubscriptionIntermediateFuture<java.lang.Long> writeFromInputStream(java.io.InputStream is, IExternalAccess component)
Write all data from input stream to the connection. The result is an intermediate future that reports back the size that was written. It can also be used to terminate sending.- Specified by:
writeFromInputStream
in interfaceIOutputConnection
- Parameters:
is
- The input stream.agen
-
-
-