private void assembleContextLayer(LayerAssembly contextLayer) throws AssemblyException { ModuleAssembly roleMapModule = contextLayer.module("CONTEXT-RoleMap"); // Role-playing entities roleMapModule .entities(CargoRoleMap.class, CargosRoleMap.class, HandlingEventsRoleMap.class) .visibleIn(application); // Non-role-playing entities roleMapModule .entities(HandlingEventEntity.class, LocationEntity.class, VoyageEntity.class) .visibleIn(application); ModuleAssembly interactionModule = contextLayer.module("CONTEXT-Interaction"); interactionModule.transients(ProcessHandlingEvent.class).visibleIn(application); ModuleAssembly contextServiceModule = contextLayer.module("CONTEXT-Service"); contextServiceModule .addServices( ParseHandlingEventData.class, RoutingService.class, RouteSpecificationFactoryService.class) .visibleIn(application); contextServiceModule.values(ParsedHandlingEventData.class).visibleIn(application); }
public void assemble(ModuleAssembly module) throws AssemblyException { module.services(SomeService.class).instantiateOnStartup(); module.services(SomeService2.class).instantiateOnStartup(); new TracingAssembler().assemble(module); module.services(MemoryEntityStoreService.class); new RdfMemoryStoreAssembler().assemble(module); module.services(UuidIdentityGeneratorService.class); module.entities(CompositeTraceRecordEntity.class); module.entities(EntityTraceRecordEntity.class); module.entities(ServiceTraceRecordEntity.class); }
@Override public void assemble(ModuleAssembly module) throws AssemblyException { module.services(TestAlarmModel.class); module.services(AlarmSystemService.class); module.entities(AlarmPointEntity.class); new EntityTestAssembler().assemble(module); module.values(AlarmStatus.class); module.values(AlarmCategory.class); module.values(AlarmEvent.class); module.entities(AlarmPointEntity.class); module.forMixin(AlarmHistory.class).declareDefaults().maxSize().set(30); }
public void assemble(ModuleAssembly module) throws AssemblyException { new EntityTestAssembler().assemble(module); module.objects(MigrationEventLogger.class); module.importedServices(MigrationEventLogger.class).importedBy(NewObjectImporter.class); module.entities( TestEntity1_0.class, TestEntity1_1.class, TestEntity2_0.class, org.qi4j.migration.moved.TestEntity2_0.class); MigrationBuilder migration = new MigrationBuilder("1.0"); migration .toVersion("1.1") .renameEntity(TestEntity1_0.class.getName(), TestEntity1_1.class.getName()) .atStartup(new CustomFixOperation("Fix for 1.1")) .forEntities(TestEntity1_1.class.getName()) .renameProperty("foo", "newFoo") .renameManyAssociation("fooManyAssoc", "newFooManyAssoc") .renameAssociation("fooAssoc", "newFooAssoc") .end() .toVersion("2.0") .renameEntity(TestEntity1_1.class.getName(), TestEntity2_0.class.getName()) .atStartup(new CustomFixOperation("Fix for 2.0, 1")) .atStartup(new CustomFixOperation("Fix for 2.0, 2")) .forEntities(TestEntity2_0.class.getName()) .addProperty("bar", "Some value") .removeProperty("newFoo", "Some value") .custom(new CustomBarOperation()) .end() .toVersion("3.0") .renamePackage("org.qi4j.migration", "org.qi4j.migration.moved") .withEntities("TestEntity2_0") .end(); module.services(MigrationService.class).setMetaInfo(migration); module.entities(MigrationConfiguration.class); module.forMixin(MigrationConfiguration.class).declareDefaults().lastStartupVersion().set("1.0"); }
// END SNIPPET: domainLayer // START SNIPPET: accountModule private static void createAccountModule(LayerAssembly layer) { ModuleAssembly module = layer.module("account-module"); module.entities(AccountEntity.class, EntryEntity.class); module .addServices( AccountRepositoryService.class, AccountFactoryService.class, EntryFactoryService.class, EntryRepositoryService.class) .visibleIn(Visibility.layer); }
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); }
private static void createCustomerDomainModule(LayerAssembly layer) { ModuleAssembly assembly = layer.module("Customer Domain Module"); assembly.entities(CustomerEntity.class); assembly.entities(CountryEntity.class); assembly.transients(AddressComposite.class); }
@Override public void assemble(ModuleAssembly module) throws AssemblyException { SQLTestHelper.assembleWithMemoryEntityStore(module); module.entities(TestEntity.class); }