IGNITE-5608: Added sqlline utility to the build. This closes #2861.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5128c257 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5128c257 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5128c257 Branch: refs/heads/ignite-3478 Commit: 5128c257b979e391ed04baf3607103b6597067a9 Parents: 12bc756 Author: Oleg Ostanin <oosta...@gridgain.com> Authored: Wed Oct 18 14:14:41 2017 +0300 Committer: devozerov <voze...@gridgain.com> Committed: Wed Oct 18 14:14:41 2017 +0300 ---------------------------------------------------------------------- assembly/dependencies-sqlline.xml | 65 +++++++++++++++++++ modules/sqlline/bin/ignitesql.bat | 112 +++++++++++++++++++++++++++++++++ modules/sqlline/bin/ignitesql.sh | 54 ++++++++++++++++ modules/sqlline/pom.xml | 74 ++++++++++++++++++++++ pom.xml | 17 +++++ 5 files changed, 322 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/assembly/dependencies-sqlline.xml ---------------------------------------------------------------------- diff --git a/assembly/dependencies-sqlline.xml b/assembly/dependencies-sqlline.xml new file mode 100644 index 0000000..f8953a1 --- /dev/null +++ b/assembly/dependencies-sqlline.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 + http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>dependencies-sqlline</id> + + <formats> + <format>dir</format> + </formats> + + <includeBaseDirectory>false</includeBaseDirectory> + + <moduleSets> + <moduleSet> + <includes> + <include>org.apache.ignite:ignite-sqlline</include> + </includes> + <sources> + <includeModuleDirectory>false</includeModuleDirectory> + <fileSets> + <fileSet> + <directory>target</directory> + <outputDirectory>include/sqlline</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + <excludes> + <exclude>*-tests.jar</exclude> + <exclude>*-javadoc.jar</exclude> + <exclude>*-sources.jar</exclude> + </excludes> + </fileSet> + <fileSet> + <directory>target/libs</directory> + <outputDirectory>include/sqlline</outputDirectory> + </fileSet> + + <fileSet> + <directory>bin</directory> + <outputDirectory>/</outputDirectory> + </fileSet> + </fileSets> + </sources> + </moduleSet> + </moduleSets> +</assembly> http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/modules/sqlline/bin/ignitesql.bat ---------------------------------------------------------------------- diff --git a/modules/sqlline/bin/ignitesql.bat b/modules/sqlline/bin/ignitesql.bat new file mode 100644 index 0000000..828e93a --- /dev/null +++ b/modules/sqlline/bin/ignitesql.bat @@ -0,0 +1,112 @@ +:: +:: 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. +:: + +@echo off +Setlocal EnableDelayedExpansion + +if "%OS%" == "Windows_NT" setlocal + +:: Check JAVA_HOME. +if defined JAVA_HOME goto checkJdk + echo %0, ERROR: + echo JAVA_HOME environment variable is not found. + echo Please point JAVA_HOME variable to location of JDK 1.7 or JDK 1.8. + echo You can also download latest JDK at http://java.com/download. +goto error_finish + +:checkJdk +:: Check that JDK is where it should be. +if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion + echo %0, ERROR: + echo JAVA is not found in JAVA_HOME=%JAVA_HOME%. + echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8. + echo You can also download latest JDK at http://java.com/download. +goto error_finish + +:checkJdkVersion +"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr "1\.[78]\." > nul +if %ERRORLEVEL% equ 0 goto checkIgniteHome1 + echo %0, ERROR: + echo The version of JAVA installed in %JAVA_HOME% is incorrect. + echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8. + echo You can also download latest JDK at http://java.com/download. +goto error_finish + +:: Check IGNITE_HOME. +:checkIgniteHome1 +if defined IGNITE_HOME goto checkIgniteHome2 + pushd "%~dp0"/.. + set IGNITE_HOME=%CD% + popd + +:checkIgniteHome2 +:: Strip double quotes from IGNITE_HOME +set IGNITE_HOME=%IGNITE_HOME:"=% + +:: remove all trailing slashes from IGNITE_HOME. +if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash +if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash +goto checkIgniteHome3 + +:removeTrailingSlash +set IGNITE_HOME=%IGNITE_HOME:~0,-1% +goto checkIgniteHome2 + +:checkIgniteHome3 +if exist "%IGNITE_HOME%\config" goto checkIgniteHome4 + echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid. + echo Please create IGNITE_HOME environment variable pointing to location of + echo Ignite installation folder. + goto error_finish + +:checkIgniteHome4 + +:: +:: Set SCRIPTS_HOME - base path to scripts. +:: +set SCRIPTS_HOME=%IGNITE_HOME%\bin + +:: Remove trailing spaces +for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1% + +if /i "%SCRIPTS_HOME%\" == "%~dp0" goto setProgName + echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME% + +:setProgName +:: +:: Set program name. +:: +set PROG_NAME=ignitesql.bat +if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0% + +:run + +:: +:: Set IGNITE_LIBS +:: +call "%SCRIPTS_HOME%\include\setenv.bat" + +set CP=%IGNITE_LIBS% +set CP=%CP%;%IGNITE_HOME%\bin\include\sqlline\* + +"%JAVA_HOME%\bin\java.exe" -cp "%CP%" sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver %* + +:error_finish \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/modules/sqlline/bin/ignitesql.sh ---------------------------------------------------------------------- diff --git a/modules/sqlline/bin/ignitesql.sh b/modules/sqlline/bin/ignitesql.sh new file mode 100644 index 0000000..5745aea --- /dev/null +++ b/modules/sqlline/bin/ignitesql.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# 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 + +# +# Set SCRIPTS_HOME - base path to scripts. +# +SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin" + +source "${SCRIPTS_HOME}"/include/functions.sh + +# +# Discover IGNITE_HOME environment variable. +# +setIgniteHome + +# +# Set IGNITE_LIBS. +# +. "${SCRIPTS_HOME}"/include/setenv.sh + +JDBCLINK="jdbc:ignite:thin://${HOST_AND_PORT}${SCHEMA_DELIMITER}${SCHEMA}${PARAMS}" + +CP="${IGNITE_LIBS}" + +CP="${CP}${SEP}${IGNITE_HOME_TMP}/bin/include/sqlline/*" + +java -cp ${CP} sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver $@ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/modules/sqlline/pom.xml ---------------------------------------------------------------------- diff --git a/modules/sqlline/pom.xml b/modules/sqlline/pom.xml new file mode 100644 index 0000000..bcb71ec --- /dev/null +++ b/modules/sqlline/pom.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<!-- + POM file. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>apache-ignite</artifactId> + <groupId>org.apache.ignite</groupId> + <version>2.3.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>ignite-sqlline</artifactId> + <packaging>jar</packaging> + + <name>sqlline</name> + <url>http://maven.apache.org</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>sqlline</groupId> + <artifactId>sqlline</artifactId> + <version>1.3.0</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-libs</id> + <phase>test-compile</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <excludeGroupIds>org.apache.ignite</excludeGroupIds> + <outputDirectory>target/libs</outputDirectory> + <includeScope>runtime</includeScope> + <excludeTransitive>false</excludeTransitive> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index d60863f..befbf4c 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,7 @@ <module>modules/kubernetes</module> <module>modules/zeromq</module> <module>modules/rocketmq</module> + <module>modules/sqlline</module> </modules> <profiles> @@ -470,6 +471,22 @@ </execution> <execution> + <id>dependencies-sqlline</id> + <phase>validate</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptors> + <descriptor>assembly/dependencies-sqlline.xml</descriptor> + </descriptors> + <outputDirectory>target/release-package-${ignite.edition}</outputDirectory> + <finalName>bin</finalName> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + + <execution> <id>scala-scripts</id> <phase>validate</phase> <goals>