Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E7C89200C5F for ; Sat, 8 Apr 2017 13:20:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E473E160BA9; Sat, 8 Apr 2017 11:20:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BC40B160BAA for ; Sat, 8 Apr 2017 13:20:09 +0200 (CEST) Received: (qmail 27182 invoked by uid 500); 8 Apr 2017 11:20:09 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 26947 invoked by uid 99); 8 Apr 2017 11:20:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Apr 2017 11:20:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6EE6EE943C; Sat, 8 Apr 2017 11:20:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akuznetsov@apache.org To: commits@ignite.apache.org Date: Sat, 08 Apr 2017 11:20:14 -0000 Message-Id: <6fdaef05e24f4dc983af071183ec1b73@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [7/7] ignite git commit: IGNITE-4349 Discontinue the schema-import utility. archived-at: Sat, 08 Apr 2017 11:20:12 -0000 IGNITE-4349 Discontinue the schema-import utility. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6ee9c0f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6ee9c0f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6ee9c0f Branch: refs/heads/master Commit: f6ee9c0fb5f5d116c79c840a13010ce51e5cf512 Parents: 4e80ddf Author: Alexey Kuznetsov Authored: Sat Apr 8 18:18:34 2017 +0700 Committer: Alexey Kuznetsov Committed: Sat Apr 8 18:18:34 2017 +0700 ---------------------------------------------------------------------- DEVNOTES.txt | 3 - assembly/dependencies-fabric-lgpl.xml | 3 - assembly/dependencies-fabric.xml | 3 - assembly/dependencies-schema-import.xml | 57 - assembly/release-base.xml | 2 - assembly/release-fabric-base.xml | 9 - assembly/release-schema-import.xml | 50 - bin/ignite-schema-import.bat | 110 - bin/ignite-schema-import.sh | 87 - examples/README-LGPL.txt | 4 +- examples/README.txt | 2 - examples/pom-standalone-lgpl.xml | 1 - examples/pom-standalone.xml | 1 - examples/pom.xml | 1 - examples/schema-import/README.txt | 38 - examples/schema-import/bin/db-init.sql | 28 - examples/schema-import/bin/h2-server.bat | 80 - examples/schema-import/bin/h2-server.sh | 66 - .../schema-import/bin/schema-import.properties | 28 - examples/schema-import/pom-standalone.xml | 90 - examples/schema-import/pom.xml | 101 - .../org/apache/ignite/schema/CacheConfig.java | 36 - .../java/org/apache/ignite/schema/Demo.java | 134 -- .../java/org/apache/ignite/schema/DemoNode.java | 38 - .../ignite/schema/H2DataSourceFactory.java | 35 - .../java/org/apache/ignite/schema/Person.java | 44 - .../org/apache/ignite/schema/PersonKey.java | 37 - .../test/config/store/jdbc/ignite-jdbc-type.xml | 2 +- .../cache/store/jdbc/model/Organization.java | 2 - .../cache/store/jdbc/model/OrganizationKey.java | 2 - .../ignite/cache/store/jdbc/model/Person.java | 2 - .../store/jdbc/model/PersonComplexKey.java | 4 +- .../cache/store/jdbc/model/PersonKey.java | 2 - modules/schema-import-db/README.txt | 4 - modules/schema-import-db/pom.xml | 55 - .../apache/ignite/schema/parser/DbColumn.java | 88 - .../ignite/schema/parser/DbMetadataReader.java | 147 -- .../apache/ignite/schema/parser/DbTable.java | 82 - .../parser/dialect/DB2MetadataDialect.java | 33 - .../parser/dialect/DatabaseMetadataDialect.java | 102 - .../parser/dialect/JdbcMetadataDialect.java | 199 -- .../parser/dialect/MySQLMetadataDialect.java | 82 - .../parser/dialect/OracleMetadataDialect.java | 360 --- modules/schema-import/README.txt | 216 -- modules/schema-import/pom.xml | 119 - .../main/java/media/data_connection_48x48.png | Bin 4443 -> 0 bytes .../src/main/java/media/error_48x48.png | Bin 4349 -> 0 bytes .../src/main/java/media/ignite_128x128.png | Bin 4917 -> 0 bytes .../src/main/java/media/ignite_16x16.png | Bin 608 -> 0 bytes .../src/main/java/media/ignite_24x24.png | Bin 930 -> 0 bytes .../src/main/java/media/ignite_32x32.png | Bin 1203 -> 0 bytes .../src/main/java/media/ignite_48x48.png | Bin 1868 -> 0 bytes .../src/main/java/media/ignite_64x64.png | Bin 2453 -> 0 bytes .../src/main/java/media/information_48x48.png | Bin 4102 -> 0 bytes .../src/main/java/media/question_48x48.png | Bin 3857 -> 0 bytes .../src/main/java/media/sign_warning_48x48.png | Bin 2988 -> 0 bytes .../schema-import/src/main/java/media/style.css | 134 -- .../src/main/java/media/text_tree_48x48.png | Bin 2567 -> 0 bytes .../ignite/schema/generator/CodeGenerator.java | 831 ------- .../ignite/schema/generator/GeneratorUtils.java | 70 - .../ignite/schema/generator/XmlGenerator.java | 446 ---- .../ignite/schema/model/PojoDescriptor.java | 497 ---- .../apache/ignite/schema/model/PojoField.java | 461 ---- .../ignite/schema/model/SchemaDescriptor.java | 62 - .../schema/parser/DatabaseMetadataParser.java | 115 - .../ignite/schema/ui/ConfirmCallable.java | 83 - .../org/apache/ignite/schema/ui/Controls.java | 697 ------ .../org/apache/ignite/schema/ui/GridPaneEx.java | 180 -- .../org/apache/ignite/schema/ui/MessageBox.java | 274 --- .../apache/ignite/schema/ui/ModalDialog.java | 50 - .../ignite/schema/ui/SchemaImportApp.java | 2115 ------------------ .../ignite/schema/ui/TextColumnValidator.java | 32 - .../schema/test/AbstractSchemaImportTest.java | 181 -- .../test/generator/CodeGeneratorTest.java | 81 - .../schema/test/generator/XmlGeneratorTest.java | 42 - .../ignite/schema/test/model/CacheConfig.txt | 409 ---- .../apache/ignite/schema/test/model/Objects.txt | 531 ----- .../ignite/schema/test/model/ObjectsKey.txt | 96 - .../ignite/schema/test/model/Primitives.txt | 535 ----- .../ignite/schema/test/model/PrimitivesKey.txt | 96 - .../org/apache/ignite/schema/test/model/Tst.txt | 535 ----- .../apache/ignite/schema/test/model/TstKey.txt | 96 - .../schema/test/model/ignite-type-metadata.xml | 666 ------ .../test/parser/DbMetadataParserTest.java | 134 -- .../testsuites/IgniteSchemaImportTestSuite.java | 42 - modules/web-console/web-agent/pom.xml | 12 - .../ignite/console/agent/db/DbColumn.java | 88 + .../console/agent/db/DbMetadataReader.java | 142 ++ .../apache/ignite/console/agent/db/DbTable.java | 82 + .../agent/db/dialect/DB2MetadataDialect.java | 33 + .../db/dialect/DatabaseMetadataDialect.java | 102 + .../agent/db/dialect/JdbcMetadataDialect.java | 199 ++ .../agent/db/dialect/MySQLMetadataDialect.java | 82 + .../agent/db/dialect/OracleMetadataDialect.java | 359 +++ .../agent/handlers/DatabaseListener.java | 20 +- pom.xml | 121 - 96 files changed, 1103 insertions(+), 12217 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/DEVNOTES.txt ---------------------------------------------------------------------- diff --git a/DEVNOTES.txt b/DEVNOTES.txt index 79bedfd..d3c162e 100644 --- a/DEVNOTES.txt +++ b/DEVNOTES.txt @@ -25,9 +25,6 @@ With Apache Ignite.NET: Look for apache-ignite-fabric--bin.zip in ./target/bin directory. -NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40. - Schema Import module use JavaFX, under OpenJDK may be compiled and run only on OpenJDK 8 with installed OpenJFX. - Ignite Hadoop Accelerator Maven Build Instructions ============================================ mvn clean package -DskipTests -Dignite.edition=hadoop [-Dhadoop.version=X.X.X] [-Dspark.version=x.y.z] http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/dependencies-fabric-lgpl.xml ---------------------------------------------------------------------- diff --git a/assembly/dependencies-fabric-lgpl.xml b/assembly/dependencies-fabric-lgpl.xml index 6d547c4..4cff146 100644 --- a/assembly/dependencies-fabric-lgpl.xml +++ b/assembly/dependencies-fabric-lgpl.xml @@ -120,14 +120,11 @@ org.apache.ignite:ignite-extdata-uri org.apache.ignite:ignite-extdata-uri-dep org.apache.ignite:ignite-examples - org.apache.ignite:ignite-schema-import-demo org.apache.ignite:ignite-indexing org.apache.ignite:ignite-visor-console org.apache.ignite:ignite-visor-console_2.10 org.apache.ignite:ignite-visor-plugins org.apache.ignite:ignite-hadoop - org.apache.ignite:ignite-schema-import - org.apache.ignite:ignite-schema-import-db org.apache.ignite:ignite-codegen org.apache.ignite:ignite-apache-license-gen org.apache.ignite:ignite-appserver-test http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/dependencies-fabric.xml ---------------------------------------------------------------------- diff --git a/assembly/dependencies-fabric.xml b/assembly/dependencies-fabric.xml index d4000d6..840216f 100644 --- a/assembly/dependencies-fabric.xml +++ b/assembly/dependencies-fabric.xml @@ -120,14 +120,11 @@ org.apache.ignite:ignite-extdata-uri org.apache.ignite:ignite-extdata-uri-dep org.apache.ignite:ignite-examples - org.apache.ignite:ignite-schema-import-demo org.apache.ignite:ignite-indexing org.apache.ignite:ignite-visor-console org.apache.ignite:ignite-visor-console_2.10 org.apache.ignite:ignite-visor-plugins org.apache.ignite:ignite-hadoop - org.apache.ignite:ignite-schema-import - org.apache.ignite:ignite-schema-import-db org.apache.ignite:ignite-codegen org.apache.ignite:ignite-apache-license-gen org.apache.ignite:ignite-hibernate http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/dependencies-schema-import.xml ---------------------------------------------------------------------- diff --git a/assembly/dependencies-schema-import.xml b/assembly/dependencies-schema-import.xml deleted file mode 100644 index d7aa3ae..0000000 --- a/assembly/dependencies-schema-import.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - dependencies-schema-import - - - dir - - - false - - - - - org.apache.ignite:ignite-schema-import - org.apache.ignite:ignite-schema-import-db - - - false - - - target - /schema-import - - *.jar - - - *-tests.jar - *-javadoc.jar - *-sources.jar - - - - - - - http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/release-base.xml ---------------------------------------------------------------------- diff --git a/assembly/release-base.xml b/assembly/release-base.xml index 6870284..bc3d473 100644 --- a/assembly/release-base.xml +++ b/assembly/release-base.xml @@ -63,7 +63,6 @@ igniterouter.bat **/build-classpath.bat ignitevisorcmd.bat - ignite-schema-import.bat @@ -80,7 +79,6 @@ **/build-classpath.sh **/service.sh ignitevisorcmd.sh - ignite-schema-import.sh http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/release-fabric-base.xml ---------------------------------------------------------------------- diff --git a/assembly/release-fabric-base.xml b/assembly/release-fabric-base.xml index 7a25594..c3bad39 100644 --- a/assembly/release-fabric-base.xml +++ b/assembly/release-fabric-base.xml @@ -61,12 +61,6 @@ - examples/schema-import/pom-standalone.xml - /examples/schema-import - pom.xml - - - config/dotnet/default-dotnet.xml /config/dotnet @@ -221,9 +215,6 @@ rest/** memcached/** redis/** - schema-import/src/** - schema-import/bin/** - schema-import/README.txt http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/release-schema-import.xml ---------------------------------------------------------------------- diff --git a/assembly/release-schema-import.xml b/assembly/release-schema-import.xml deleted file mode 100644 index 38457b9..0000000 --- a/assembly/release-schema-import.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - release-schema-import - - false - - - dir - - - - - bin - / - - **/ignite-schema-import.bat - - - - - bin - / - 0755 - - **/ignite-schema-import.sh - - - - http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/bin/ignite-schema-import.bat ---------------------------------------------------------------------- diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat deleted file mode 100644 index a4ec86b..0000000 --- a/bin/ignite-schema-import.bat +++ /dev/null @@ -1,110 +0,0 @@ -:: -:: 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 Utility. -:: - -@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% - -if /i "%SCRIPTS_HOME%\" == "%~dp0" goto run - echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME% - -:run - -:: -:: Set IGNITE_LIBS -:: -call "%SCRIPTS_HOME%\include\setenv.bat" -call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release. -set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_HOME%\bin\include\schema-import\*;%IGNITE_LIBS% - -:: -:: Set program name. -:: -set PROG_NAME=ignite-schema-import.bat -if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0% - -:: -:: Starts Ignite Schema Import Utility. -:: -"%JAVA_HOME%\bin\java.exe" %JVM_OPTS% -cp "%CP%" org.apache.ignite.schema.ui.SchemaImportApp %* - -:error_finish - -goto :eof http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/bin/ignite-schema-import.sh ---------------------------------------------------------------------- diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh deleted file mode 100755 index 1029882..0000000 --- a/bin/ignite-schema-import.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/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. -# - -# -# Starts Ignite Schema Import Utility. -# - -# Remember command line parameters -ARGS=$@ - -# -# 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 path to Java executable and check it's version. -# -checkJava - -# -# Discover IGNITE_HOME environment variable. -# -setIgniteHome - -# -# Parse command line parameters. -# -. "${SCRIPTS_HOME}"/include/parseargs.sh - -# -# Set IGNITE_LIBS. -# -. "${SCRIPTS_HOME}"/include/setenv.sh -. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release. -CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_HOME}/bin/include/schema-import/*${SEP}${IGNITE_LIBS}" - -# -# JVM options. See http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details. -# -# ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE -# -JVM_OPTS="-Xms256m -Xmx1g -XX:MaxPermSize=128M ${JVM_OPTS}" - -# Mac OS specific support to display correct name in the dock. -osname=`uname` - -if [ "${DOCK_OPTS}" == "" ]; then - DOCK_OPTS="-Xdock:name=Ignite Schema Import Utility" -fi - -# -# Starts Ignite Schema Import Utility. -# -case $osname in - Darwin*) - "$JAVA" ${JVM_OPTS} "${DOCK_OPTS}" -cp "${CP}" org.apache.ignite.schema.ui.SchemaImportApp ${ARGS} - ;; - *) - "$JAVA" ${JVM_OPTS} -cp "${CP}" org.apache.ignite.schema.ui.SchemaImportApp ${ARGS} - ;; -esac http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/README-LGPL.txt ---------------------------------------------------------------------- diff --git a/examples/README-LGPL.txt b/examples/README-LGPL.txt index 0f95971..f8ca0d8 100644 --- a/examples/README-LGPL.txt +++ b/examples/README-LGPL.txt @@ -11,8 +11,6 @@ The examples folder contains he following subfolders: - `config` - contains Ignite configuration files needed for examples. - `memcached` - contains PHP script demonstrating how Ignite Cache can be accessed using Memcached client. - `rest` - contains PHP script demonstrating how Ignite Cache can be accessed via HTTP API. -- `schema-import` - contains demo project for Apache Ignite Schema Import Utility. Refer to enclosed - README.txt file for more information on how to build and run the demo. - `src/main/java` - contains Java examples for different Ignite modules and features. - `src/main/java8` - contains additional set of Java examples utilizing Java 8 lambdas. These examples are excluded by default, enable `java8` Maven profile to include them (JDK8 is required). @@ -30,4 +28,4 @@ class loading: `examples/config/example-ignite.xml`. To run a remote node in IDE Java7 vs Java8 =============== Some examples (not all) which can benefit from Java8 Lambda support were re-written with Java8 lambdas. -For full set of examples, look at both Java7 and Java8 packages. \ No newline at end of file +For full set of examples, look at both Java7 and Java8 packages. http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/README.txt ---------------------------------------------------------------------- diff --git a/examples/README.txt b/examples/README.txt index 26970d6..a17c9c8 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -11,8 +11,6 @@ The examples folder contains he following subfolders: - `config` - contains Ignite configuration files needed for examples. - `memcached` - contains PHP script demonstrating how Ignite Cache can be accessed using Memcached client. - `rest` - contains PHP script demonstrating how Ignite Cache can be accessed via HTTP API. -- `schema-import` - contains demo project for Apache Ignite Schema Import Utility. Refer to enclosed - README.txt file for more information on how to build and run the demo. - `src/main/java` - contains Java examples for different Ignite modules and features. - `src/main/java8` - contains additional set of Java examples utilizing Java 8 lambdas. These examples are excluded by default, enable `java8` Maven profile to include them (JDK8 is required). http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/pom-standalone-lgpl.xml ---------------------------------------------------------------------- diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml index f664514..16fe125 100644 --- a/examples/pom-standalone-lgpl.xml +++ b/examples/pom-standalone-lgpl.xml @@ -221,7 +221,6 @@ - schema-import/src/main/java ${lgpl.folder} ${java8.folder} ${spark.folder} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/pom-standalone.xml ---------------------------------------------------------------------- diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml index 029ca77..fe6ab21 100644 --- a/examples/pom-standalone.xml +++ b/examples/pom-standalone.xml @@ -222,7 +222,6 @@ - schema-import/src/main/java ${lgpl.folder} ${java8.folder} ${spark.folder} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index e7fd67d..2bbcc8a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -282,7 +282,6 @@ - schema-import/src/main/java ${lgpl.folder} ${java8.folder} ${spark.folder} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/README.txt ---------------------------------------------------------------------- diff --git a/examples/schema-import/README.txt b/examples/schema-import/README.txt deleted file mode 100644 index ff2d517..0000000 --- a/examples/schema-import/README.txt +++ /dev/null @@ -1,38 +0,0 @@ -Apache Ignite Schema Import Utility -=================================== - -Ignite ships with CacheJdbcPojoStore, which is out-of-the-box JDBC -implementation of the IgniteCacheStore interface, and automatically -handles all the write-through and read-through logic. - -Ignite also ships with its own database schema mapping wizard which provides automatic -support for integrating with persistence stores. This utility automatically connects to -the underlying database and generates all the required XML OR-mapping configuration -and Java domain model POJOs. - -Schema Import Utility Demo -========================== -1. Start H2 database: "examples/schema-import/bin/h2-server.sh" - H2 server will start and H2 Console will be opened in your default browser. - -2. Connect to H2 database with following settings: - - a. Select "Generic H2 (Server)" settings. - - b. IMPORTANT: enter JDBC URL "jdbc:h2:tcp://localhost/~/schema-import/demo" - - c. Click "Connect". - -3. Paste content of "examples/schema-import/bin/db-init.sql" into H2 Console and execute. - -4. Start Schema Import utility: "IGNITE_HOME/bin/ignite-schema-import.sh examples/schema-import/bin/schema-import.properties" - Schema Utility will start with predefined settings for this demo. - Click "Next", "Generate" and answer "Yes" to all override warnings. - -5. Import "examples/schema-import/pom.xml" in your Java IDE. - -6. Run "Demo.java" example. - -For more information on how to get started with Apache Ignite Schema Import Utility please visit: - - http://apacheignite.readme.io/docs/automatic-persistence http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/db-init.sql ---------------------------------------------------------------------- diff --git a/examples/schema-import/bin/db-init.sql b/examples/schema-import/bin/db-init.sql deleted file mode 100644 index 8a91a6a..0000000 --- a/examples/schema-import/bin/db-init.sql +++ /dev/null @@ -1,28 +0,0 @@ --- --- 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. --- - --- Script of database initialization for Schema Import Demo. -drop table PERSON; - -create table PERSON(id integer not null PRIMARY KEY, first_name varchar(50), last_name varchar(50), salary double not null); - -insert into PERSON(id, first_name, last_name, salary) values(1, 'Johannes', 'Kepler', 1000); -insert into PERSON(id, first_name, last_name, salary) values(2, 'Galileo', 'Galilei', 2000); -insert into PERSON(id, first_name, last_name, salary) values(3, 'Henry', 'More', 3000); -insert into PERSON(id, first_name, last_name, salary) values(4, 'Polish', 'Brethren', 4000); -insert into PERSON(id, first_name, last_name, salary) values(5, 'Robert', 'Boyle', 5000); -insert into PERSON(id, first_name, last_name, salary) values(6, 'Isaac', 'Newton', 6000); http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/h2-server.bat ---------------------------------------------------------------------- diff --git a/examples/schema-import/bin/h2-server.bat b/examples/schema-import/bin/h2-server.bat deleted file mode 100644 index d445231..0000000 --- a/examples/schema-import/bin/h2-server.bat +++ /dev/null @@ -1,80 +0,0 @@ -:: -:: 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 server and console 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 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 - -:: Starts H2 server and console. -"%JAVA_HOME%\bin\java.exe" -cp "%IGNITE_HOME%\libs\ignite-indexing\h2-1.4.191.jar" org.h2.tools.Console %* - -:error_finish \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/h2-server.sh ---------------------------------------------------------------------- diff --git a/examples/schema-import/bin/h2-server.sh b/examples/schema-import/bin/h2-server.sh deleted file mode 100755 index 512a1d9..0000000 --- a/examples/schema-import/bin/h2-server.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/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. -# - -# -# Starts H2 database server and console for Ignite Schema Import demo. -# - -# Remember command line parameters -ARGS=$@ - -# -# 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 path to Java executable and check it's version. -# -checkJava - -# -# Discover IGNITE_HOME environment variable. -# -setIgniteHome - -# Mac OS specific support to display correct name in the dock. -osname=`uname` - -if [ "${DOCK_OPTS}" == "" ]; then - DOCK_OPTS="-Dapple.awt.UIElement="true"" -fi - -# Starts H2 server and console. -case $osname in - Darwin*) - "${JAVA}" "${DOCK_OPTS}" -cp "${IGNITE_HOME}/libs/ignite-indexing/h2-1.4.191.jar" org.h2.tools.Console ${ARGS} - ;; - *) - "${JAVA}" -cp "${IGNITE_HOME}/libs/ignite-indexing/h2-1.4.191.jar" org.h2.tools.Console ${ARGS} - ;; -esac http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/schema-import.properties ---------------------------------------------------------------------- diff --git a/examples/schema-import/bin/schema-import.properties b/examples/schema-import/bin/schema-import.properties deleted file mode 100644 index 99ebab8..0000000 --- a/examples/schema-import/bin/schema-import.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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. -# - -# -# Predefined properties for Ignite Schema Import Demo -# -jdbc.db.preset=0 -jdbc.driver.jar=libs/ignite-indexing/h2-1.4.191.jar -jdbc.driver.class=org.h2.Driver -jdbc.url=jdbc:h2:tcp://localhost/~/schema-import/demo -jdbc.user=sa -out.folder=examples/schema-import/src/main/java -pojo.package=org.apache.ignite.schema -pojo.constructor=true http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/pom-standalone.xml ---------------------------------------------------------------------- diff --git a/examples/schema-import/pom-standalone.xml b/examples/schema-import/pom-standalone.xml deleted file mode 100644 index e443728..0000000 --- a/examples/schema-import/pom-standalone.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - 4.0.0 - - - UTF-8 - - - org.apache.ignite - ignite-schema-import-demo - to_be_replaced_by_ignite_version - - - - javax.cache - cache-api - 1.0.0 - - - - org.apache.ignite - ignite-core - to_be_replaced_by_ignite_version - - - - org.apache.ignite - ignite-spring - to_be_replaced_by_ignite_version - - - - org.apache.ignite - ignite-log4j - to_be_replaced_by_ignite_version - - - - org.apache.ignite - ignite-indexing - to_be_replaced_by_ignite_version - - - - - - - src/main/java - - **/*.java - - - - - - - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - - http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/pom.xml ---------------------------------------------------------------------- diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml deleted file mode 100644 index 0838512..0000000 --- a/examples/schema-import/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - 4.0.0 - - - org.apache.ignite - ignite-parent - 1 - ../../parent - - - - UTF-8 - - - ignite-schema-import-demo - 2.0.0-SNAPSHOT - - - - javax.cache - cache-api - ${javax.cache.version} - - - - org.apache.ignite - ignite-core - ${project.version} - - - - org.apache.ignite - ignite-spring - ${project.version} - - - - org.apache.ignite - ignite-log4j - ${project.version} - - - - org.apache.ignite - ignite-indexing - ${project.version} - - - - - - - src/main/java - - **/*.java - - - - - - - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.java ---------------------------------------------------------------------- diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.java deleted file mode 100644 index c5801cc..0000000 --- a/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema; - -import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory; -import org.apache.ignite.configuration.CacheConfiguration; - -/** - * CacheConfig stub. Will be generated by Ignite Schema Import Utility. - */ -public class CacheConfig { - /** - * Configure cache. - * - * @param name Cache name. - * @param storeFactory Cache store factory. - */ - public static CacheConfiguration cache(String name, CacheJdbcPojoStoreFactory storeFactory) { - throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt"); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java ---------------------------------------------------------------------- diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java deleted file mode 100644 index fa52a1d..0000000 --- a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema; - -import javax.cache.Cache; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore; -import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.transactions.Transaction; - -/** - * This demo demonstrates the use of cache with {@link CacheJdbcPojoStore} - * together with automatic Ignite schema-import utility. - *

