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);
  }
 private static ApplicationAssembly createAssembly(ApplicationAssemblyFactory factory)
     throws AssemblyException {
   String applicationName = "Example Application";
   ApplicationAssembly app = factory.newApplicationAssembly();
   app.setName(applicationName);
   LayerAssembly webLayer = createWebLayer(app);
   LayerAssembly domainLayer = createDomainLayer(app);
   LayerAssembly infraLayer = createInfrastructureLayer(app);
   webLayer.uses(domainLayer);
   webLayer.uses(infraLayer); // Accesses the WebService
   domainLayer.uses(infraLayer); // For persistence
   return app;
 }
 private static void createCustomerWebModule(LayerAssembly layer) {
   ModuleAssembly assembly = layer.module("Customer Web Module");
   assembly.transients(CustomerViewComposite.class);
   assembly.transients(CustomerEditComposite.class);
   assembly.transients(CustomerListViewComposite.class);
   assembly.transients(CustomerSearchComposite.class);
 }
  private void assembleBootstrapLayer(LayerAssembly bootstrapLayer) throws AssemblyException {
    ModuleAssembly bootstrapModule = bootstrapLayer.module("BOOTSTRAP-Bootstrap");

    // Load base data on startup
    bootstrapModule
        .addServices(BaseDataService.class)
        .visibleIn(application)
        .instantiateOnStartup();
  }
  private void assembleInfrastructureLayer(LayerAssembly infrastructureLayer)
      throws AssemblyException {
    ModuleAssembly indexingModule = infrastructureLayer.module("INFRASTRUCTURE-Indexing");
    indexingModule.objects(EntityStateSerializer.class, EntityTypeSerializer.class);

    indexingModule
        .addServices(MemoryRepositoryService.class, RdfIndexingEngineService.class)
        .visibleIn(application);

    ModuleAssembly entityStoreModule = infrastructureLayer.module("INFRASTRUCTURE-EntityStore");
    entityStoreModule
        .addServices(MemoryEntityStoreService.class, UuidIdentityGeneratorService.class)
        .visibleIn(application);

    ModuleAssembly externalServiceModule =
        infrastructureLayer.module("INFRASTRUCTURE-ExternalService");
    externalServiceModule
        .importedServices(GraphTraversalService.class)
        .setMetaInfo(new GraphTraversalServiceImpl(new GraphDAO()))
        .visibleIn(application);
  }
  public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory)
      throws AssemblyException {
    // Application assembly
    ApplicationAssembly assembly = applicationFactory.newApplicationAssembly();
    assembly.setName("DCI Sample (version A) - TEST");
    assembly.setVersion("B.1.0");
    assembly.setMode(test);

    // Layers
    LayerAssembly infrastructureLayer = assembly.layer("INFRASTRUCTURE");
    LayerAssembly dataLayer = assembly.layer("DATA");
    LayerAssembly contextLayer = assembly.layer("CONTEXT");
    LayerAssembly bootstrapLayer = assembly.layer("BOOTSTRAP");

    // Layer dependencies
    bootstrapLayer.uses(contextLayer, dataLayer, infrastructureLayer);

    contextLayer.uses(dataLayer, infrastructureLayer);

    dataLayer.uses(infrastructureLayer);

    // Assemble
    assembleDomainLayer(dataLayer);
    assembleContextLayer(contextLayer);
    assembleBootstrapLayer(bootstrapLayer);
    assembleInfrastructureLayer(infrastructureLayer);

    return assembly;
  }
Exemple #7
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);
  }
 private void assembleDomainLayer(LayerAssembly dataLayer) throws AssemblyException {
   // Non-role-playing values
   ModuleAssembly structureModule = dataLayer.module("DATA-Structure");
   structureModule
       .values(
           TrackingId.class,
           RouteSpecification.class,
           Delivery.class,
           NextHandlingEvent.class,
           UnLocode.class,
           Itinerary.class,
           Leg.class,
           CarrierMovement.class,
           Schedule.class,
           VoyageNumber.class)
       .visibleIn(application);
 }
 private static void createPersistenceModule(LayerAssembly layer) throws AssemblyException {
   ModuleAssembly assembly = layer.module("Persistence Module");
   // Someone has created an assembler for the Neo EntityStore
   NeoAssembler neo = new NeoAssembler("./neostore");
   neo.assemble(assembly);
 }
Exemple #10
0
 private static void createWebServiceModule(LayerAssembly layer) throws AssemblyException {
   ModuleAssembly assembly = layer.module("Web Service Module");
   // Someone has created an assembler for a Jetty Web Service.
   JettyAssembler jetty = new JettyAssembler(8080);
   jetty.assemble(assembly);
 }
Exemple #11
0
 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);
 }
Exemple #12
0
 private static void createReceivablesModule(LayerAssembly layer) {
   layer.module("receivables-module");
 }
Exemple #13
0
 private static void createInventoryModule(LayerAssembly layer) {
   layer.module("inventory-module");
 }
Exemple #14
0
 // END SNIPPET: accountModule
 private static void createPayablesModule(LayerAssembly layer) {
   layer.module("payables-module");
 }