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 IAbstractConnectionHandler
ch
The abstract connection handler.protected boolean
closed
protected boolean
closing
protected int
id
The connection id.protected boolean
ini
The initiator flag.protected boolean
inited
Boolean flag if connection is inited, closing, closed.protected IComponentIdentifier
initiator
The connection initiator.protected boolean
input
The input flag.protected IComponentIdentifier
participant
The 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 void
close()
Close the connection.IAbstractConnectionHandler
getConnectionHandler()
Get the connection handler.int
getConnectionId()
Get the id.IComponentIdentifier
getInitiator()
Get the initiator.java.util.Map<java.lang.String,java.lang.Object>
getNonFunctionalProperties()
Get the non-functional properties of the connection.IComponentIdentifier
getParticipant()
Get the participant.boolean
isClosed()
Get the closed.boolean
isClosing()
Get the closed.boolean
isInited()
Get the inited.boolean
isInitiatorSide()
Test if this connection is the initiator side.boolean
isInputConnection()
Test if this connection is an input connection.void
setClosed()
Set the connection to closed.void
setClosing()
Set the connection to closed.void
setInited()
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:
getConnectionId
in interfaceIConnection
- Returns:
- the id.
-
getInitiator
public IComponentIdentifier getInitiator()
Get the initiator.- Specified by:
getInitiator
in interfaceIConnection
- Returns:
- The initiator.
-
getParticipant
public IComponentIdentifier getParticipant()
Get the participant.- Specified by:
getParticipant
in 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:
close
in 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:
getNonFunctionalProperties
in interfaceIConnection
-
getConnectionHandler
public IAbstractConnectionHandler getConnectionHandler()
Get the connection handler.
-
-