@JsonIgnore @Value.Lazy public String getKeyspaceOrThrow() { return keyspace().orElseThrow(() -> new IllegalStateException( "Tried to read the keyspace from a CassandraConfig when it hadn't been set!")); }
@Override @JsonIgnore @Value.Derived public Optional<String> namespace() { return keyspace(); }
@VisibleForTesting static CassandraKeyValueServiceConfig preprocessKvsConfig( KeyValueServiceConfig config, Supplier<Optional<KeyValueServiceRuntimeConfig>> runtimeConfig, Optional<String> namespace) { Preconditions.checkArgument(config instanceof CassandraKeyValueServiceConfig, "Invalid KeyValueServiceConfig. Expected a KeyValueServiceConfig of type" + " CassandraKeyValueServiceConfig, found %s.", config.getClass()); CassandraKeyValueServiceConfig cassandraConfig = (CassandraKeyValueServiceConfig) config; String desiredKeyspace = OptionalResolver.resolve(namespace, cassandraConfig.keyspace()); CassandraKeyValueServiceConfig configWithNamespace = CassandraKeyValueServiceConfigs .copyWithKeyspace(cassandraConfig, desiredKeyspace); return new CassandraReloadableKvsConfig(configWithNamespace, runtimeConfig); }
@JsonIgnore @Value.Lazy public String getKeyspaceOrThrow() { return keyspace().orElseThrow(() -> new IllegalStateException( "Tried to read the keyspace from a CassandraConfig when it hadn't been set!")); }
@Override @JsonIgnore @Value.Derived public Optional<String> namespace() { return keyspace(); }
@VisibleForTesting static CassandraKeyValueServiceConfig preprocessKvsConfig( KeyValueServiceConfig config, Supplier<Optional<KeyValueServiceRuntimeConfig>> runtimeConfig, Optional<String> namespace) { Preconditions.checkArgument(config instanceof CassandraKeyValueServiceConfig, "Invalid KeyValueServiceConfig. Expected a KeyValueServiceConfig of type" + " CassandraKeyValueServiceConfig, found %s.", config.getClass()); CassandraKeyValueServiceConfig cassandraConfig = (CassandraKeyValueServiceConfig) config; String desiredKeyspace = OptionalResolver.resolve(namespace, cassandraConfig.keyspace()); CassandraKeyValueServiceConfig configWithNamespace = CassandraKeyValueServiceConfigs .copyWithKeyspace(cassandraConfig, desiredKeyspace); return new CassandraReloadableKvsConfig(configWithNamespace, runtimeConfig); }