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[]>bufferThe buffer.protected booleanclosedThe closed flag.protected IOutputConnectionconThe remote output connection.protected booleanflushedFlushed flag.protected Future<java.lang.Integer>readyfutureThe ready future.protected ICommandtransfercommandThe 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 voidclose()Close the connection.voidflush()Flush the data.intgetConnectionId()Get the connection id.IComponentIdentifiergetInitiator()Get the initiator.IInputConnectiongetInputConnection()java.util.Map<java.lang.String,java.lang.Object>getNonFunctionalProperties()Get the non-functional properties of the connection.IComponentIdentifiergetParticipant()Get the participant.protected voidsetOutputConnection(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:
writein interfaceIOutputConnection- Parameters:
data- The data.
-
flush
public void flush()
Flush the data.- Specified by:
flushin interfaceIOutputConnection
-
waitForReady
public IFuture<java.lang.Integer> waitForReady()
Wait until the connection is ready for the next write.- Specified by:
waitForReadyin interfaceIOutputConnection- Returns:
- Calls future when next data can be written.
-
close
public void close()
Close the connection.- Specified by:
closein interfaceIConnection
-
getConnectionId
public int getConnectionId()
Description copied from interface:IConnectionGet the connection id.- Specified by:
getConnectionIdin interfaceIConnection- Returns:
- The connection id.
-
getInitiator
public IComponentIdentifier getInitiator()
Description copied from interface:IConnectionGet the initiator.- Specified by:
getInitiatorin interfaceIConnection- Returns:
- The initiator.
-
getParticipant
public IComponentIdentifier getParticipant()
Description copied from interface:IConnectionGet the participant.- Specified by:
getParticipantin 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:
getNonFunctionalPropertiesin 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:
writeFromInputStreamin interfaceIOutputConnection- Parameters:
is- The input stream.agen-
-
-