Skip to content

Commit 593bc1c

Browse files
authored
Added default response files for FMW installers (#126)
* use template for silent install response file * moved installer types to installer package/folder * move default response strings to DefaultResponseFile to support multiple default response files per installer * correct import ordering after moving packages * corrected default response file for OHS_WLS * added response files for IDM and managed IDM
1 parent 49156db commit 593bc1c

22 files changed

+134
-67
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/model/CachedFile.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.nio.file.Paths;
1212

1313
import com.oracle.weblogic.imagetool.cachestore.CacheStore;
14+
import com.oracle.weblogic.imagetool.installer.InstallerType;
1415
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
1516
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
1617
import com.oracle.weblogic.imagetool.util.Utils;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/cache/AddInstallerEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import java.nio.file.Path;
88

99
import com.oracle.weblogic.imagetool.api.model.CommandResponse;
10-
import com.oracle.weblogic.imagetool.api.model.InstallerType;
1110
import com.oracle.weblogic.imagetool.cachestore.CacheStore;
11+
import com.oracle.weblogic.imagetool.installer.InstallerType;
1212
import com.oracle.weblogic.imagetool.util.Utils;
1313
import picocli.CommandLine.Command;
1414
import picocli.CommandLine.Option;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/cache/AddPatchEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import java.util.List;
1010

1111
import com.oracle.weblogic.imagetool.api.model.CommandResponse;
12-
import com.oracle.weblogic.imagetool.api.model.FmwInstallerType;
1312
import com.oracle.weblogic.imagetool.cachestore.CacheStore;
13+
import com.oracle.weblogic.imagetool.installer.FmwInstallerType;
1414
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
1515
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
1616
import com.oracle.weblogic.imagetool.util.Constants;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CommonOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
import java.util.stream.Stream;
1919

2020
import com.oracle.weblogic.imagetool.api.model.CachedFile;
21-
import com.oracle.weblogic.imagetool.api.model.FmwInstallerType;
2221
import com.oracle.weblogic.imagetool.cachestore.CacheStore;
2322
import com.oracle.weblogic.imagetool.cachestore.CacheStoreFactory;
2423
import com.oracle.weblogic.imagetool.cachestore.CachedPatchFile;
24+
import com.oracle.weblogic.imagetool.installer.FmwInstallerType;
2525
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
2626
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
2727
import com.oracle.weblogic.imagetool.util.ARUUtil;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CreateImage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
import com.oracle.weblogic.imagetool.api.model.CachedFile;
1515
import com.oracle.weblogic.imagetool.api.model.CommandResponse;
16-
import com.oracle.weblogic.imagetool.api.model.FmwInstallerType;
17-
import com.oracle.weblogic.imagetool.api.model.InstallerType;
16+
import com.oracle.weblogic.imagetool.installer.FmwInstallerType;
17+
import com.oracle.weblogic.imagetool.installer.InstallerType;
1818
import com.oracle.weblogic.imagetool.installer.MiddlewareInstall;
1919
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
2020
import com.oracle.weblogic.imagetool.logging.LoggingFactory;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/RebaseImage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import java.util.concurrent.Callable;
1414

1515
import com.oracle.weblogic.imagetool.api.model.CommandResponse;
16-
import com.oracle.weblogic.imagetool.api.model.FmwInstallerType;
16+
import com.oracle.weblogic.imagetool.installer.FmwInstallerType;
1717
import com.oracle.weblogic.imagetool.installer.MiddlewareInstall;
1818
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
1919
import com.oracle.weblogic.imagetool.logging.LoggingFactory;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/UpdateImage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.util.concurrent.Callable;
1515

1616
import com.oracle.weblogic.imagetool.api.model.CommandResponse;
17-
import com.oracle.weblogic.imagetool.api.model.FmwInstallerType;
17+
import com.oracle.weblogic.imagetool.installer.FmwInstallerType;
1818
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
1919
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
2020
import com.oracle.weblogic.imagetool.util.ARUUtil;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/WLSInstallHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.Properties;
99

1010
import com.oracle.weblogic.imagetool.api.model.CachedFile;
11-
import com.oracle.weblogic.imagetool.api.model.InstallerType;
11+
import com.oracle.weblogic.imagetool.installer.InstallerType;
1212
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
1313
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
1414
import com.oracle.weblogic.imagetool.util.Constants;

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/WdtOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
import java.util.List;
1313

1414
import com.oracle.weblogic.imagetool.api.model.CachedFile;
15-
import com.oracle.weblogic.imagetool.api.model.FmwInstallerType;
16-
import com.oracle.weblogic.imagetool.api.model.InstallerType;
1715
import com.oracle.weblogic.imagetool.cachestore.CacheStore;
1816
import com.oracle.weblogic.imagetool.cachestore.CacheStoreFactory;
17+
import com.oracle.weblogic.imagetool.installer.FmwInstallerType;
18+
import com.oracle.weblogic.imagetool.installer.InstallerType;
1919
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
2020
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
2121
import com.oracle.weblogic.imagetool.util.DockerfileOptions;

imagetool/src/main/java/com/oracle/weblogic/imagetool/installer/DefaultResponseFile.java

Lines changed: 99 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,125 @@
33

44
package com.oracle.weblogic.imagetool.installer;
55

6+
import java.io.File;
7+
import java.io.FileWriter;
68
import java.io.IOException;
79

10+
import com.github.mustachejava.DefaultMustacheFactory;
11+
import com.github.mustachejava.Mustache;
12+
import com.github.mustachejava.MustacheFactory;
813
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
914
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
10-
import com.oracle.weblogic.imagetool.util.Utils;
1115

1216
public class DefaultResponseFile implements ResponseFile {
1317
private static final LoggingFacade logger = LoggingFactory.getLogger(DefaultResponseFile.class);
1418

15-
private String resource;
16-
private String filename;
19+
private static final String R_WLS = "WebLogic Server";
20+
private static final String R_FMW = "Fusion Middleware Infrastructure";
21+
private static final String R_SOA = "SOA Suite";
22+
private static final String R_OSB = "Service Bus";
23+
private static final String R_OHS = "Standalone HTTP Server (Managed independently of WebLogic server)";
24+
private static final String R_OHS_WLS = "Collocated HTTP Server (Managed through WebLogic server)";
25+
private static final String R_IDM =
26+
"Standalone Oracle Identity and Access Manager(Managed independently of WebLogic server)";
27+
private static final String R_IDM_WLS =
28+
"Collocated Oracle Identity and Access Manager (Managed through WebLogic server)";
29+
private static final String R_OAM =
30+
"Collocated Oracle Identity and Access Manager (Managed through WebLogic server)";
31+
private static final String R_OUD = "Installation for Oracle Unified Directory";
32+
private static final String R_WCC = "WebCenter Content";
33+
private static final String R_WCP = "WebCenter Portal";
34+
private static final String R_WCS = "WebCenter Sites";
35+
36+
private final String installTypeResponse;
37+
private final String filename;
1738

1839
/**
19-
* Use one of the default response files provided in the tool.
20-
* @param resource the resource path to the response file in this tool
40+
* Use the default response file for FMW installers.
41+
* @param installerType the installer type with which this response file will be used
2142
*/
22-
public DefaultResponseFile(String resource) {
23-
this.resource = resource;
24-
if (resource.contains("/")) {
25-
filename = resource.substring(resource.lastIndexOf("/") + 1);
26-
} else {
27-
filename = resource;
43+
public DefaultResponseFile(InstallerType installerType, FmwInstallerType fmwInstallerType) {
44+
filename = installerType.toString() + ".rsp";
45+
installTypeResponse = getInstallTypeResponse(installerType, fmwInstallerType);
46+
}
47+
48+
private static String getInstallTypeResponse(InstallerType installerType, FmwInstallerType fmwInstallerType) {
49+
String response;
50+
51+
switch (installerType) {
52+
case FMW:
53+
response = R_FMW;
54+
break;
55+
case SOA:
56+
response = R_SOA;
57+
break;
58+
case OSB:
59+
response = R_OSB;
60+
break;
61+
case OHS:
62+
if (FmwInstallerType.OHS == fmwInstallerType) {
63+
response = R_OHS;
64+
} else {
65+
response = R_OHS_WLS;
66+
}
67+
break;
68+
case IDM:
69+
if (FmwInstallerType.IDM == fmwInstallerType) {
70+
response = R_IDM;
71+
} else {
72+
response = R_IDM_WLS;
73+
}
74+
break;
75+
case OAM:
76+
response = R_OAM;
77+
break;
78+
case OUD:
79+
response = R_OUD;
80+
break;
81+
case WCC:
82+
response = R_WCC;
83+
break;
84+
case WCP:
85+
response = R_WCP;
86+
break;
87+
case WCS:
88+
response = R_WCS;
89+
break;
90+
case WLS:
91+
default:
92+
response = R_WLS;
93+
break;
2894
}
95+
96+
97+
return response;
2998
}
3099

100+
/**
101+
* Name for the response file FILE.
102+
* @return filename to use
103+
*/
31104
@Override
32105
public String name() {
33106
return filename;
34107
}
35108

36109
@Override
37110
public void copyFile(String buildContextDir) throws IOException {
38-
Utils.copyResourceAsFile(resource, buildContextDir, false);
111+
logger.entering(buildContextDir, filename, installTypeResponse);
112+
MustacheFactory mf = new DefaultMustacheFactory("response-files");
113+
Mustache mustache = mf.compile("default-response.mustache");
114+
mustache.execute(new FileWriter(buildContextDir + File.separator + filename), this).flush();
115+
logger.exiting();
116+
}
117+
118+
/**
119+
* Get the INPUT_TYPE for the silent install response file.
120+
* Used by response file Mustache template.
121+
* @return the value for the response file's input type field
122+
*/
123+
@SuppressWarnings("unused")
124+
public String installType() {
125+
return installTypeResponse;
39126
}
40127
}

0 commit comments

Comments
 (0)