use of com.yahoo.elide.datastores.aggregation.validator.TemplateConfigValidator in project elide by yahoo.
the class ElideStandaloneSettings method getDataStore.
/**
* Gets the DataStore for elide.
* @param metaDataStore MetaDataStore object.
* @param aggregationDataStore AggregationDataStore object.
* @param entityManagerFactory EntityManagerFactory object.
* @return DataStore object initialized.
*/
default DataStore getDataStore(MetaDataStore metaDataStore, AggregationDataStore aggregationDataStore, EntityManagerFactory entityManagerFactory) {
List<DataStore> stores = new ArrayList<>();
DataStore jpaDataStore = new JpaDataStore(() -> entityManagerFactory.createEntityManager(), em -> new NonJtaTransaction(em, TXCANCEL, DEFAULT_LOGGER, true, true));
stores.add(jpaDataStore);
if (getAnalyticProperties().enableDynamicModelConfigAPI()) {
stores.add(new ConfigDataStore(getAnalyticProperties().getDynamicConfigPath(), new TemplateConfigValidator(getClassScanner(), getAnalyticProperties().getDynamicConfigPath())));
}
stores.add(metaDataStore);
stores.add(aggregationDataStore);
return new MultiplexManager(stores.toArray(new DataStore[0]));
}
use of com.yahoo.elide.datastores.aggregation.validator.TemplateConfigValidator in project elide by yahoo.
the class ElideAutoConfiguration method buildDataStore.
/**
* Creates the DataStore Elide. Override to use a different store.
* @param entityManagerFactory The JPA factory which creates entity managers.
* @param scanner Class Scanner
* @param queryEngine QueryEngine instance for aggregation data store.
* @param settings Elide configuration settings.
* @param cache Analytics query cache
* @param querylogger Analytics query logger
* @return An instance of a JPA DataStore.
*/
@Bean
@ConditionalOnMissingBean
@Scope(SCOPE_PROTOTYPE)
public DataStore buildDataStore(EntityManagerFactory entityManagerFactory, ClassScanner scanner, @Autowired(required = false) QueryEngine queryEngine, ElideConfigProperties settings, @Autowired(required = false) Cache cache, @Autowired(required = false) QueryLogger querylogger) {
List<DataStore> stores = new ArrayList<>();
JpaDataStore jpaDataStore = new JpaDataStore(entityManagerFactory::createEntityManager, em -> new NonJtaTransaction(em, txCancel, DEFAULT_LOGGER, settings.getJpaStore().isDelegateToInMemoryStore(), true));
stores.add(jpaDataStore);
if (isAggregationStoreEnabled(settings)) {
AggregationDataStore.AggregationDataStoreBuilder aggregationDataStoreBuilder = AggregationDataStore.builder().queryEngine(queryEngine);
if (isDynamicConfigEnabled(settings)) {
aggregationDataStoreBuilder.dynamicCompiledClasses(queryEngine.getMetaDataStore().getDynamicTypes());
if (settings.getDynamicConfig().isConfigApiEnabled()) {
stores.add(new ConfigDataStore(settings.getDynamicConfig().getPath(), new TemplateConfigValidator(scanner, settings.getDynamicConfig().getPath())));
}
}
aggregationDataStoreBuilder.cache(cache);
aggregationDataStoreBuilder.queryLogger(querylogger);
AggregationDataStore aggregationDataStore = aggregationDataStoreBuilder.build();
stores.add(queryEngine.getMetaDataStore());
stores.add(aggregationDataStore);
// meta data store needs to be put at first to populate meta data models
return new MultiplexManager(stores.toArray(new DataStore[0]));
}
return jpaDataStore;
}
Aggregations