org.apache.qpid.proton.engine
Interface Link

All Superinterfaces:
Endpoint
All Known Subinterfaces:
Receiver, Sender

public interface Link
extends Endpoint

Link The settlement mode defaults are: Sender settle mode - SenderSettleMode.MIXED. Receiver settle mode - ReceiverSettleMode.FIRST TODO describe the application's responsibility to honour settlement.


Method Summary
 boolean advance()
          Attempts to advance the current delivery.
 Delivery current()
          Returns the current delivery
 Delivery delivery(byte[] tag)
          Create a delivery object based on the specified tag and adds it to the this link's delivery list and its connection work list.
 Delivery delivery(byte[] tag, int offset, int length)
          Create a delivery object based on the specified tag.
 int getCredit()
           
 java.lang.String getName()
          Returns the name of the link
 int getQueued()
           
 ReceiverSettleMode getReceiverSettleMode()
           
 ReceiverSettleMode getRemoteReceiverSettleMode()
           
 SenderSettleMode getRemoteSenderSettleMode()
           
 Source getRemoteSource()
           
 Target getRemoteTarget()
           
 SenderSettleMode getSenderSettleMode()
           
 Session getSession()
           
 Source getSource()
           
 Target getTarget()
           
 int getUnsettled()
           
 Link next(java.util.EnumSet<EndpointState> local, java.util.EnumSet<EndpointState> remote)
           
 void setReceiverSettleMode(ReceiverSettleMode receiverSettleMode)
          Sets the receiver settle mode.
 void setRemoteSenderSettleMode(SenderSettleMode remoteSenderSettleMode)
          Deprecated. 
 void setSenderSettleMode(SenderSettleMode senderSettleMode)
          Sets the sender settle mode.
 void setSource(Source address)
          Sets the source for this link.
 void setTarget(Target address)
          Expected to be used in a similar manner to setSource(Source)
 java.util.Iterator<Delivery> unsettled()
           
 
Methods inherited from interface org.apache.qpid.proton.engine.Endpoint
close, free, getCondition, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setCondition, setContext
 

Method Detail

getName

java.lang.String getName()
Returns the name of the link

Returns:
the link name

delivery

Delivery delivery(byte[] tag)
Create a delivery object based on the specified tag and adds it to the this link's delivery list and its connection work list. TODO to clarify - this adds the delivery to the connection list. It is not yet clear why this is done or if it is useful for the application to be able to discover newly created deliveries from the Connection.getWorkHead().

Parameters:
tag - a tag for the delivery
Returns:
a new Delivery object

delivery

Delivery delivery(byte[] tag,
                  int offset,
                  int length)
Create a delivery object based on the specified tag. This form of the method is intended to allow the tag to be formed from a subsequence of the byte array passed in. This might allow more optimisation options in future but at present is not implemented.

Parameters:
tag - a tag for the delivery
offset - (currently ignored and must be 0)
length - (currently ignored and must be the length of the tag array
Returns:
a Delivery object

unsettled

java.util.Iterator<Delivery> unsettled()
Returns:
the unsettled deliveries for this link

current

Delivery current()
Returns the current delivery


advance

boolean advance()
Attempts to advance the current delivery. Advances it to the next delivery if one exists, else null. The behaviour of this method is different for senders and receivers.

Returns:
true if it can advance, false if it cannot TODO document the meaning of the return value more fully. Currently Senderimpl only returns false if there is no current delivery

getSource

Source getSource()

getTarget

Target getTarget()

setSource

void setSource(Source address)
Sets the source for this link. The initiator of the link must always provide a Source. An application responding to the creation of the link should perform an application specific lookup on the getRemoteSource() to determine an actual Source. If it failed to determine an actual source, it should set null, and then go on to Endpoint.close() the link.

See Also:
"AMQP Spec 1.0 section 2.6.3"

setTarget

void setTarget(Target address)
Expected to be used in a similar manner to setSource(Source)


getRemoteSource

Source getRemoteSource()
See Also:
setSource(Source)

getRemoteTarget

Target getRemoteTarget()
See Also:
setTarget(Target)

next

Link next(java.util.EnumSet<EndpointState> local,
          java.util.EnumSet<EndpointState> remote)

getCredit

int getCredit()

getQueued

int getQueued()

getUnsettled

int getUnsettled()

getSession

Session getSession()

getSenderSettleMode

SenderSettleMode getSenderSettleMode()

setSenderSettleMode

void setSenderSettleMode(SenderSettleMode senderSettleMode)
Sets the sender settle mode. Should only be called during link set-up, i.e. before calling Endpoint.open(). If this endpoint is the initiator of the link, this method can be used to set a value other than the default. If this endpoint is not the initiator, this method should be used to set a local value. According to the AMQP spec, the application may choose to accept the sender's suggestion (accessed by calling getRemoteSenderSettleMode()) or choose another value. The value has no effect on Proton, but may be useful to the application at a later point. In order to be AMQP compliant the application is responsible for honouring the settlement mode. See Link.


getRemoteSenderSettleMode

SenderSettleMode getRemoteSenderSettleMode()
See Also:
setSenderSettleMode(SenderSettleMode)

getReceiverSettleMode

ReceiverSettleMode getReceiverSettleMode()

setReceiverSettleMode

void setReceiverSettleMode(ReceiverSettleMode receiverSettleMode)
Sets the receiver settle mode. Used in analogous way to setSenderSettleMode(SenderSettleMode)


getRemoteReceiverSettleMode

ReceiverSettleMode getRemoteReceiverSettleMode()
See Also:
setReceiverSettleMode(ReceiverSettleMode)

setRemoteSenderSettleMode

@Deprecated
void setRemoteSenderSettleMode(SenderSettleMode remoteSenderSettleMode)
Deprecated. 

TODO should this be part of the interface?