use of org.qi4j.index.sql.assembly.PostgreSQLIndexQueryAssembler in project qi4j-sdk by Qi4j.
the class SQLTestHelper method doCommonAssembling.
protected static void doCommonAssembling(ModuleAssembly mainModule) throws AssemblyException {
ModuleAssembly config = mainModule.layer().module("config");
new EntityTestAssembler().assemble(config);
// START SNIPPET: assembly
// DataSourceService
new DBCPDataSourceServiceAssembler().identifiedBy("postgres-datasource-service").visibleIn(Visibility.module).withConfig(config, Visibility.layer).assemble(mainModule);
// DataSource
new DataSourceAssembler().withDataSourceServiceIdentity("postgres-datasource-service").identifiedBy("postgres-datasource").visibleIn(Visibility.module).withCircuitBreaker().assemble(mainModule);
// SQL Index/Query
new PostgreSQLIndexQueryAssembler().visibleIn(Visibility.module).withConfig(config, Visibility.layer).assemble(mainModule);
// END SNIPPET: assembly
// Always re-build schema in test scenarios because of possibly different app structure in
// various tests
mainModule.services(RebuildingStrategy.class).withMixins(RebuildingStrategy.AlwaysNeed.class).visibleIn(Visibility.module);
// Always re-index in test scenarios
mainModule.services(ReindexingStrategy.class).withMixins(ReindexingStrategy.AlwaysNeed.class).visibleIn(Visibility.module);
config.entities(ReindexerConfiguration.class).visibleIn(Visibility.layer);
}
use of org.qi4j.index.sql.assembly.PostgreSQLIndexQueryAssembler in project qi4j-sdk by Qi4j.
the class AppAssembler method assemble.
@Override
public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory) throws AssemblyException {
ApplicationAssembly appAss = applicationFactory.newApplicationAssembly();
appAss.setName("SQL Support Sample");
// Config
LayerAssembly configLayer = appAss.layer("config");
ModuleAssembly configModule = configLayer.module("config");
{
configModule.services(OrgJsonValueSerializationService.class).taggedWith(ValueSerialization.Formats.JSON);
configModule.services(MemoryEntityStoreService.class).visibleIn(Visibility.module);
// Use a PreferenceEntityStore instead if you want the configuration to be persistent
// new PreferenceEntityStoreAssembler( Visibility.module ).assemble( configModule );
}
// Infra
LayerAssembly infraLayer = appAss.layer("infra");
ModuleAssembly persistenceModule = infraLayer.module("persistence");
{
persistenceModule.services(OrgJsonValueSerializationService.class).taggedWith(ValueSerialization.Formats.JSON);
// SQL DataSource Service
String dataSourceServiceIdentity = "postgresql-datasource-service";
new DBCPDataSourceServiceAssembler().identifiedBy(dataSourceServiceIdentity).visibleIn(Visibility.module).withConfig(configModule, Visibility.application).assemble(persistenceModule);
// SQL EntityStore DataSource and Service
new DataSourceAssembler().withDataSourceServiceIdentity(dataSourceServiceIdentity).identifiedBy("postgresql-es-datasource").visibleIn(Visibility.module).withCircuitBreaker(DataSources.newDataSourceCircuitBreaker()).assemble(persistenceModule);
new PostgreSQLEntityStoreAssembler().visibleIn(Visibility.application).withConfig(configModule, Visibility.application).assemble(persistenceModule);
// SQL Index/Query DataSource and Service
new DataSourceAssembler().withDataSourceServiceIdentity(dataSourceServiceIdentity).identifiedBy("postgresql-index-datasource").visibleIn(Visibility.module).withCircuitBreaker().assemble(persistenceModule);
new PostgreSQLIndexQueryAssembler().visibleIn(Visibility.application).withConfig(configModule, Visibility.application).assemble(persistenceModule);
}
// App
LayerAssembly appLayer = appAss.layer("app");
ModuleAssembly domainModule = appLayer.module("domain");
{
domainModule.entities(PretextEntity.class);
}
// Uses
infraLayer.uses(configLayer);
appLayer.uses(infraLayer);
return appAss;
}
Aggregations