use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.
the class DocumentCollectionFactoryProducer method getDocumentCollection.
private <T extends DocumentCollectionManager> DocumentCollectionManagerFactory<T> getDocumentCollection(InjectionPoint injectionPoint) {
Annotated annotated = injectionPoint.getAnnotated();
ConfigurationUnit annotation = getConfigurationUnit(injectionPoint, annotated).orElseThrow(() -> new IllegalStateException("The @ConfigurationUnit does not found"));
ConfigurationSettingsUnit unit = configurationReader.get().read(annotation, DocumentConfiguration.class);
Class<DocumentConfiguration> configurationClass = unit.<DocumentConfiguration>getProvider().orElseThrow(() -> new IllegalStateException("The DocumentConfiguration provider is required in the configuration"));
DocumentConfiguration configuration = reflections.newInstance(configurationClass);
return configuration.get(unit.getSettings());
}
use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.
the class BucketManagerFactoryProducer method getBuckerManagerFactocy.
private <T extends BucketManager> BucketManagerFactory<T> getBuckerManagerFactocy(InjectionPoint injectionPoint) {
Annotated annotated = injectionPoint.getAnnotated();
ConfigurationUnit annotation = getConfigurationUnit(injectionPoint, annotated).orElseThrow(() -> new IllegalStateException("The @ConfigurationUnit does not found"));
ConfigurationSettingsUnit unit = configurationReader.get().read(annotation, KeyValueConfiguration.class);
Class<KeyValueConfiguration> configurationClass = unit.<KeyValueConfiguration>getProvider().orElseThrow(() -> new IllegalStateException("The ColumnConfiguration provider is required in the configuration"));
KeyValueConfiguration columnConfiguration = reflections.newInstance(configurationClass);
return columnConfiguration.get(unit.getSettings());
}
use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.
the class DocumentCollectionFactoryProducer method getDocumentCollectionAsync.
private <T extends DocumentCollectionManagerAsync> DocumentCollectionManagerAsyncFactory<T> getDocumentCollectionAsync(InjectionPoint injectionPoint) {
Annotated annotated = injectionPoint.getAnnotated();
ConfigurationUnit annotation = getConfigurationUnit(injectionPoint, annotated).orElseThrow(() -> new IllegalStateException("The @ConfigurationUnit does not found"));
ConfigurationSettingsUnit unit = configurationReader.get().read(annotation, DocumentConfigurationAsync.class);
Class<DocumentConfigurationAsync> configurationClass = unit.<DocumentConfigurationAsync>getProvider().orElseThrow(() -> new IllegalStateException("The DocumentConfiguration provider is required in the configuration"));
DocumentConfigurationAsync documentConfiguration = reflections.newInstance(configurationClass);
return documentConfiguration.getAsync(unit.getSettings());
}
use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.
the class ColumnFamilyManagerFactoryProducer method gettColumnFamilyManagerAsyncFactory.
private <T extends ColumnFamilyManagerAsync> ColumnFamilyManagerAsyncFactory<T> gettColumnFamilyManagerAsyncFactory(InjectionPoint injectionPoint) {
Annotated annotated = injectionPoint.getAnnotated();
ConfigurationUnit annotation = getConfigurationUnit(injectionPoint, annotated).orElseThrow(() -> new IllegalStateException("The @ConfigurationUnit does not found"));
ConfigurationSettingsUnit unit = configurationReader.get().read(annotation, ColumnConfigurationAsync.class);
Class<ColumnConfigurationAsync> configurationClass = unit.<ColumnConfigurationAsync>getProvider().orElseThrow(() -> new IllegalStateException("The ColumnConfiguration provider is required in the configuration"));
ColumnConfigurationAsync columnConfiguration = reflections.newInstance(configurationClass);
return columnConfiguration.getAsync(unit.getSettings());
}
use of org.jnosql.artemis.ConfigurationUnit in project jnosql-artemis by eclipse.
the class DefaultConfigurationReaderTest method shouldReturnNPEWhenConfigurationIsNull.
@Test
public void shouldReturnNPEWhenConfigurationIsNull() {
Assertions.assertThrows(NullPointerException.class, () -> {
ConfigurationUnit annotation = mock(ConfigurationUnit.class);
configurationReader.read(annotation, null);
});
}
Aggregations