use of com.hazelcast.client.impl.ClientSelector in project hazelcast by hazelcast.
the class ClientBwListConfigHandler method createSelector.
private static ClientSelector createSelector(List<ClientBwListEntryDTO> entries) {
ClientSelector selector = ClientSelectors.none();
for (ClientBwListEntryDTO entryDTO : entries) {
ClientSelector entrySelector = createSelector(entryDTO);
selector = ClientSelectors.or(selector, entrySelector);
}
return selector;
}
use of com.hazelcast.client.impl.ClientSelector in project hazelcast by hazelcast.
the class ClientBwListConfigHandler method applyConfig.
/**
* Applies the given config.
*
* @param configDTO configuration object
*/
public void applyConfig(ClientBwListDTO configDTO) {
requireNonNull(configDTO, "Client filtering config must not be null");
requireNonNull(configDTO.mode, "Config mode must not be null");
requireNonNull(configDTO.entries, "Config entries must not be null");
ClientSelector selector;
switch(configDTO.mode) {
case DISABLED:
selector = ClientSelectors.any();
break;
case WHITELIST:
selector = createSelector(configDTO.entries);
break;
case BLACKLIST:
selector = ClientSelectors.inverse(createSelector(configDTO.entries));
break;
default:
throw new IllegalArgumentException("Unknown client B/W list mode: " + configDTO.mode);
}
clientEngine.applySelector(selector);
}
Aggregations