Package jadex.bridge.component.streams
Class AbstractConnection
- java.lang.Object
-
- jadex.bridge.component.streams.AbstractConnection
-
- All Implemented Interfaces:
IConnection
- Direct Known Subclasses:
InputConnection,OutputConnection
public abstract class AbstractConnection extends java.lang.Object implements IConnection
Abstract base class for connections. Connection code is called from connection users, i.e. active components, on their on thread. Calls from the connection handler occur on another thread so that these calls must be synchronized.
-
-
Field Summary
Fields Modifier and Type Field Description protected IAbstractConnectionHandlerchThe abstract connection handler.protected booleanclosedprotected booleanclosingprotected intidThe connection id.protected booleaniniThe initiator flag.protected booleaninitedBoolean flag if connection is inited, closing, closed.protected IComponentIdentifierinitiatorThe connection initiator.protected booleaninputThe input flag.protected IComponentIdentifierparticipantThe participant.
-
Constructor Summary
Constructors Constructor Description AbstractConnection(IComponentIdentifier sender, IComponentIdentifier receiver, int id, boolean input, boolean initiator, IAbstractConnectionHandler ch)Create a new input connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the connection.IAbstractConnectionHandlergetConnectionHandler()Get the connection handler.intgetConnectionId()Get the id.IComponentIdentifiergetInitiator()Get the initiator.java.util.Map<java.lang.String,java.lang.Object>getNonFunctionalProperties()Get the non-functional properties of the connection.IComponentIdentifiergetParticipant()Get the participant.booleanisClosed()Get the closed.booleanisClosing()Get the closed.booleanisInited()Get the inited.booleanisInitiatorSide()Test if this connection is the initiator side.booleanisInputConnection()Test if this connection is an input connection.voidsetClosed()Set the connection to closed.voidsetClosing()Set the connection to closed.voidsetInited()Set the inited.
-
-
-
Field Detail
-
inited
protected boolean inited
Boolean flag if connection is inited, closing, closed.
-
closed
protected boolean closed
-
closing
protected boolean closing
-
id
protected int id
The connection id.
-
initiator
protected IComponentIdentifier initiator
The connection initiator.
-
participant
protected IComponentIdentifier participant
The participant.
-
input
protected boolean input
The input flag.
-
ini
protected boolean ini
The initiator flag.
-
ch
protected IAbstractConnectionHandler ch
The abstract connection handler.
-
-
Constructor Detail
-
AbstractConnection
public AbstractConnection(IComponentIdentifier sender, IComponentIdentifier receiver, int id, boolean input, boolean initiator, IAbstractConnectionHandler ch)
Create a new input connection.
-
-
Method Detail
-
getConnectionId
public int getConnectionId()
Get the id.- Specified by:
getConnectionIdin interfaceIConnection- Returns:
- the id.
-
getInitiator
public IComponentIdentifier getInitiator()
Get the initiator.- Specified by:
getInitiatorin interfaceIConnection- Returns:
- The initiator.
-
getParticipant
public IComponentIdentifier getParticipant()
Get the participant.- Specified by:
getParticipantin interfaceIConnection- Returns:
- The participant.
-
isInited
public boolean isInited()
Get the inited.- Returns:
- the inited.
-
setInited
public void setInited()
Set the inited.- Parameters:
inited- The inited to set.
-
setClosing
public void setClosing()
Set the connection to closed.
-
setClosed
public void setClosed()
Set the connection to closed.
-
isClosing
public boolean isClosing()
Get the closed.- Returns:
- The closed.
-
isClosed
public boolean isClosed()
Get the closed.- Returns:
- The closed.
-
close
public void close()
Close the connection. Notifies the other side that the connection has been closed.- Specified by:
closein interfaceIConnection
-
isInitiatorSide
public boolean isInitiatorSide()
Test if this connection is the initiator side.- Returns:
- True if is initiator.
-
isInputConnection
public boolean isInputConnection()
Test if this connection is an input connection.- Returns:
- True if is initiator.
-
getNonFunctionalProperties
public java.util.Map<java.lang.String,java.lang.Object> getNonFunctionalProperties()
Get the non-functional properties of the connection.- Specified by:
getNonFunctionalPropertiesin interfaceIConnection
-
getConnectionHandler
public IAbstractConnectionHandler getConnectionHandler()
Get the connection handler.
-
-