-
Notifications
You must be signed in to change notification settings - Fork 26
/
jboss-kie-wildfly-common.sh
executable file
·70 lines (61 loc) · 2.32 KB
/
jboss-kie-wildfly-common.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
source "${JBOSS_HOME}/bin/launch/logging.sh"
function prepareEnv() {
# please keep these in alphabetical order
unset KIE_MBEANS
unset_kie_security_auth_env
unset LOGGER_PATTERN
}
function configureEnv() {
configure
}
function configure() {
configure_mem_ratio
configure_mbeans
configure_formatter
}
function configure_mem_ratio() {
export JAVA_MAX_MEM_RATIO=${JAVA_MAX_MEM_RATIO:-80}
export JAVA_INITIAL_MEM_RATIO=${JAVA_INITIAL_MEM_RATIO:-25}
}
function configure_maven_settings() {
# env var used by KIE to first find and load global settings.xml
local m2Home=$(mvn -v | grep -i 'maven home: ' | sed -E 's/^.{12}//')
export M2_HOME="${m2Home}"
# KIECLOUD-304
local mavenSettings="${HOME}/.m2/settings.xml"
# maven module already takes care if the provided file exist, if a non existent file or directory is set
# it will automatically fallback to the default settings.xml
if [ ! -z "${MAVEN_SETTINGS_XML}" -a "${MAVEN_SETTINGS_XML}" != "${mavenSettings}" ]; then
log_info "Custom maven settings provided, validating ${MAVEN_SETTINGS_XML}."
validationResult=$(mvn help:effective-settings -s "${MAVEN_SETTINGS_XML}")
if [ $? -eq 0 ]; then
mavenSettings="${MAVEN_SETTINGS_XML}"
else
log_error "$validationResult"
log_info "Falling back to ${mavenSettings}"
fi
fi
# see scripts/jboss-kie-wildfly-common/configure.sh
# used by KIE to then override with custom settings.xml
JBOSS_KIE_ARGS="${JBOSS_KIE_ARGS} -Dkie.maven.settings.custom=${mavenSettings}"
}
function configure_mbeans() {
# should jmx mbeans be enabled? (true/false becomes enabled/disabled)
local kieMbeans="enabled"
if [ "x${KIE_MBEANS}" != "x" ]; then
# if specified, respect value
local km=$(echo "${KIE_MBEANS}" | tr "[:upper:]" "[:lower:]")
if [ "${km}" != "true" ] && [ "${km}" != "enabled" ]; then
kieMbeans="disabled"
fi
fi
JBOSS_KIE_ARGS="${JBOSS_KIE_ARGS} -Dkie.mbeans=${kieMbeans} -Dkie.scanner.mbeans=${kieMbeans}"
}
function configure_formatter(){
local pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"
if [ "x${LOGGER_PATTERN}" != "x" ]; then
pattern=${LOGGER_PATTERN}
fi
sed -i "s|##PATTERN_FORMATTER##|${pattern}|" $CONFIG_FILE
}