Search in sources :

Example 1 with ReactiveKeyValueTemplate

use of org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate in project jnosql-diana by eclipse.

the class ReactiveRepositoryKeyValueBean method create.

@Override
public ReactiveRepository<?, ?> create(CreationalContext<ReactiveRepository<?, ?>> creationalContext) {
    KeyValueTemplate template = provider.isEmpty() ? getInstance(KeyValueTemplate.class) : getInstance(KeyValueTemplate.class, DatabaseQualifier.ofKeyValue(provider));
    ReactiveKeyValueTemplate reactiveTemplate = provider.isEmpty() ? getInstance(ReactiveKeyValueTemplate.class) : getInstance(ReactiveKeyValueTemplate.class, DatabaseQualifier.ofKeyValue(provider));
    ReactiveKeyValueRepositoryProxy<?> handler = new ReactiveKeyValueRepositoryProxy<>(template, reactiveTemplate, type);
    return (ReactiveRepository<?, ?>) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
Also used : ReactiveKeyValueTemplate(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate) ReactiveRepository(org.eclipse.jnosql.mapping.reactive.ReactiveRepository) ReactiveKeyValueTemplate(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate) KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate)

Example 2 with ReactiveKeyValueTemplate

use of org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate in project jnosql-diana by eclipse.

the class ReactiveKeyValueTemplateConverterTest method shouldReturnTemplate.

@Test
public void shouldReturnTemplate() {
    final String prefix = UUID.randomUUID().toString();
    System.setProperty(prefix, prefix);
    System.setProperty(prefix + ".settings.key", "value");
    System.setProperty(prefix + ".settings.key2", "value2");
    System.setProperty(prefix + ".provider", KeyValueConfigurationMock.class.getName());
    System.setProperty(prefix + ".database", "bucket");
    final ReactiveKeyValueTemplate template = config.getValue(prefix, ReactiveKeyValueTemplate.class);
    Assertions.assertNotNull(template);
    System.clearProperty(prefix);
    System.clearProperty(prefix + ".settings.key");
    System.clearProperty(prefix + ".settings.key2");
    System.clearProperty(prefix + ".provider");
    System.clearProperty(prefix + ".database");
}
Also used : ReactiveKeyValueTemplate(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate) Test(org.junit.jupiter.api.Test)

Example 3 with ReactiveKeyValueTemplate

use of org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate in project jnosql-diana by eclipse.

the class ReactiveKeyValueManagerConverter method success.

@Override
protected ReactiveKeyValueTemplate success(String value) {
    Config config = BeanManagers.getInstance(Config.class);
    final KeyValueTemplate template = config.getValue(value, KeyValueTemplate.class);
    ReactiveKeyValueTemplateProducer producer = BeanManagers.getInstance(ReactiveKeyValueTemplateProducer.class);
    return producer.get(template);
}
Also used : Config(org.eclipse.microprofile.config.Config) ReactiveKeyValueTemplate(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate) KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate) ReactiveKeyValueTemplateProducer(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplateProducer)

Example 4 with ReactiveKeyValueTemplate

use of org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate in project jnosql-diana by eclipse.

the class ReactiveTemplateBean method create.

@Override
public ReactiveKeyValueTemplate create(CreationalContext<ReactiveKeyValueTemplate> creationalContext) {
    ReactiveKeyValueTemplateProducer producer = getInstance(ReactiveKeyValueTemplateProducer.class);
    KeyValueTemplate template = getManager();
    return producer.get(template);
}
Also used : ReactiveKeyValueTemplate(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate) KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate) ReactiveKeyValueTemplateProducer(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplateProducer)

Aggregations

ReactiveKeyValueTemplate (org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate)4 KeyValueTemplate (jakarta.nosql.mapping.keyvalue.KeyValueTemplate)3 ReactiveKeyValueTemplateProducer (org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplateProducer)2 ReactiveRepository (org.eclipse.jnosql.mapping.reactive.ReactiveRepository)1 Config (org.eclipse.microprofile.config.Config)1 Test (org.junit.jupiter.api.Test)1