Search in sources :

Example 1 with RedisType

use of org.apache.nifi.redis.RedisType in project nifi by apache.

the class RedisStateProvider method customValidate.

@Override
protected Collection<ValidationResult> customValidate(ValidationContext validationContext) {
    final List<ValidationResult> results = new ArrayList<>(RedisUtils.validate(validationContext));
    final RedisType redisType = RedisType.fromDisplayName(validationContext.getProperty(RedisUtils.REDIS_MODE).getValue());
    if (redisType != null && redisType == RedisType.CLUSTER) {
        results.add(new ValidationResult.Builder().subject(RedisUtils.REDIS_MODE.getDisplayName()).valid(false).explanation(RedisUtils.REDIS_MODE.getDisplayName() + " is configured in clustered mode, and this service requires a non-clustered Redis").build());
    }
    return results;
}
Also used : ArrayList(java.util.ArrayList) ValidationResult(org.apache.nifi.components.ValidationResult) RedisType(org.apache.nifi.redis.RedisType)

Example 2 with RedisType

use of org.apache.nifi.redis.RedisType in project nifi by apache.

the class RedisDistributedMapCacheClientService method customValidate.

@Override
protected Collection<ValidationResult> customValidate(ValidationContext validationContext) {
    final List<ValidationResult> results = new ArrayList<>();
    final RedisConnectionPool redisConnectionPool = validationContext.getProperty(REDIS_CONNECTION_POOL).asControllerService(RedisConnectionPool.class);
    if (redisConnectionPool != null) {
        final RedisType redisType = redisConnectionPool.getRedisType();
        if (redisType != null && redisType == RedisType.CLUSTER) {
            results.add(new ValidationResult.Builder().subject(REDIS_CONNECTION_POOL.getDisplayName()).valid(false).explanation(REDIS_CONNECTION_POOL.getDisplayName() + " is configured in clustered mode, and this service requires a non-clustered Redis").build());
        }
    }
    return results;
}
Also used : ArrayList(java.util.ArrayList) ValidationResult(org.apache.nifi.components.ValidationResult) RedisConnectionPool(org.apache.nifi.redis.RedisConnectionPool) RedisType(org.apache.nifi.redis.RedisType)

Aggregations

ArrayList (java.util.ArrayList)2 ValidationResult (org.apache.nifi.components.ValidationResult)2 RedisType (org.apache.nifi.redis.RedisType)2 RedisConnectionPool (org.apache.nifi.redis.RedisConnectionPool)1