use of io.joynr.arbitration.DiscoveryScope in project joynr by bmwcarit.
the class LocalCapabilitiesDirectoryImpl method lookup.
@Override
@CheckForNull
public void lookup(final String participantId, final DiscoveryQos discoveryQos, final CapabilityCallback capabilityCallback) {
final DiscoveryEntry localDiscoveryEntry = localDiscoveryEntryStore.lookup(participantId, discoveryQos.getCacheMaxAgeMs());
DiscoveryScope discoveryScope = discoveryQos.getDiscoveryScope();
switch(discoveryScope) {
case LOCAL_ONLY:
if (localDiscoveryEntry != null) {
capabilityCallback.processCapabilityReceived(CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(true, localDiscoveryEntry));
} else {
capabilityCallback.processCapabilityReceived(null);
}
break;
case LOCAL_THEN_GLOBAL:
case LOCAL_AND_GLOBAL:
if (localDiscoveryEntry != null) {
capabilityCallback.processCapabilityReceived(CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(true, localDiscoveryEntry));
} else {
asyncGetGlobalCapabilitity(participantId, discoveryQos, capabilityCallback);
}
break;
case GLOBAL_ONLY:
asyncGetGlobalCapabilitity(participantId, discoveryQos, capabilityCallback);
break;
default:
break;
}
}
Aggregations