Package io.joynr.messaging.routing
Class DummyRoutingTable
- java.lang.Object
-
- io.joynr.messaging.routing.DummyRoutingTable
-
- All Implemented Interfaces:
RoutingTable
public class DummyRoutingTable extends Object implements RoutingTable
-
-
Constructor Summary
Constructors Constructor Description DummyRoutingTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(AddressOperation addressOperation)Apply the specified operation to all addresses currently held in the routing table.booleancontainsKey(String participantId)Addressget(String participantId)Addressget(String participantId, String gbid)longgetExpiryDateMs(String participantId)Query the expiry date of a routing entry for a participant id.booleangetIsGloballyVisible(String participantId)Query the routing table for the status of isGloballyVisible parameterbooleangetIsSticky(String participantId)Query the sticky-flag of a routing entry for a participant id.voidincrementReferenceCount(String participantId)Increment the reference count of the entry with the given participantId.voidpurge()Purge all expired routing entries from the tablebooleanput(String participantId, Address address, boolean isGloballyVisible, long expiryDateMs)Overload of put method with isSticky set to false.booleanput(String participantId, Address address, boolean isGloballyVisible, long expiryDateMs, boolean isSticky)Adds a new routing entry.voidremove(String participantId)voidsetGcdParticipantId(String gcdParticipantId)Sets the participantId of the Global Capabilities Directory (GCD) before adding it to the routing table
-
-
-
Method Detail
-
get
public Address get(String participantId)
- Specified by:
getin interfaceRoutingTable- Parameters:
participantId- participantId for which an Address will be returned from the routing table- Returns:
- Address the stored address for the given participantId (unmodified, see
RoutingTable.get(String, String)
-
get
public Address get(String participantId, String gbid)
- Specified by:
getin interfaceRoutingTable- Parameters:
participantId- participantId for which an Address will be returned from the routing tablegbid- name of the backend (evaluated for gcdParticipantId only): selects the backend specific address of GCD (if participantId is the participantId of the GCD)- Returns:
- Address the stored address for the given participantId
- in case of gcdParticipantId, the gbid is evaluated to adapt the stored address for the selected backend before it is returned (this allows communication with GCD instances in different backends
even though there is only one address per participantId
return null if the gbid is unknown (not part of the configured list of GBIDsConfigurableMessagingSettings.PROPERTY_GBIDS
- return unmodified address otherwise
-
setGcdParticipantId
public void setGcdParticipantId(String gcdParticipantId)
Description copied from interface:RoutingTableSets the participantId of the Global Capabilities Directory (GCD) before adding it to the routing table- Specified by:
setGcdParticipantIdin interfaceRoutingTable- Parameters:
gcdParticipantId- the participantId of the GCD
-
put
public boolean put(String participantId, Address address, boolean isGloballyVisible, long expiryDateMs, boolean isSticky)
Description copied from interface:RoutingTableAdds a new routing entry. If a routing entry for the provided participantId already exists, only the expiryDate and the sticky-flag are updated unless the update is allowed (See RoutingTableAddressValidator).- Specified by:
putin interfaceRoutingTable- Parameters:
participantId- participant id for which a routing entry shall be createdaddress- Address which shall be associated with the participant idisGloballyVisible- States whether the endpoint is globally visible or notexpiryDateMs- Expiry date of the routing entry in millisecondsisSticky- If set to true, the routing entry never expires and cannot be replaced- Returns:
- true if succeeded, false otherwise
-
put
public boolean put(String participantId, Address address, boolean isGloballyVisible, long expiryDateMs)
Description copied from interface:RoutingTableOverload of put method with isSticky set to false.- Specified by:
putin interfaceRoutingTable- Parameters:
participantId- participant id for which a routing entry shall be createdaddress- Address which shall be associated with the participant idisGloballyVisible- States whether the endpoint is globally visible or notexpiryDateMs- Expiry date of the routing entry in milliseconds- Returns:
- true if succeeded, false otherwise
-
containsKey
public boolean containsKey(String participantId)
- Specified by:
containsKeyin interfaceRoutingTable
-
getIsGloballyVisible
public boolean getIsGloballyVisible(String participantId)
Description copied from interface:RoutingTableQuery the routing table for the status of isGloballyVisible parameter- Specified by:
getIsGloballyVisiblein interfaceRoutingTable- Parameters:
participantId- participantId for which the visibility shall be looked up- Returns:
- true if participantId is globally visible, false if participantId is not globally visible
-
getExpiryDateMs
public long getExpiryDateMs(String participantId)
Description copied from interface:RoutingTableQuery the expiry date of a routing entry for a participant id.- Specified by:
getExpiryDateMsin interfaceRoutingTable- Parameters:
participantId- participantId for which the expiryDate shall be looked up- Returns:
- The routing entry's expiry date in ms.
-
getIsSticky
public boolean getIsSticky(String participantId)
Description copied from interface:RoutingTableQuery the sticky-flag of a routing entry for a participant id.- Specified by:
getIsStickyin interfaceRoutingTable- Parameters:
participantId- participantId for which the sticky-flag shall be looked up- Returns:
- The routing entry's sticky state.
-
remove
public void remove(String participantId)
- Specified by:
removein interfaceRoutingTable
-
apply
public void apply(AddressOperation addressOperation)
Description copied from interface:RoutingTableApply the specified operation to all addresses currently held in the routing table.- Specified by:
applyin interfaceRoutingTable- Parameters:
addressOperation- the address operation to perform.
-
purge
public void purge()
Description copied from interface:RoutingTablePurge all expired routing entries from the table- Specified by:
purgein interfaceRoutingTable
-
incrementReferenceCount
public void incrementReferenceCount(String participantId)
Description copied from interface:RoutingTableIncrement the reference count of the entry with the given participantId. If no such enbtry is available, a JoynrIllegalstateException is thrown.- Specified by:
incrementReferenceCountin interfaceRoutingTable
-
-