Skip to content

Commit 7ed7f2b

Browse files
poc of create jrf domain with js atp changes
1 parent 73e8143 commit 7ed7f2b

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. */
2+
3+
package com.oracle.weblogicx.imagebuilder.api.model;
4+
5+
/**
6+
* Supported domain type. wls, jrf or restricted jrf.
7+
*/
8+
public enum DomainType {
9+
WLS("wls"),
10+
JRF("jrf"),
11+
RestrictedJRF("rjrf");
12+
13+
private String value;
14+
15+
DomainType(String value) {
16+
this.value = value;
17+
}
18+
19+
/*
20+
@Override
21+
public String toString() {
22+
return value;
23+
}
24+
*/
25+
26+
public static DomainType fromValue(String value) {
27+
for (DomainType eachType : DomainType.values()) {
28+
if (eachType.value.equalsIgnoreCase(value)) {
29+
return eachType;
30+
}
31+
}
32+
throw new IllegalArgumentException("argument " + value + " does not match any DomainType");
33+
}
34+
}
35+

src/main/java/com/oracle/weblogicx/imagebuilder/cli/menu/CreateImage.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package com.oracle.weblogicx.imagebuilder.cli.menu;
44

55
import com.oracle.weblogicx.imagebuilder.api.model.CommandResponse;
6+
import com.oracle.weblogicx.imagebuilder.api.model.DomainType;
67
import com.oracle.weblogicx.imagebuilder.api.model.InstallerType;
78
import com.oracle.weblogicx.imagebuilder.api.model.WLSInstallerType;
89
import com.oracle.weblogicx.imagebuilder.impl.InstallerFile;
@@ -185,6 +186,17 @@ private List<String> handleWDTArgsIfRequired(Path tmpDir) throws IOException {
185186
String tmpDirPath = tmpDir.toAbsolutePath().toString();
186187
if (wdtModelPath != null) {
187188
if (Files.isRegularFile(wdtModelPath)) {
189+
if (domainType != DomainType.WLS) {
190+
if (installerType != WLSInstallerType.FMW) {
191+
throw new IOException("FMW installer is required for JRF domain");
192+
}
193+
retVal.add(BUILD_ARG);
194+
retVal.add("DOMAIN_TYPE=" + domainType);
195+
if (rcu_run_flag) {
196+
retVal.add(BUILD_ARG);
197+
retVal.add("RCU_RUN_FLAG=" + "-run_rcu");
198+
}
199+
}
188200
filterStartTags.add("WDT_");
189201
Path targetLink = Files.createLink(Paths.get(tmpDirPath, wdtModelPath.getFileName().toString()), wdtModelPath);
190202
retVal.add(BUILD_ARG);
@@ -345,4 +357,18 @@ private void copyResponseFilesToDir(String dirPath) throws IOException {
345357
defaultValue = "latest"
346358
)
347359
private String wdtVersion;
360+
361+
@Option(
362+
names = {"--domainType"},
363+
description = "type of domain to create. default: ${DEFAULT-VALUE}. supported values: ${COMPLETION-CANDIDATES}",
364+
defaultValue = "wls",
365+
required = true
366+
)
367+
private DomainType domainType;
368+
369+
@Option(
370+
names = "--run_rcu",
371+
description = "whether to run rcu to create the required database schemas"
372+
)
373+
private boolean rcu_run_flag = false;
348374
}

src/main/resources/docker-files/Dockerfile.ph

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ARG ADMIN_PORT
1818
ARG MANAGED_SERVER_PORT
1919
ARG SCRIPTS_DIR
2020
ARG WDT_HOME
21+
ARG RCU_RUN_FLAG
2122
# END %%WDT_ARGS%% #
2223

2324
# START %%WDT_ENV%% #
@@ -36,7 +37,8 @@ ENV WDT_PKG=${WDT_PKG:-weblogic-deploy.zip} \
3637
PROPERTIES_FILE_DIR=$ORACLE_HOME/properties \
3738
SCRIPT_HOME="${ORACLE_HOME}" \
3839
WDT_HOME=${WDT_HOME:-/u01/app/weblogic-deploy} \
39-
SCRIPTS_DIR=${SCRIPTS_DIR:-scripts}
40+
SCRIPTS_DIR=${SCRIPTS_DIR:-scripts} \
41+
RCU_RUN_FLAG=${RCU_RUN_FLAG:-}
4042

4143
# DO NOT COMBINE THESE BLOCKS. It won't work when formatting variables like DOMAIN_HOME
4244
ENV DOMAIN_HOME=${DOMAIN_PARENT}/${DOMAIN_NAME} \
@@ -57,12 +59,14 @@ RUN mkdir -p $(dirname ${DOMAIN_HOME}) \
5759
&& if [ -n "$WDT_MODEL" ]; then MODEL_OPT="-model_file ${OTMPDIR}/${WDT_MODEL##*/}"; fi \
5860
&& if [ -n "$WDT_ARCHIVE" ]; then ARCHIVE_OPT="-archive_file ${OTMPDIR}/${WDT_ARCHIVE##*/}"; fi \
5961
&& if [ -n "$WDT_VARIABLE" ]; then VARIABLE_OPT="-variable_file ${OTMPDIR}/${WDT_VARIABLE##*/}"; fi \
62+
&& if [ -n "${RCU_RUN_FLAG}" ]; then RCU_RUN_OPT="-run_rcu"; fi \
6063
&& cd ${WDT_HOME}/bin \
6164
&& ${WDT_HOME}/bin/createDomain.sh \
6265
-oracle_home ${ORACLE_HOME} \
6366
-java_home ${JAVA_HOME} \
6467
-domain_home ${DOMAIN_HOME} \
6568
-domain_type ${DOMAIN_TYPE} \
69+
$RCU_RUN_OPT \
6670
$VARIABLE_OPT \
6771
$MODEL_OPT \
6872
$ARCHIVE_OPT \

0 commit comments

Comments
 (0)