Skip to content

Commit 06de88d

Browse files
jshum2479ddsharpe
authored andcommitted
Windows support (#61)
* Support MS Windows client
1 parent 85b57db commit 06de88d

File tree

7 files changed

+44
-15
lines changed

7 files changed

+44
-15
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Oracle is finding ways for organizations using WebLogic Server to run important
44
the cloud, and to simplify and speed up the application deployment life cycle. By adopting industry standards, such as Docker
55
and Kubernetes, WebLogic now runs in a cloud neutral infrastructure. To help simplify and automate the creation of
66
Docker images for WebLogic Server, we are providing this open-source
7-
Oracle WebLogic Image Tool. This tool let's you create a new image, with installations of a JDK and WebLogic Server,
7+
Oracle WebLogic Image Tool. This tool let's you create a new Linux based image, with installations of a JDK and WebLogic Server,
88
and optionally, configure a WebLogic domain with your applications, apply WebLogic Server patches, or update an existing
99
image.
1010

@@ -29,7 +29,8 @@ The Image Tool provides three functions within the main script:
2929

3030
- Build the project (`mvn clean package`), to create the ZIP installer in ./imagetool/target.
3131
- Unzip the release ZIP file to a desired location.
32-
- `cd your_unzipped_location/bin` and `source setup.sh`.
32+
- For Linux environment `cd your_unzipped_location/bin` and `source setup.sh`.
33+
- For Windows environment `cd your_unzipped_location\bin` and `.\imagetool.cmd`.
3334
- Run `imagetool help` to show the help screen.
3435

3536
## Quick Start

imagetool/src/assembly/zip.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<outputDirectory>bin</outputDirectory>
1717
<includes>
1818
<include>*.sh</include>
19+
<include>*.cmd</include>
1920
<include>logging.properties</include>
2021
</includes>
2122
<fileMode>0750</fileMode>

imagetool/src/main/bin/imagetool.cmd

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@echo off
2+
@rem **************************************************************************
3+
@rem imagetool.cmd
4+
@rem
5+
@rem Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
6+
@rem Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
7+
8+
IF "%JAVA_HOME%" == "" (
9+
ECHO JAVA_HOME not set. Please set JAVA_HOME to jdk home. OpenJDK is not supported.
10+
EXIT /B 2
11+
)
12+
FOR %%i IN ("%JAVA_HOME%") DO SET JAVA_HOME=%%~fsi
13+
IF %JAVA_HOME:~-1%==\ SET JAVA_HOME=%JAVA_HOME:~0,-1%
14+
IF EXIST %JAVA_HOME%\bin\java.exe (
15+
FOR %%i IN ("%JAVA_HOME%\bin\java.exe") DO SET JAVA_EXE=%%~fsi
16+
) ELSE (
17+
ECHO Java executable does not exist at %JAVA_HOME%\bin\java.exe does not exist >&2
18+
EXIT /B 2
19+
)
20+
FOR /F %%i IN ('%JAVA_EXE% -version 2^>^&1') DO (
21+
IF "%%i" == "OpenJDK" (
22+
ECHO JAVA_HOME %JAVA_HOME% contains OpenJDK^, which is not supported >&2
23+
EXIT /B 2
24+
)
25+
)
26+
SET IMAGETOOL_HOME=%~dp0%/..
27+
%JAVA_HOME%\bin\java -cp %IMAGETOOL_HOME%\lib\* -Djava.util.logging.config.file=%IMAGETOOL_HOME%\bin\logging.properties com.oracle.weblogic.imagetool.cli.CLIDriver %*

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@ private void addWdtUrl(String wdtKey) throws Exception {
358358
* @throws IOException in case of error
359359
*/
360360
private void copyResponseFilesToDir(String dirPath) throws IOException {
361-
if (installerResponseFile != null && Files.isRegularFile(installerResponseFile)) {
361+
if (installerResponseFile != null && Files.isRegularFile(Paths.get(installerResponseFile))) {
362362
logger.fine("IMG-0005", installerResponseFile);
363363
Path target = Paths.get(dirPath, "wls.rsp");
364-
Files.copy(installerResponseFile, target);
364+
Files.copy(Paths.get(installerResponseFile), target);
365365
} else {
366366
final String responseFile = "/response-files/wls.rsp";
367367
logger.fine("IMG-0005", responseFile);
@@ -447,7 +447,7 @@ private void copyResponseFilesToDir(String dirPath) throws IOException {
447447
description = "pass to the -domain_home for wdt",
448448
defaultValue = "/u01/domains/base_domain"
449449
)
450-
private Path wdtDomainHome;
450+
private String wdtDomainHome;
451451

452452

453453
@Option(
@@ -462,5 +462,5 @@ private void copyResponseFilesToDir(String dirPath) throws IOException {
462462
names = {"--installerResponseFile"},
463463
description = "path to a response file. Override the default responses for the Oracle installer"
464464
)
465-
private Path installerResponseFile;
465+
private String installerResponseFile;
466466
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import java.nio.file.Files;
99
import java.nio.file.Path;
1010
import java.nio.file.Paths;
11-
import java.nio.file.attribute.PosixFilePermissions;
1211
import java.util.ArrayList;
1312
import java.util.LinkedList;
1413
import java.util.List;
@@ -176,8 +175,7 @@ List<String> getInitialBuildCmd() {
176175
}
177176

178177
public String getTempDirectory() throws IOException {
179-
Path tmpDir = Files.createTempDirectory(Paths.get(Utils.getBuildWorkingDir()), "wlsimgbuilder_temp",
180-
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-xr-x")));
178+
Path tmpDir = Files.createTempDirectory(Paths.get(Utils.getBuildWorkingDir()), "wlsimgbuilder_temp");
181179
String pathAsString = tmpDir.toAbsolutePath().toString();
182180
logger.info("IMG-0003", pathAsString);
183181
return pathAsString;

imagetool/src/main/java/com/oracle/weblogic/imagetool/util/Utils.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public static void copyResourceAsFile(String resourcePath, String destPath, bool
6868
Files.copy(Utils.class.getResourceAsStream(resourcePath), Paths.get(destPath),
6969
StandardCopyOption.REPLACE_EXISTING);
7070
if (markExec) {
71-
Files.setPosixFilePermissions(Paths.get(destPath), PosixFilePermissions.fromString("r-xr-xr-x"));
71+
if (!System.getProperty("os.name").toLowerCase().startsWith("windows")) {
72+
Files.setPosixFilePermissions(Paths.get(destPath), PosixFilePermissions.fromString("r-xr-xr-x"));
73+
}
7274
}
7375
}
7476

@@ -678,14 +680,14 @@ public static boolean validatePatchIds(List<String> patches, boolean rigid) {
678680
/**
679681
* Set the Oracle Home directory based on the installer response file.
680682
* If no Oracle Home is provided in the response file, do nothing and accept the default value.
681-
* @param installerResponseFile installer response file to parse.
683+
* @param installerResponse installer response file to parse.
682684
* @param options Dockerfile options to use for the build (holds the Oracle Home argument)
683685
*/
684-
public static void setOracleHome(Path installerResponseFile, DockerfileOptions options) throws IOException {
685-
if (installerResponseFile == null) {
686+
public static void setOracleHome(String installerResponse, DockerfileOptions options) throws IOException {
687+
if (installerResponse == null) {
686688
return;
687689
}
688-
690+
Path installerResponseFile = Paths.get(installerResponse);
689691
Pattern pattern = Pattern.compile("^ORACLE_HOME=(.*)?");
690692
Matcher matcher = pattern.matcher("");
691693
logger.finest("Reading installer response file: {0}", installerResponseFile.getFileName());

site/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Quick Start
22

3-
The Image Tool supports creating WebLogic Docker images, applying WebLogic patches, and creating WebLogic domains. It
3+
The Image Tool supports creating Linux based WebLogic Docker images, applying WebLogic patches, and creating WebLogic domains. It
44
can be used with or without Internet access.
55

66
Before you use the tool, you can customize the tool's cache store. The cache store is used to look up where the Java,

0 commit comments

Comments
 (0)