Skip to content

Commit 846b968

Browse files
Wdt 427 wdt support graal (#658)
* changes for graal * Put in appropriate graalvm checks into scripts
1 parent e18256c commit 846b968

File tree

6 files changed

+69
-12
lines changed

6 files changed

+69
-12
lines changed

core/src/main/python/wlsdeploy/aliases/alias_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def merge_model_and_existing_properties(model_props, existing_props, string_prop
111111
result = _properties_to_string(existing_props, string_props_separator_char)
112112
else:
113113
model_props_is_string = False
114-
if type(model_props) is str:
114+
if type(model_props) in [str, unicode]:
115115
model_props_is_string = True
116116
model_properties = _string_to_properties(model_props, string_props_separator_char)
117117
elif TypeUtils.isInstanceOfClass(Properties().getClass(), model_props):
@@ -121,7 +121,7 @@ def merge_model_and_existing_properties(model_props, existing_props, string_prop
121121
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)
122122
raise ex
123123

124-
if type(existing_props) is str:
124+
if type(existing_props) in [str, unicode]:
125125
existing_properties = _string_to_properties(existing_props, string_props_separator_char)
126126
elif TypeUtils.isInstanceOfClass(Properties().getClass(), existing_props):
127127
existing_properties = existing_props
@@ -1118,7 +1118,7 @@ def _create_set(list_item, string_list_separator_char, message_key):
11181118
_method_name = '_create_set'
11191119

11201120
item_type = type(list_item)
1121-
if item_type is str:
1121+
if item_type in [str, unicode]:
11221122
item_set = Set([x.strip() for x in list_item.split(string_list_separator_char)])
11231123
elif item_type is list or item_type is array:
11241124
item_set = Set(list_item)

core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def __build_library_deploy_strategy(self, location, model_libs, existing_libs, e
553553
model_src_path = dictionary_utils.get_element(lib_dict, SOURCE_PATH)
554554
model_targets = dictionary_utils.get_element(lib_dict, TARGET)
555555
# Model Target could be a comma-delimited string or a list...
556-
if type(model_targets) is str:
556+
if type(model_targets) in [str, unicode]:
557557
model_targets = model_targets.split(',')
558558

559559
existing_lib_targets = dictionary_utils.get_element(existing_lib_ref, 'target')

core/src/main/python/wlsdeploy/tool/deploy/deployer_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ def merge_lists(existing_list, model_list, separator=',', return_as_string=True)
156156
method_name = 'merge_lists'
157157
_logger.entering(existing_list, model_list, separator, return_as_string, _class_name, method_name)
158158
if existing_list is not None and len(existing_list) > 0:
159-
if type(existing_list) is str:
159+
if type(existing_list) in [str, unicode]:
160160
existing_set = Set(existing_list.split(separator))
161161
else:
162162
existing_set = Set(existing_list)
163163
else:
164164
existing_set = Set()
165165

166166
if model_list is not None and len(model_list) > 0:
167-
if type(model_list) is str:
167+
if type(model_list) in [str, unicode]:
168168
model_set = Set(model_list.split(separator))
169169
else:
170170
model_set = Set(model_list)

core/src/main/python/wlsdeploy/tool/util/wlst_helper.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55

6+
import types
7+
68
import com.oracle.cie.domain.script.jython.WLSTException as offlineWLSTException
79
import oracle.weblogic.deploy.util.StringUtils as StringUtils
810
import weblogic.management.mbeanservers.edit.ValidationException as ValidationException
@@ -430,7 +432,7 @@ def lsa(self, path=None, log_throwing=True):
430432
for entry in result.entrySet():
431433
key = entry.getKey()
432434
value = entry.getValue()
433-
if value and type(value) is str:
435+
if value and type(value) in [str, unicode]:
434436
new_value = value.rstrip()
435437
if new_value == 'null' or new_value == 'none':
436438
make_dict[key] = None

installer/src/main/bin/shared.cmd

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,48 @@ GOTO :ENDFUNCTIONS
4141
EXIT /B 2
4242
)
4343

44-
FOR /F %%i IN ('%JAVA_EXE% -version 2^>^&1') DO (
45-
IF "%%i" == "OpenJDK" (
46-
ECHO JAVA_HOME %JAVA_HOME% contains OpenJDK^, which is not supported >&2
44+
SET OPEN_JDK=false
45+
SET ORACLE_ONE=0
46+
SET ORACLE_TWO=0
47+
FOR /F "token\s=1,5" %%x IN ('%JAVA_EXE% -version 2^>^&1') DO (
48+
IF "%%x" == "OpenJDK" (
49+
SET OPEN_JDK=true
50+
IF EXIST %ORACLE_HOME%\wlserver\server\lib\weblogic.jar (
51+
FOR /F "tokens=1-3 delims= " %%A IN ('%JAVA_EXE% -cp %ORACLE_HOME%\wlserver\server\lib\weblogic.jar weblogic.version 2^>^&1') DO (
52+
IF "%%A" == "WebLogic" (
53+
FOR /F "tokens=1-5 delims=." %%j IN ('ECHO %%C') DO (
54+
SET "ORACLE_VERSION=%%j.%%k.%%l.%%m.%%n"
55+
SET "ORACLE_ONE=%%j"
56+
SET "ORACLE_TWO=%%l"
57+
)
58+
)
59+
)
60+
SET GRAALVM=false
61+
IF "%%y" == "GraalVM" SET GRAALVM=true
62+
) ELSE (
63+
ECHO JAVA_HOME %JAVA_HOME% contains OpenJDK^, which is not supported >&2
64+
EXIT /B 2
65+
)
66+
)
67+
)
68+
69+
SET NOT_VALID=false
70+
IF "%OPEN_JDK%"=="true" (
71+
IF "%GRAALVM%"=="false" SET NOT_VALID=true
72+
IF %ORACLE_ONE% LSS 14 (
73+
SET NOT_VALID=true
74+
) ELSE IF %ORACLE_ONE% EQU 14 IF %ORACLE_TWO% LSS 2 SET NOT_VALID=true
75+
SET JAVA_VENDOR=GraalVM
76+
)
77+
78+
IF "%NOT_VALID%"=="true" (
79+
IF "%GRAALVM%"=="true" (
80+
SET ORACLE_VERSION
81+
ECHO JAVA_HOME %JAVA_HOME% contains GraalVM OpenJDK^, which is not supported in versions before 14.1.2 >&2
82+
EXIT /B 2
83+
)
84+
ECHO JAVA_HOME %JAVA_HOME% contains OpenJDK^, which is not supported. >&2
4785
EXIT /B 2
48-
)
4986
)
5087

5188
FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO (
@@ -70,7 +107,7 @@ GOTO :ENDFUNCTIONS
70107
EXIT /B 2
71108
) ELSE (
72109
ECHO JDK version is %JVM_FULL_VERSION%, setting JAVA_VENDOR to Sun...
73-
SET JAVA_VENDOR=Sun
110+
IF "%JAVA_VENDOR%"=="" SET JAVA_VENDOR=Sun
74111
)
75112
GOTO :EOF
76113

installer/src/main/bin/shared.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,25 @@ javaSetup() {
3434
fi
3535

3636
JVM_OUTPUT=`${JAVA_EXE} -version 2>&1`
37+
3738
case "${JVM_OUTPUT}" in
39+
*GraalVM*)
40+
setOracleVersion
41+
if [ -z "${ORACLE_VERSION}" ] || [ ${ORACLE_VER_ONE} -lt 14 ] || [ ${ORACLE_VER_ONE} -eq 14 ] && [ ${ORACLE_VER_THREE} -lt 2 ]; then
42+
echo "JAVA_HOME ${JAVA_HOME} contains GraalVM OpenJDK, which is not supported before 14.1.2" >&2
43+
exit 2
44+
fi
45+
;;
3846
*OpenJDK*)
3947
echo "JAVA_HOME ${JAVA_HOME} contains OpenJDK, which is not supported" >&2
4048
exit 2
4149
;;
50+
4251
esac
4352

53+
4454
JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'`
55+
4556
# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version
4657
JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'`
4758

@@ -57,6 +68,13 @@ javaSetup() {
5768
fi
5869
}
5970

71+
setOracleVersion() {
72+
ORACLE_VERSION=`${JAVA_HOME}/bin/java -cp $ORACLE_HOME/wlserver/server/lib/weblogic.jar weblogic.version | grep "WebLogic Server" | cut -d " " -f3 2>&1`
73+
ORACLE_VER_ONE=`echo ${ORACLE_VERSION} | cut -d "." -f1`
74+
ORACLE_VER_THREE=`echo ${ORACLE_VERSION} | cut -d "." -f3`
75+
echo ORACLE_VERSION=$ORACLE_VERSION
76+
}
77+
6078
checkArgs() {
6179
checkJythonArgs $*
6280
}

0 commit comments

Comments
 (0)