Search in sources :

Example 1 with ClientSelector

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;
}
Also used : ClientSelector(com.hazelcast.client.impl.ClientSelector) ClientBwListEntryDTO(com.hazelcast.internal.management.dto.ClientBwListEntryDTO)

Example 2 with ClientSelector

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);
}
Also used : ClientSelector(com.hazelcast.client.impl.ClientSelector)

Aggregations

ClientSelector (com.hazelcast.client.impl.ClientSelector)2 ClientBwListEntryDTO (com.hazelcast.internal.management.dto.ClientBwListEntryDTO)1