Repository: incubator-ignite Updated Branches: refs/heads/ignite-330 747b4b82c -> f2c3c2b59
# IGNITE-330 WIP Demo. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f2c3c2b5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f2c3c2b5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f2c3c2b5 Branch: refs/heads/ignite-330 Commit: f2c3c2b5915e90809e7f9e91494b43ad50da9bde Parents: 747b4b8 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Fri Mar 20 10:53:04 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Fri Mar 20 10:53:04 2015 +0700 ---------------------------------------------------------------------- examples/schema-import/db-demo-script.bat | 99 ++++++++++++++++++++++++++ examples/schema-import/db-demo-server.bat | 97 +++++++++++++++++++++++++ examples/schema-import/db-demo-wizard.bat | 89 +++++++++++++++++++++++ examples/schema-import/db-demo.bat | 93 ++++++++++++++++++++++++ examples/schema-import/demo.sql | 10 +++ 5 files changed, 388 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f2c3c2b5/examples/schema-import/db-demo-script.bat ---------------------------------------------------------------------- diff --git a/examples/schema-import/db-demo-script.bat b/examples/schema-import/db-demo-script.bat new file mode 100644 index 0000000..7a87a74 --- /dev/null +++ b/examples/schema-import/db-demo-script.bat @@ -0,0 +1,99 @@ +:: +:: 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. +:: + +:: +:: Starts H2 database for Ignite Schema Import demo. +:: + +@echo off + +if "%OS%" == "Windows_NT" setlocal + +:: Check JAVA_HOME. +if not "%JAVA_HOME%" == "" goto checkJdk + echo %0, ERROR: JAVA_HOME environment variable is not found. + echo %0, ERROR: Please create JAVA_HOME variable pointing to location of JDK 1.7 or JDK 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:checkJdk +:: Check that JDK is where it should be. +if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion + echo %0, ERROR: The JDK is not found in %JAVA_HOME%. + echo %0, ERROR: Please modify your script so that JAVA_HOME would point to valid location of JDK. +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: The version of JAVA installed in %JAVA_HOME% is incorrect. + echo %0, ERROR: Please install JDK 1.7 or 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:: Check IGNITE_HOME. +:checkIgniteHome1 +if not "%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% + +:run + +:: +:: Set IGNITE_LIBS +:: +call "%SCRIPTS_HOME%\include\setenv.bat" + +:: +:: Starts Visor console. +:: +"%JAVA_HOME%\bin\java.exe" -cp "%IGNITE_LIBS%" org.h2.tools.RunScript -url jdbc:h2:tcp://localhost/demo -script demo.sql + +:error_finish + +exit \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f2c3c2b5/examples/schema-import/db-demo-server.bat ---------------------------------------------------------------------- diff --git a/examples/schema-import/db-demo-server.bat b/examples/schema-import/db-demo-server.bat new file mode 100644 index 0000000..1f206d6 --- /dev/null +++ b/examples/schema-import/db-demo-server.bat @@ -0,0 +1,97 @@ +:: +:: 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. +:: + +:: +:: Starts H2 database for Ignite Schema Import demo. +:: + +@echo off + +if "%OS%" == "Windows_NT" setlocal + +:: Check JAVA_HOME. +if not "%JAVA_HOME%" == "" goto checkJdk + echo %0, ERROR: JAVA_HOME environment variable is not found. + echo %0, ERROR: Please create JAVA_HOME variable pointing to location of JDK 1.7 or JDK 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:checkJdk +:: Check that JDK is where it should be. +if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion + echo %0, ERROR: The JDK is not found in %JAVA_HOME%. + echo %0, ERROR: Please modify your script so that JAVA_HOME would point to valid location of JDK. +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: The version of JAVA installed in %JAVA_HOME% is incorrect. + echo %0, ERROR: Please install JDK 1.7 or 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:: Check IGNITE_HOME. +:checkIgniteHome1 +if not "%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% + +:run + +:: +:: Set IGNITE_LIBS +:: +call "%SCRIPTS_HOME%\include\setenv.bat" + +:: +:: Starts Visor console. +:: +"%JAVA_HOME%\bin\java.exe" -cp "%IGNITE_LIBS%" org.h2.tools.Server -tcp -baseDir "%IGNITE_HOME%\examples\schema-import" + +:error_finish \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f2c3c2b5/examples/schema-import/db-demo-wizard.bat ---------------------------------------------------------------------- diff --git a/examples/schema-import/db-demo-wizard.bat b/examples/schema-import/db-demo-wizard.bat new file mode 100644 index 0000000..ef3f327 --- /dev/null +++ b/examples/schema-import/db-demo-wizard.bat @@ -0,0 +1,89 @@ +:: +:: 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. +:: + +:: +:: Starts Ignite Schema Import demo. +:: + +@echo off + +if "%OS%" == "Windows_NT" setlocal + +:: Check JAVA_HOME. +if not "%JAVA_HOME%" == "" goto checkJdk + echo %0, ERROR: JAVA_HOME environment variable is not found. + echo %0, ERROR: Please create JAVA_HOME variable pointing to location of JDK 1.7 or JDK 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:checkJdk +:: Check that JDK is where it should be. +if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion + echo %0, ERROR: The JDK is not found in %JAVA_HOME%. + echo %0, ERROR: Please modify your script so that JAVA_HOME would point to valid location of JDK. +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: The version of JAVA installed in %JAVA_HOME% is incorrect. + echo %0, ERROR: Please install JDK 1.7 or 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:: Check IGNITE_HOME. +:checkIgniteHome1 +if not "%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 run + 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 + +:run + +"%IGNITE_HOME%\bin\ignite-schema-import.bat" ^ + jdbc.db.preset=0 ^ + jdbc.driver.jar="%IGNITE_HOME%\libs\ignite-indexing\h2-1.3.175.jar" ^ + jdbc.driver.class=org.h2.Driver ^ + jdbc.url="jdbc:h2:tcp://localhost/%IGNITE_HOME%\examples\schema-import\demo" ^ + jdbc.user=sa ^ + outFolder="%IGNITE_HOME%\examples\src\main\java" ^ + pojo.package="org.apache.ignite.schema-import.demo" ^ + pojo.constructor=true + +:error_finish + +exit \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f2c3c2b5/examples/schema-import/db-demo.bat ---------------------------------------------------------------------- diff --git a/examples/schema-import/db-demo.bat b/examples/schema-import/db-demo.bat new file mode 100644 index 0000000..8aac263 --- /dev/null +++ b/examples/schema-import/db-demo.bat @@ -0,0 +1,93 @@ +:: +:: 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. +:: + +:: +:: Starts Ignite Schema Import demo. +:: + +@echo off + +if "%OS%" == "Windows_NT" setlocal + +:: Check JAVA_HOME. +if not "%JAVA_HOME%" == "" goto checkJdk + echo %0, ERROR: JAVA_HOME environment variable is not found. + echo %0, ERROR: Please create JAVA_HOME variable pointing to location of JDK 1.7 or JDK 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:checkJdk +:: Check that JDK is where it should be. +if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion + echo %0, ERROR: The JDK is not found in %JAVA_HOME%. + echo %0, ERROR: Please modify your script so that JAVA_HOME would point to valid location of JDK. +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: The version of JAVA installed in %JAVA_HOME% is incorrect. + echo %0, ERROR: Please install JDK 1.7 or 1.8. + echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava +goto error_finish + +:: Check IGNITE_HOME. +:checkIgniteHome1 +if not "%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 run + 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 + +:run + +@echo on + +:: Start server. +start "%IGNITE_HOME%\examples\schema-import\db-demo-server.bat" + +:: Wait for server start. +ping 127.0.0.1 -n 3 -w 3000 > NUL + +:: Populate db with sample tables and data. +start "%IGNITE_HOME%\examples\schema-import\db-demo-script.bat" + +:: Start Ignite Schema Import Wizard. +start "%IGNITE_HOME%\examples\schema-import\db-demo-wizard.bat" + +:error_finish + +exit \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f2c3c2b5/examples/schema-import/demo.sql ---------------------------------------------------------------------- diff --git a/examples/schema-import/demo.sql b/examples/schema-import/demo.sql new file mode 100644 index 0000000..bef0550 --- /dev/null +++ b/examples/schema-import/demo.sql @@ -0,0 +1,10 @@ +create table if not exists PERSON(id integer not null, first_name varchar(50), last_name varchar(50), PRIMARY KEY(id)); + +delete from PERSON; + +insert into PERSON(id, first_name, last_name) values(1, 'Johannes', 'Kepler'); +insert into PERSON(id, first_name, last_name) values(2, 'Galileo', 'Galilei'); +insert into PERSON(id, first_name, last_name) values(3, 'Henry', 'More'); +insert into PERSON(id, first_name, last_name) values(4, 'Polish', 'Brethren'); +insert into PERSON(id, first_name, last_name) values(5, 'Robert', 'Boyle'); +insert into PERSON(id, first_name, last_name) values(6, 'Isaac', 'Newton'); \ No newline at end of file