You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.8 KiB
119 lines
3.8 KiB
3 years ago
|
#!/usr/bin/env bash
|
||
|
if [ ! -z "${IGNITE_SCRIPT_STRICT_MODE:-}" ]
|
||
|
then
|
||
|
set -o nounset
|
||
|
set -o errexit
|
||
|
set -o pipefail
|
||
|
set -o errtrace
|
||
|
set -o functrace
|
||
|
fi
|
||
|
|
||
|
#
|
||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||
|
# contributor license agreements. See the NOTICE file distributed with
|
||
|
# this work for additional information regarding copyright ownership.
|
||
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||
|
# (the "License"); you may not use this file except in compliance with
|
||
|
# the License. You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
#
|
||
|
|
||
|
#
|
||
|
# Ignite database connector.
|
||
|
#
|
||
|
|
||
|
#
|
||
|
# Import common functions.
|
||
|
#
|
||
|
if [ "${IGNITE_HOME:-}" = "" ];
|
||
|
then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")";
|
||
|
else IGNITE_HOME_TMP=${IGNITE_HOME};
|
||
|
fi
|
||
|
echo "ignite home tmp $IGNITE_HOME_TMP"
|
||
|
#
|
||
|
# Set SCRIPTS_HOME - base path to scripts.
|
||
|
#
|
||
|
#SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin"
|
||
|
SCRIPTS_HOME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||
|
source "${SCRIPTS_HOME}"/include/functions.sh
|
||
|
|
||
|
#
|
||
|
# Discover path to Java executable and check it's version.
|
||
|
#
|
||
|
checkJava
|
||
|
|
||
|
#
|
||
|
# Discover IGNITE_HOME environment variable.
|
||
|
#
|
||
|
#setIgniteHome
|
||
|
|
||
|
if [ "${IGNITE_HOME:-}" = "" ]; then
|
||
|
export IGNITE_HOME=${IGNITE_HOME_TMP}
|
||
|
fi
|
||
|
|
||
|
#
|
||
|
# Set IGNITE_LIBS.
|
||
|
#
|
||
|
. "${SCRIPTS_HOME}"/include/setenv.sh
|
||
|
|
||
|
JVM_OPTS=""
|
||
|
JVM_OPTS=${JVM_OPTS:-}
|
||
|
version=11
|
||
|
#
|
||
|
# Final JVM_OPTS for Java 9+ compatibility
|
||
|
#
|
||
|
if [ $version -eq 8 ] ; then
|
||
|
JVM_OPTS="\
|
||
|
-XX:+AggressiveOpts \
|
||
|
${JVM_OPTS}"
|
||
|
|
||
|
elif [ $version -gt 8 ] && [ $version -lt 11 ]; then
|
||
|
JVM_OPTS="\
|
||
|
-XX:+AggressiveOpts \
|
||
|
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED \
|
||
|
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
|
||
|
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED \
|
||
|
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED \
|
||
|
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \
|
||
|
--illegal-access=permit \
|
||
|
--add-modules=java.xml.bind \
|
||
|
${JVM_OPTS}"
|
||
|
|
||
|
elif [ $version -ge 11 ] ; then
|
||
|
JVM_OPTS="\
|
||
|
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED \
|
||
|
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
|
||
|
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED \
|
||
|
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED \
|
||
|
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \
|
||
|
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED \
|
||
|
--illegal-access=permit \
|
||
|
${JVM_OPTS}"
|
||
|
fi
|
||
|
|
||
|
|
||
|
JDBCLINK="jdbc:ignite:thin://${HOST_AND_PORT:-}${SCHEMA_DELIMITER:-}${SCHEMA:-}${PARAMS:-}"
|
||
|
|
||
|
#CP="${IGNITE_LIBS}"
|
||
|
|
||
|
#CP="${CP}${SEP}${IGNITE_HOME_TMP}/bin/include/sqlline/*"
|
||
|
CP=""
|
||
|
# Between version 2 and 3, jline changed the format of its history file. After this change,
|
||
|
# the Ignite provides --historyfile argument to SQLLine usage
|
||
|
SQLLINE_HISTORY="~/.sqlline/ignite_history"
|
||
|
|
||
|
parentSCRIPT_HOME="$(dirname "$PWD")/apache-ignite-2.11.0-bin"
|
||
|
if [ "$CP" == "" ]; then
|
||
|
CP=$parentSCRIPT_HOME/libs/*:$parentSCRIPT_HOME/libs/ignite-control-utility/*:$parentSCRIPT_HOME/libs/ignite-indexing/*:$parentSCRIPT_HOME/libs/ignite-spring/*:$parentSCRIPT_HOME/libs/licenses/*:$parentSCRIPT_HOME/bin/include/sqlline/*
|
||
|
fi
|
||
|
|
||
|
echo "$JAVA ${JVM_OPTS} -cp ${CP} sqlline.SqlLine --historyFile=${SQLLINE_HISTORY} $@"
|
||
|
java ${JVM_OPTS} -cp ${CP} sqlline.SqlLine --historyFile=${SQLLINE_HISTORY} $@
|