You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: decisioncenter/dynamicdomain/README-DOCKER.md
+51-22Lines changed: 51 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -7,33 +7,61 @@ Doing so, you do not need to have ODM installed. Instead we are relying on the [
7
7
8
8
Before following the steps below, make sure you have built the customization JAR as explained in [README.md](README.md).
9
9
10
-
# Configuring the sample for Docker
10
+
# Configuring the Sample for Docker
11
11
12
-
## 1. Start the ODM container
12
+
## 1. Build the Sample Code
13
13
14
-
- Run
15
-
```bash
16
-
docker-compose up odm-dynamic-domain &
17
-
```
14
+
The following steps show how to compile the sample code into a JAR file using a Docker container with Maven and JDK 17.
18
15
19
-
- Then, run
20
-
```bash
21
-
docker-compose exec odm-dynamic-domain sh -c "cp /config/resources/h2*.jar /config/apps/decisioncenter.war/WEB-INF/lib/h2.jar"
22
-
docker-compose restart odm-dynamic-domain
23
-
```
16
+
1. Navigate to the project directory:
17
+
```bash
18
+
cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
19
+
```
24
20
25
-
## 2. Initializing the dynamic domains database
21
+
2. Run the command below to build the JAR file:
22
+
```bash
23
+
docker run --rm \
24
+
-v "$(pwd)":/usr/src/sample \
25
+
-w /usr/src/sample \
26
+
maven:3.8.5-openjdk-17 \
27
+
mvn clean install -Dtarget.docker
28
+
```
29
+
> **Result**: The generated JAR file will be located in the `target` directory with the name `bomdomainpopulate-1.0.jar`.
26
30
27
-
- Run
28
-
```bash
29
-
docker-compose exec odm-dynamic-domain sh -c "java \
30
-
-cp /config/resources/h2*.jar \
31
-
org.h2.tools.RunScript \
32
-
-url jdbc:h2:/config/dbdata/bomdomain \
33
-
-user sa \
34
-
-script /script/sql/createAndPopulate.sql \
35
-
-showResults"
36
-
```
31
+
32
+
## 2. Start the ODM Container
33
+
34
+
To set up the ODM container with dynamic domain support:
35
+
36
+
1. Start the ODM container:
37
+
```bash
38
+
docker-compose up odm-dynamic-domain &
39
+
```
40
+
> **Explanation**: This command initializes the ODM environment required for the sample.
41
+
42
+
2. Copy and configure the H2 database library for Decision Center:
43
+
```bash
44
+
docker-compose exec odm-dynamic-domain sh -c "cp /config/resources/h2*.jar /config/apps/decisioncenter.war/WEB-INF/lib/h2.jar"
45
+
docker-compose restart odm-dynamic-domain
46
+
```
47
+
> **Explanation**: The H2 database library is needed to support the dynamic domains sample. Restarting ensures all configurations take effect.
48
+
49
+
50
+
## 3. Initialize the Dynamic Domains Database
51
+
52
+
To set up and populate the dynamic domains database:
53
+
54
+
1. Run the initialization script:
55
+
```bash
56
+
docker-compose exec odm-dynamic-domain sh -c "java \
57
+
-cp /config/resources/h2*.jar \
58
+
org.h2.tools.RunScript \
59
+
-url jdbc:h2:/config/dbdata/bomdomain \
60
+
-user sa \
61
+
-script /script/sql/createAndPopulate.sql \
62
+
-showResults"
63
+
```
64
+
> **Explanation**: This command initializes the H2 database schema for the sample and populates it with the necessary data, enabling ODM to recognize and use the dynamic domain setup.
37
65
38
66
# Using the sample
39
67
@@ -49,6 +77,7 @@ Before following the steps below, make sure you have built the customization JAR
49
77
1. Navigate to the **Library** tab.
50
78
1. Import the rule project archive `projects/bomdomainpopulate-rules.zip`.
51
79
> Note: this rule project `bomdomainpopulate-rules` is only aimed at editing rules to demonstrate loading domains from a database. It is missing a deployment configuration and cannot be executed.
80
+
1.**Navigate to the Library** tab. Select the **bomdomainpopulate-rules** box (click anywhere except the name) and choose the **main branch**.
52
81
1. Display the rule `CheckOrder > OrderType`. Notice the error **Value (string) 'CompanyX' is incorrect**. Edit the rule and either remove **"CompanyX"** and press SPACE or double-click **"CompanyX"**. A list of suitable companies gets displayed in a drop-down. Close down the rule without saving.
53
82
1. Display the rule `CheckCurrency > CurrencyRestriction`. No warning is displayed.
54
83
1. Let's now make some changes in the dynamic domains in the database. Run:
The class that implements the customization must be declared:
79
93
- either using a custom setting
80
94
- or using a JVM parameter
81
95
82
-
### 3.1 Using a custom setting
96
+
### 4.1 Using a custom setting
83
97
1. Log in into the Business Console as an admin
84
98
1. Navigate to **Administration > Settings > Custom Settings**
85
99
1. Click the *Add custom setting***icon** and set:
@@ -89,14 +103,14 @@ The class that implements the customization must be declared:
89
103
- leave `default value` empty
90
104
1. Set the value to `ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider`
91
105
92
-
### 3.2 Using a JVM parameter
106
+
### 4.2 Using a JVM parameter
93
107
94
108
Follow instructions similar to [here](https://www.ibm.com/docs/en/odm/9.0.0?topic=kubernetes-persisting-decision-center-ruleset-cache) to add the JVM parameter below: (using in a Config Map referenced by the Helm parameter **decisionCenter.jvmOptionsRef**)
- Undeploy ODM for developer (especially if you continue this tutorial on [Docker](README-DOCKER.md) to avoid a TCP/IP port usage conflict) :
94
-
```
95
-
docker-compose down
96
-
```
97
-
98
-
1. Build the JAR
99
-
100
-
The instructions below enable to build the JAR using a Docker container featuring Maven and a JDK version 17. For ODM 8.12, you must use `maven:3.8.1-openjdk-11` instead and `maven:3.8-adoptopenjdk-8`for earlier releases.
101
-
102
-
Run one of the command below in the `decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate` directory:
103
-
- to use the sample on **Kubernetes**:
104
-
```bash
105
-
docker run --rm \
106
-
-v "$(pwd)":/usr/src/sample \
107
-
-w /usr/src/sample \
108
-
maven:3.8.5-openjdk-17 \
109
-
mvn clean install
110
-
```
111
-
112
-
- to use the sample on **Docker**:
113
-
```bash
114
-
docker run --rm \
115
-
-v "$(pwd)":/usr/src/sample \
116
-
-w /usr/src/sample \
117
-
maven:3.8.5-openjdk-17 \
118
-
mvn clean install -Dtarget.docker
119
-
```
120
-
121
-
The JAR is generated in the `target` directory and is named `bomdomainpopulate-1.0.jar`.
65
+
### 3) Retrieve ODM Libraries
66
+
67
+
To use the sample in Decision Center, you need to build a JAR file that depends on IBM ODM libraries for compilation.
68
+
69
+
#### Steps:
70
+
71
+
1.**Navigate to the Sample Source Directory**
72
+
73
+
Move to the source directory for the BOM dynamic domain sample:
74
+
```bash
75
+
cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
76
+
```
77
+
78
+
2.**Deploy ODM for Developer Using Docker**
79
+
80
+
Start the ODM for Developer Docker image to quickly access the necessary libraries:
81
+
```bash
82
+
docker-compose up odm &
83
+
```
84
+
85
+
3.**Download the Decision Center Client API**
86
+
87
+
Retrieve the required libraries by downloading `decision-center-client-api.zip` from the local ODM instance:
0 commit comments