Search in sources :

Example 6 with SettingsBuilder

use of jakarta.nosql.Settings.SettingsBuilder in project jnosql-diana-driver by eclipse.

the class CassandraProperties method of.

public static CassandraProperties of(Map<String, String> configurations) {
    SettingsBuilder builder = Settings.builder();
    configurations.entrySet().forEach(e -> builder.put(e.getKey(), e.getValue()));
    Settings settings = builder.build();
    CassandraProperties cp = new CassandraProperties();
    settings.prefix(Arrays.asList(OldCassandraConfigurations.HOST.get(), CassandraConfigurations.HOST.get(), Configurations.HOST.get())).stream().map(Object::toString).forEach(cp::addNodes);
    settings.prefix(Arrays.asList(OldCassandraConfigurations.QUERY.get(), CassandraConfigurations.QUERY.get())).stream().map(Object::toString).forEach(cp::addQuery);
    cp.port = settings.get(Arrays.asList(OldCassandraConfigurations.PORT.get(), CassandraConfigurations.PORT.get())).map(Object::toString).map(Integer::parseInt).orElse(DEFAULT_PORT);
    cp.name = settings.get(Arrays.asList(OldCassandraConfigurations.NAME.get(), CassandraConfigurations.NAME.get())).map(Object::toString);
    cp.dataCenter = settings.get(CassandraConfigurations.DATA_CENTER.get()).map(Object::toString).orElse(DEFAULT_DATA_CENTER);
    cp.user = settings.get(Configurations.USER.get()).map(Object::toString);
    cp.password = settings.get(Configurations.PASSWORD.get()).map(Object::toString);
    return cp;
}
Also used : SettingsBuilder(jakarta.nosql.Settings.SettingsBuilder) Settings(jakarta.nosql.Settings)

Example 7 with SettingsBuilder

use of jakarta.nosql.Settings.SettingsBuilder in project jnosql-diana-driver by eclipse.

the class ArangoDBKeyValueConfiguration method get.

@Override
public ArangoDBBucketManagerFactory get() {
    Map<String, String> configuration = ConfigurationReader.from(ArangoDBConfigurations.FILE_CONFIGURATION.get());
    SettingsBuilder builder = Settings.builder();
    configuration.entrySet().stream().forEach(e -> builder.put(e.getKey(), e.getValue()));
    return get(builder.build());
}
Also used : SettingsBuilder(jakarta.nosql.Settings.SettingsBuilder)

Example 8 with SettingsBuilder

use of jakarta.nosql.Settings.SettingsBuilder in project jnosql-diana-driver by eclipse.

the class ArangoDBDocumentConfiguration method get.

@Override
public ArangoDBDocumentCollectionManagerFactory get() throws UnsupportedOperationException {
    Map<String, String> configuration = ConfigurationReader.from(ArangoDBConfigurations.FILE_CONFIGURATION.get());
    SettingsBuilder builder = Settings.builder();
    configuration.entrySet().stream().forEach(e -> builder.put(e.getKey(), e.getValue()));
    return get(builder.build());
}
Also used : SettingsBuilder(jakarta.nosql.Settings.SettingsBuilder)

Example 9 with SettingsBuilder

use of jakarta.nosql.Settings.SettingsBuilder in project jnosql-diana-driver by eclipse.

the class CassandraColumnFamilyManagerFactoryTest method setUp.

@BeforeEach
public void setUp() {
    Settings settings = ManagerFactorySupplier.INSTANCE.getSettings();
    SettingsBuilder builder = Settings.builder();
    builder.put("cassandra.host.1", settings.get("cassandra.host-1").get().toString());
    builder.put("cassandra.port", settings.get("cassandra.port").get().toString());
    builder.put("cassandra.query.1", " CREATE KEYSPACE IF NOT EXISTS newKeySpace WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};");
    CassandraConfiguration cassandraConfiguration = new CassandraConfiguration();
    subject = cassandraConfiguration.get(builder.build());
}
Also used : SettingsBuilder(jakarta.nosql.Settings.SettingsBuilder) Settings(jakarta.nosql.Settings) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with SettingsBuilder

use of jakarta.nosql.Settings.SettingsBuilder in project jnosql-diana-driver by eclipse.

the class InfinispanKeyValueConfiguration method get.

/**
 * Creates a {@link InfinispanBucketManagerFactory} from configuration map
 * @param configurations the configuration map
 * @return the InfinispanBucketManagerFactory instance
 * @throws NullPointerException when configurations is null
 */
public InfinispanBucketManagerFactory get(Map<String, String> configurations) {
    requireNonNull(configurations, "configurations is required");
    SettingsBuilder builder = Settings.builder();
    configurations.entrySet().forEach(e -> builder.put(e.getKey(), e.getValue()));
    return get(builder.build());
}
Also used : SettingsBuilder(jakarta.nosql.Settings.SettingsBuilder)

Aggregations

SettingsBuilder (jakarta.nosql.Settings.SettingsBuilder)10 Settings (jakarta.nosql.Settings)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1