Calling the Application Generator

Once you have created the generator.sh script with the content above, there are two more steps before you can run this script.

First, you must give yourself execution rights on this file by running the following command:

chmod +x generator.sh

Then, you must log into the Docker registry where the Application Generator Docker image invoked by the script is stored. To this end, run the following command and provide the installation credentials that you have been given.

docker login product-dbgene-prod-docker-group.decisionbrain.cloud

Open a command-line tool and move to the folder where you have stored the entities.jdl and generator.sh files. Your application will be generated in a subdirectory of this directory.

After executing the preliminary steps above, run the following command and answer the questions as explained in the table below.

./generator.sh

Note: Some generation problems are addressed in Section Troubleshooting Tools.

Question Description Example
Your project name The short name of your project, to be used in a number of places to generate identifiers. For example, it will be used as the name of the directory that will be created to contain the generated application. It will also be used to identify your application components. This name should not contain any special character or whitespace my-project
Project title A longer name for your project. This will appear for example as the title of your web client. My First Project
The project generation destination Always answer . to this question. .
Your project package The Java package that will be used (as a root) in the generated classes. com.example.project
Collector class name The simple, unqualified name of the Java class that will be generated and used as the business data model collector, that is, the entry point for in-memory data handling in your application. It is a good idea to use a name close to your application name. ProjectCollector
What type of your model definition do you have? The Application Generator tool can be used to migrate an existing IBM DOC 3.x application. In that case, the data model can be provided in DBM, a specific IBM DOC 3.x format. In the present tutorial, we use the JDL format. jdl
Path to your jdl file Since the JDL file must be stored in the directory where you execute the Application Generator script, this will be the local name of your JDL file. entities.jdl

Here is a transcript of a session where an application called capacity-planning was created in the current folder:

$ ./generator.sh
Mounting /Users/alice/Work/example as generation folder
Generating using version 4.4.0-SNAPSHOT

**********************************************************
Platform CLI Project Generator
Copyright (c) 2020 DecisionBrain SAS. All Rights Reserved.
**********************************************************

? Your project name  capacity-planning
? Project title (will appear in the interface and documentation)  Capacity Planning
? The project generation destination  .
? Your project package  com.example.capacity-planning
? Collector class name (no package, e.g. MyCollector)  CapacityPlanning
? What type of your model definition do you have? DOC 3.9 (dbm file) or jdl ?  jdl
? Path to your jdl file  entities.jdl
   create capacity-planning/.gitattributes
   create capacity-planning/README.md
   create capacity-planning/build.gradle
...
   create capacity-planning/gene-model/spec/entities.jdl
...
Processing dotfiles
    /tmp/capacity-planning/.gitignore
    /tmp/capacity-planning/workers/python-engine-worker/worker-shell/.gitignore
    /tmp/capacity-planning/web/.gitignore
    /tmp/capacity-planning/web/.npmrc

Note that the Application Generator tool has copied your original JDL file to the gene-model/spec subdirectory of the project that was generated (see near the end of the transcript above). Should you want to change your data model in the future, you should edit this file. The original file is not used in the generated application.

Also, you can notice that the original JDL file that you used as input to the Application Generator tool contains a <%=collectorClass%> placeholder. If you need to generate your project again and provide a different collector class name, be sure to use your original JDL file.

The next steps include building the application, the code of which was just generated. This requires to configure the access to DecisionBrain repositories. Both aspects are covered in the next sections.