- * This Demo can work stand-alone. You can also choose to start - * several {@link DemoNode} instances as well to form a cluster. - */ -public class Demo { - /** - * Executes demo. - * - * @param args Command line arguments, none required. - * @throws IgniteException If example execution failed. - */ - public static void main(String[] args) throws IgniteException { - System.out.println(">>> Start demo..."); - - // Start Ignite node. - try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { - CacheJdbcPojoStoreFactory pojoStoreFactory = new CacheJdbcPojoStoreFactory<>(); - - pojoStoreFactory.setDataSourceFactory(new H2DataSourceFactory()); - - // Configure cache store. - CacheConfiguration cfg = CacheConfig.cache("PersonCache", pojoStoreFactory); - - try (IgniteCache cache = ignite.getOrCreateCache(cfg)) { - // Preload cache from database. - preload(cache); - - // Read-through from database - // and store in cache. - readThrough(cache); - - // Perform transaction and - // write-through to database. - transaction(ignite, cache); - } - } - } - - /** - * Demonstrates cache preload from database. - */ - private static void preload(IgniteCache cache) { - System.out.println(); - System.out.println(">>> Loading entries from database."); - - // Preload all person keys that are less than or equal to 3. - cache.loadCache(null, PersonKey.class.getName(), "select * from PERSON where ID <= 3"); - - for (Cache.Entry person : cache) - System.out.println(">>> Loaded Person: " + person); - } - - /** - * Demonstrates cache read through from database. - */ - private static void readThrough(IgniteCache cache) { - PersonKey key = new PersonKey(4); - - System.out.println(); - System.out.println(">>> Read-through person from database for ID: " + key.getId()); - - // Check that person with ID=4 is not in cache. - Person p = cache.localPeek(key); - - assert p == null; - - // Read-through form database. - p = cache.get(new PersonKey(4)); - - System.out.println(">>> Loaded person from database: " + p); - } - - /** - * Demonstrates cache transaction joining database transaction. - */ - private static void transaction(Ignite ignite, IgniteCache cache) { - PersonKey key = new PersonKey(5); - - System.out.println(); - System.out.println(">>> Update salary and write-through to database for person with ID: " + key.getId()); - - try (Transaction tx = ignite.transactions().txStart()) { - // Read-through from database. - Person p = cache.get(key); - - System.out.println(">>> Loaded person from database: " + p); - - double salary = p.getSalary(); - - // Raise salary by 20%. - p.setSalary(salary * 1.2); - - // Write-through to database - // and store in cache. - cache.put(key, p); - - tx.commit(); - } - - System.out.println(">>> Updated person: " + cache.get(key)); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java ---------------------------------------------------------------------- diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java deleted file mode 100644 index 0f8c192..0000000 --- a/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema; - -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; - -/** - * Starts demo node. You can start as many demo nodes as you like for the demo. - */ -public class DemoNode { - /** - * Starts demo node. - * - * @param args Command line arguments, none required. - * @throws IgniteException If example execution failed. - */ - public static void main(String[] args) throws IgniteException { - System.out.println(">>> Start demo node..."); - - Ignition.start("examples/config/example-ignite.xml"); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java ---------------------------------------------------------------------- diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java deleted file mode 100644 index 6a4ea0a..0000000 --- a/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema; - -import javax.cache.configuration.Factory; -import javax.sql.DataSource; -import org.h2.jdbcx.JdbcConnectionPool; - -/** - * Datasource to use for store tests. - */ -public class H2DataSourceFactory implements Factory { - /** DB connection URL. */ - private static final String DFLT_CONN_URL = "jdbc:h2:tcp://localhost/~/schema-import/demo"; - - /** {@inheritDoc} */ - @Override public DataSource create() { - return JdbcConnectionPool.create(DFLT_CONN_URL, "sa", ""); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java ---------------------------------------------------------------------- diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java deleted file mode 100644 index 799c876..0000000 --- a/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema; - -/** - * Person stub. Will be generated by Ignite Schema Import Utility. - */ -public class Person { - /** - * Empty constructor. - */ - public Person() { - throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt"); - } - - /** - * @return Salary. - */ - public double getSalary() { - throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt"); - } - - /** - * @param salary Salary. - */ - public void setSalary(double salary) { - throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt"); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java ---------------------------------------------------------------------- diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java deleted file mode 100644 index dd241ad..0000000 --- a/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema; - -/** - * PersonKey definition. - */ -public class PersonKey { - /** - * Full constructor. - */ - public PersonKey(int id) { - throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt"); - } - - /** - * @return Person ID. - */ - public int getId() { - throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt"); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml ---------------------------------------------------------------------- diff --git a/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml b/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml index 4df4f04..6b75041 100644 --- a/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml +++ b/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml @@ -18,7 +18,7 @@ --> - - - - - - 4.0.0 - - - org.apache.ignite - ignite-parent - 1 - ../../parent - - - ignite-schema-import-db - 2.0.0-SNAPSHOT - - - - org.apache.ignite - ignite-core - ${project.version} - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java ---------------------------------------------------------------------- diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java deleted file mode 100644 index 10fd50f..0000000 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema.parser; - -/** - * Database table column. - */ -public class DbColumn { - /** Column name. */ - private final String name; - - /** Column JDBC type. */ - private final int type; - - /** Is this column belongs to primary key. */ - private final boolean key; - - /** Is {@code NULL} allowed for column in database. */ - private final boolean nullable; - - /** Whether column unsigned. */ - private final boolean unsigned; - - /** - * @param name Column name. - * @param type Column JDBC type. - * @param key {@code true} if this column belongs to primary key. - * @param nullable {@code true} if {@code NULL } allowed for column in database. - * @param unsigned {@code true} if column is unsigned. - */ - public DbColumn(String name, int type, boolean key, boolean nullable, boolean unsigned) { - this.name = name; - this.type = type; - this.key = key; - this.nullable = nullable; - this.unsigned = unsigned; - } - - /** - * @return Column name. - */ - public String name() { - return name; - } - - /** - * @return Column JDBC type. - */ - public int type() { - return type; - } - - /** - * @return {@code true} if this column belongs to primary key. - */ - public boolean key() { - return key; - } - - /** - * @return {@code true} if {@code NULL } allowed for column in database. - */ - public boolean nullable() { - return nullable; - } - - /** - * @return {@code true} if column is unsigned. - */ - public boolean unsigned() { - return unsigned; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java ---------------------------------------------------------------------- diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java deleted file mode 100644 index 5b45f33..0000000 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema.parser; - -import org.apache.ignite.schema.parser.dialect.*; - -import java.io.*; -import java.net.*; -import java.sql.*; -import java.util.*; -import java.util.logging.*; - -/** - * Singleton to extract database metadata. - */ -public class DbMetadataReader { - /** Logger. */ - private static final Logger log = Logger.getLogger(DbMetadataReader.class.getName()); - - /** */ - private static final DbMetadataReader INSTANCE = new DbMetadataReader(); - - /** */ - private final Map drivers = new HashMap<>(); - - /** - * Default constructor. - */ - private DbMetadataReader() { - // No-op. - } - - /** - * @return Instance. - */ - public static DbMetadataReader getInstance() { - return INSTANCE; - } - - /** - * Get specified dialect object for selected database. - * - * @param conn Connection to database. - * @return Specific dialect object. - */ - private DatabaseMetadataDialect dialect(Connection conn) { - try { - String dbProductName = conn.getMetaData().getDatabaseProductName(); - - if ("Oracle".equals(dbProductName)) - return new OracleMetadataDialect(); - else if (dbProductName.startsWith("DB2/")) - return new DB2MetadataDialect(); - else if (dbProductName.equals("MySQL")) - return new MySQLMetadataDialect(); - else - return new JdbcMetadataDialect(); - } - catch (SQLException e) { - log.log(Level.SEVERE, "Failed to resolve dialect (JdbcMetaDataDialect will be used.", e); - - return new JdbcMetadataDialect(); - } - } - - /** - * Get list of schemas from database. - * - * @param conn Connection to database. - * @return List of schema names. - * @throws SQLException If schemas loading failed. - */ - public Collection schemas(Connection conn) throws SQLException { - return dialect(conn).schemas(conn); - } - - /** - * Extract DB metadata. - * - * @param conn Connection. - * @param schemas List of database schemas to process. In case of empty list all schemas will be processed. - * @param tblsOnly Tables only flag. - */ - public Collection metadata(Connection conn, List schemas, boolean tblsOnly) throws SQLException { - return dialect(conn).tables(conn, schemas, tblsOnly); - } - - /** - * Connect to database. - * - * @param jdbcDrvJarPath Path to JDBC driver. - * @param jdbcDrvCls JDBC class name. - * @param jdbcUrl JDBC connection URL. - * @param jdbcInfo Connection properties. - * @return Connection to database. - * @throws SQLException if connection failed. - */ - public Connection connect(String jdbcDrvJarPath, String jdbcDrvCls, String jdbcUrl, Properties jdbcInfo) - throws SQLException { - Driver drv = drivers.get(jdbcDrvCls); - - if (drv == null) { - if (jdbcDrvJarPath.isEmpty()) - throw new IllegalStateException("Driver jar file name is not specified."); - - File drvJar = new File(jdbcDrvJarPath); - - if (!drvJar.exists()) - throw new IllegalStateException("Driver jar file is not found."); - - try { - URL u = new URL("jar:" + drvJar.toURI() + "!/"); - - URLClassLoader ucl = URLClassLoader.newInstance(new URL[] {u}); - - drv = (Driver)Class.forName(jdbcDrvCls, true, ucl).newInstance(); - - drivers.put(jdbcDrvCls, drv); - } - catch (Exception e) { - throw new IllegalStateException(e); - } - } - - Connection conn = drv.connect(jdbcUrl, jdbcInfo); - - if (conn == null) - throw new IllegalStateException("Connection was not established (JDBC driver returned null value)."); - - return conn; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java ---------------------------------------------------------------------- diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java deleted file mode 100644 index 39f6f7b..0000000 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema.parser; - -import org.apache.ignite.cache.QueryIndex; - -import java.util.Collection; - -/** - * Database table. - */ -public class DbTable { - /** Schema name. */ - private final String schema; - - /** Table name. */ - private final String tbl; - - /** Columns. */ - private final Collection cols; - - /** Indexes. */ - private final Collection idxs; - - /** - * Default columns. - * - * @param schema Schema name. - * @param tbl Table name. - * @param cols Columns. - * @param idxs Indexes; - */ - public DbTable(String schema, String tbl, Collection cols, Collection idxs) { - this.schema = schema; - this.tbl = tbl; - this.cols = cols; - this.idxs = idxs; - } - - /** - * @return Schema name. - */ - public String schema() { - return schema; - } - - /** - * @return Table name. - */ - public String table() { - return tbl; - } - - /** - * @return Columns. - */ - public Collection columns() { - return cols; - } - - /** - * @return Indexes. - */ - public Collection indexes() { - return idxs; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java ---------------------------------------------------------------------- diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java deleted file mode 100644 index d277e4b..0000000 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema.parser.dialect; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * DB2 specific metadata dialect. - */ -public class DB2MetadataDialect extends JdbcMetadataDialect { - /** {@inheritDoc} */ - @Override public Set systemSchemas() { - return new HashSet<>(Arrays.asList("SYSIBM", "SYSCAT", "SYSSTAT", "SYSTOOLS", "SYSFUN", "SYSIBMADM", - "SYSIBMINTERNAL", "SYSIBMTS", "SYSPROC", "SYSPUBLIC")); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java ---------------------------------------------------------------------- diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java deleted file mode 100644 index 56ee59b..0000000 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - -package org.apache.ignite.schema.parser.dialect; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Set; - -import org.apache.ignite.cache.QueryIndex; -import org.apache.ignite.cache.QueryIndexType; -import org.apache.ignite.schema.parser.DbColumn; -import org.apache.ignite.schema.parser.DbTable; - -/** - * Base class for database metadata dialect. - */ -public abstract class DatabaseMetadataDialect { - /** - * Gets schemas from database. - * - * @param conn Database connection. - * @return Collection of schema descriptors. - * @throws SQLException If failed to get schemas. - */ - public abstract Collection schemas(Connection conn) throws SQLException; - - /** - * Gets tables from database. - * - * @param conn Database connection. - * @param schemas Collection of schema names to load. - * @param tblsOnly If {@code true} then gets only tables otherwise gets tables and views. - * @return Collection of table descriptors. - * @throws SQLException If failed to get tables. - */ - public abstract Collection tables(Connection conn, List schemas, boolean tblsOnly) - throws SQLException; - - /** - * @return Collection of database system schemas. - */ - public Set systemSchemas() { - return Collections.singleton("INFORMATION_SCHEMA"); - } - - /** - * @return Collection of unsigned type names. - * @throws SQLException If failed to get unsigned type names. - */ - public Set unsignedTypes(DatabaseMetaData dbMeta) throws SQLException { - return Collections.emptySet(); - } - - /** - * Create table descriptor. - * - * @param schema Schema name. - * @param tbl Table name. - * @param cols Table columns. - * @param idxs Table indexes. - * @return New {@code DbTable} instance. - */ - protected DbTable table(String schema, String tbl, Collection cols, Collectionidxs) { - return new DbTable(schema, tbl, cols, idxs); - } - - /** - * Create index descriptor. - * - * @param idxName Index name. - * @return New initialized {@code QueryIndex} instance. - */ - protected QueryIndex index(String idxName) { - QueryIndex idx = new QueryIndex(); - - idx.setName(idxName); - idx.setIndexType(QueryIndexType.SORTED); - idx.setFields(new LinkedHashMap()); - - return idx; - } -}