# IGNITE-329 Renaming.

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9cf45b43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9cf45b43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9cf45b43

Branch: refs/heads/ignite-443
Commit: 9cf45b43f9e365d5eb58bf8ec08dd90b22294e1c
Parents: d7a969b
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Tue Mar 10 17:58:38 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Tue Mar 10 17:58:38 2015 +0700

----------------------------------------------------------------------
 bin/ignite-schema-import.bat                    |  116 ++
 bin/ignite-schema-import.sh                     |   78 +
 bin/ignite-schema-load.bat                      |  116 --
 bin/ignite-schema-load.sh                       |   78 -
 modules/schema-import/pom.xml                   |  107 ++
 modules/schema-import/readme.txt                |  159 ++
 .../main/java/media/data_connection_48x48.png   |  Bin 0 -> 4443 bytes
 .../src/main/java/media/error_48x48.png         |  Bin 0 -> 4349 bytes
 .../src/main/java/media/ignite_128x128.png      |  Bin 0 -> 4917 bytes
 .../src/main/java/media/ignite_16x16.png        |  Bin 0 -> 608 bytes
 .../src/main/java/media/ignite_24x24.png        |  Bin 0 -> 930 bytes
 .../src/main/java/media/ignite_32x32.png        |  Bin 0 -> 1203 bytes
 .../src/main/java/media/ignite_48x48.png        |  Bin 0 -> 1868 bytes
 .../src/main/java/media/ignite_64x64.png        |  Bin 0 -> 2453 bytes
 .../src/main/java/media/information_48x48.png   |  Bin 0 -> 4102 bytes
 .../src/main/java/media/question_48x48.png      |  Bin 0 -> 3857 bytes
 .../src/main/java/media/sign_warning_48x48.png  |  Bin 0 -> 2988 bytes
 .../schema-import/src/main/java/media/style.css |  117 ++
 .../src/main/java/media/text_tree_48x48.png     |  Bin 0 -> 2567 bytes
 .../ignite/schema/generator/PojoGenerator.java  |  414 +++++
 .../schema/generator/SnippetGenerator.java      |  138 ++
 .../ignite/schema/generator/XmlGenerator.java   |  347 ++++
 .../ignite/schema/model/PojoDescriptor.java     |  510 ++++++
 .../apache/ignite/schema/model/PojoField.java   |  420 +++++
 .../schema/parser/DatabaseMetadataParser.java   |  108 ++
 .../apache/ignite/schema/parser/DbColumn.java   |   76 +
 .../apache/ignite/schema/parser/DbTable.java    |  105 ++
 .../parser/dialect/DB2MetadataDialect.java      |   30 +
 .../parser/dialect/DatabaseMetadataDialect.java |   78 +
 .../parser/dialect/JdbcMetadataDialect.java     |  141 ++
 .../parser/dialect/OracleMetadataDialect.java   |  281 +++
 .../ignite/schema/ui/ConfirmCallable.java       |   81 +
 .../org/apache/ignite/schema/ui/Controls.java   |  661 +++++++
 .../org/apache/ignite/schema/ui/GridPaneEx.java |  177 ++
 .../org/apache/ignite/schema/ui/MessageBox.java |  246 +++
 .../apache/ignite/schema/ui/ModalDialog.java    |   50 +
 .../ignite/schema/ui/SchemaImportApp.java       | 1615 ++++++++++++++++++
 .../ignite/schema/ui/TextColumnValidator.java   |   32 +
 .../schema/load/AbstractSchemaLoaderTest.java   |  134 ++
 .../load/generator/PojoGeneratorTest.java       |   70 +
 .../schema/load/generator/XmlGeneratorTest.java |   50 +
 .../apache/ignite/schema/load/model/Ignite.xml  |  390 +++++
 .../apache/ignite/schema/load/model/Objects.txt |  502 ++++++
 .../ignite/schema/load/model/ObjectsKey.txt     |   96 ++
 .../ignite/schema/load/model/Primitives.txt     |  506 ++++++
 .../ignite/schema/load/model/PrimitivesKey.txt  |   96 ++
 .../load/parser/DbMetadataParserTest.java       |  118 ++
 .../testsuites/IgniteSchemaLoadTestSuite.java   |   41 +
 modules/schema-load/pom.xml                     |  107 --
 modules/schema-load/readme.txt                  |  159 --
 .../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-load/src/main/java/media/style.css   |  117 --
 .../src/main/java/media/text_tree_48x48.png     |  Bin 2567 -> 0 bytes
 .../ignite/schema/generator/PojoGenerator.java  |  414 -----
 .../schema/generator/SnippetGenerator.java      |  138 --
 .../ignite/schema/generator/XmlGenerator.java   |  347 ----
 .../ignite/schema/model/PojoDescriptor.java     |  510 ------
 .../apache/ignite/schema/model/PojoField.java   |  420 -----
 .../schema/parser/DatabaseMetadataParser.java   |  108 --
 .../apache/ignite/schema/parser/DbColumn.java   |   76 -
 .../apache/ignite/schema/parser/DbTable.java    |  105 --
 .../parser/dialect/DB2MetadataDialect.java      |   30 -
 .../parser/dialect/DatabaseMetadataDialect.java |   78 -
 .../parser/dialect/JdbcMetadataDialect.java     |  141 --
 .../parser/dialect/OracleMetadataDialect.java   |  281 ---
 .../ignite/schema/ui/ConfirmCallable.java       |   81 -
 .../org/apache/ignite/schema/ui/Controls.java   |  661 -------
 .../org/apache/ignite/schema/ui/GridPaneEx.java |  177 --
 .../org/apache/ignite/schema/ui/MessageBox.java |  246 ---
 .../apache/ignite/schema/ui/ModalDialog.java    |   50 -
 .../apache/ignite/schema/ui/SchemaLoadApp.java  | 1615 ------------------
 .../ignite/schema/ui/TextColumnValidator.java   |   32 -
 .../schema/load/AbstractSchemaLoaderTest.java   |  134 --
 .../load/generator/PojoGeneratorTest.java       |   70 -
 .../schema/load/generator/XmlGeneratorTest.java |   50 -
 .../apache/ignite/schema/load/model/Ignite.xml  |  390 -----
 .../apache/ignite/schema/load/model/Objects.txt |  502 ------
 .../ignite/schema/load/model/ObjectsKey.txt     |   96 --
 .../ignite/schema/load/model/Primitives.txt     |  506 ------
 .../ignite/schema/load/model/PrimitivesKey.txt  |   96 --
 .../load/parser/DbMetadataParserTest.java       |  118 --
 .../testsuites/IgniteSchemaLoadTestSuite.java   |   41 -
 pom.xml                                         |    2 +-
 93 files changed, 8091 insertions(+), 8091 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/bin/ignite-schema-import.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat
new file mode 100644
index 0000000..d64bb83
--- /dev/null
+++ b/bin/ignite-schema-import.bat
@@ -0,0 +1,116 @@
+::
+:: 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 Schema Load Utility.
+::
+
+@echo off
+
+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 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\target-classpath.bat" &:: Will be removed in 
release.
+
+::
+:: Set CLASS PATH
+::
+set 
CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_LIBS%;%IGNITE_HOME%\bin\include\schema-load\*
+
+::
+:: JVM options. See 
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details.
+::
+:: ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE
+::
+if "%JVM_OPTS%" == "" set JVM_OPTS=-Xms256m -Xmx1g
+
+"%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/incubator-ignite/blob/9cf45b43/bin/ignite-schema-import.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh
new file mode 100644
index 0000000..ccd65a4
--- /dev/null
+++ b/bin/ignite-schema-import.sh
@@ -0,0 +1,78 @@
+#!/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 Schema Load Utility.
+#
+
+#
+# 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
+
+#
+# Set IGNITE_LIBS.
+#
+. "${SCRIPTS_HOME}"/include/setenv.sh
+. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
+CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_LIBS}${SEP}${IGNITE_HOME}/bin/include/schema-load/*"
+
+# Mac OS specific support to display correct name in the dock.
+osname=`uname`
+
+if [ "${DOCK_OPTS}" == "" ]; then
+    DOCK_OPTS="-Xdock:name=Ignite Schema Load Utility"
+fi
+
+#
+# JVM options. See 
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details.
+#
+# ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE
+#
+if [ -z "$JVM_OPTS" ] ; then
+    JVM_OPTS="-Xms256m -Xmx1g"
+fi
+
+case $osname in
+    Darwin*)
+        "$JAVA" ${JVM_OPTS} "${DOCK_OPTS}" -cp "${CP}" 
org.apache.ignite.schema.ui.SchemaImportApp
+        ;;
+   *)
+        "$JAVA" ${JVM_OPTS} -cp "${CP}" 
org.apache.ignite.schema.ui.SchemaImportApp
+        ;;
+esac

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/bin/ignite-schema-load.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-load.bat b/bin/ignite-schema-load.bat
deleted file mode 100644
index db0c376..0000000
--- a/bin/ignite-schema-load.bat
+++ /dev/null
@@ -1,116 +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.
-::
-
-::
-:: Ignite Schema Load Utility.
-::
-
-@echo off
-
-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 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\target-classpath.bat" &:: Will be removed in 
release.
-
-::
-:: Set CLASS PATH
-::
-set 
CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_LIBS%;%IGNITE_HOME%\bin\include\schema-load\*
-
-::
-:: JVM options. See 
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details.
-::
-:: ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE
-::
-if "%JVM_OPTS%" == "" set JVM_OPTS=-Xms256m -Xmx1g
-
-"%JAVA_HOME%\bin\java.exe" %JVM_OPTS% -cp "%CP%" 
org.apache.ignite.schema.ui.SchemaLoadApp
-
-:error_finish
-
-goto :eof

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/bin/ignite-schema-load.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-load.sh b/bin/ignite-schema-load.sh
deleted file mode 100644
index aae72b0..0000000
--- a/bin/ignite-schema-load.sh
+++ /dev/null
@@ -1,78 +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.
-#
-
-#
-# Ignite Schema Load Utility.
-#
-
-#
-# 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
-
-#
-# Set IGNITE_LIBS.
-#
-. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
-CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_LIBS}${SEP}${IGNITE_HOME}/bin/include/schema-load/*"
-
-# Mac OS specific support to display correct name in the dock.
-osname=`uname`
-
-if [ "${DOCK_OPTS}" == "" ]; then
-    DOCK_OPTS="-Xdock:name=Ignite Schema Load Utility"
-fi
-
-#
-# JVM options. See 
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details.
-#
-# ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE
-#
-if [ -z "$JVM_OPTS" ] ; then
-    JVM_OPTS="-Xms256m -Xmx1g"
-fi
-
-case $osname in
-    Darwin*)
-        "$JAVA" ${JVM_OPTS} "${DOCK_OPTS}" -cp "${CP}" 
org.apache.ignite.schema.ui.SchemaLoadApp
-        ;;
-   *)
-        "$JAVA" ${JVM_OPTS} -cp "${CP}" 
org.apache.ignite.schema.ui.SchemaLoadApp
-        ;;
-esac

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
new file mode 100644
index 0000000..8186fd3
--- /dev/null
+++ b/modules/schema-import/pom.xml
@@ -0,0 +1,107 @@
+<?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";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite</artifactId>
+        <version>${ignite.version}</version>
+        <relativePath>../..</relativePath>
+    </parent>
+
+    <artifactId>ignite-schema-import</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>1.3.175</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+        </resources>
+
+        <testResources>
+            <testResource>
+                <directory>src/test/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+        </testResources>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            
<mainClass>org.apache.ignite.schema.ui.SchemaImportApp</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>jfxrt.jar</id>
+            <activation>
+                <property>
+                    <name>java.vendor</name>
+                    <value>Oracle Corporation</value>
+                </property>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>javafx</groupId>
+                    <artifactId>jfxrt</artifactId>
+                    <version>${java.version}</version>
+                    <scope>system</scope>
+                    <systemPath>${java.home}/lib/jfxrt.jar</systemPath>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/readme.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/readme.txt b/modules/schema-import/readme.txt
new file mode 100644
index 0000000..2f19d10
--- /dev/null
+++ b/modules/schema-import/readme.txt
@@ -0,0 +1,159 @@
+Apache Ignite Schema Import Module
+------------------------------
+
+Apache Ignite Schema-loading module provides a simple utility that 
automatically reads the database schema,
+creates required type mapping description, and optionally generates the domain 
model in Java.
+
+For running utility use 'ignite-schema-import.{sh|bat}' script. For connection 
with RDBMS system from utility
+you need to provide: connection url and jdbc driver.
+
+
+Moving from disk-based architectures to in-memory architectures
+------------------------------------------
+
+Use Schema-loading utility for generation of type mapping and domain model in 
Java.
+
+For example you may use the following script for create sample type in your 
RDBMS system:
+
+create table PERSONS(id integer not null, firstName varchar(50), lastName 
varchar(50), PRIMARY KEY(id));
+
+insert into PERSONS(id, first_name, last_name) values(1, 'Johannes', 'Kepler');
+insert into PERSONS(id, first_name, last_name) values(2, 'Galileo', 'Galilei');
+insert into PERSONS(id, first_name, last_name) values(3, 'Henry', 'More');
+insert into PERSONS(id, first_name, last_name) values(4, 'Polish', 'Brethren');
+insert into PERSONS(id, first_name, last_name) values(5, 'Robert', 'Boyle');
+insert into PERSONS(id, first_name, last_name) values(6, 'Isaac', 'Newton');
+
+You need place compiled domain model classes, jdbc driver (used for connect to 
you RDBMS system) in Ignite node classpath,
+for example place in 'libs' folder.
+
+Append type mapping description generated by Schema-loading utility to your 
cache configuration and setup DataSource
+to your RDBMS system for cache store.
+
+Example of spring configuration:
+
+<bean class="org.apache.ignite.configuration.IgniteConfiguration">
+    ...
+    <!-- Cache configuration. -->
+    <property name="cacheConfiguration">
+        <list>
+            <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                ...
+
+                <!-- Cache store. -->
+                <property name="cacheStoreFactory">
+                    <bean 
class="javax.cache.configuration.FactoryBuilder$SingletonFactory">
+                        <constructor-arg>
+                            <bean 
class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore">
+                                <property name="dataSource">
+                                    <!-- TODO: Need specify connection pooling 
DataSource to your RDBMS system. -->
+                                    ...
+                                </property>
+                            </bean>
+                        </constructor-arg>
+                    </bean>
+                </property>
+
+                <!-- Type mapping description. -->
+                <property name="typeMetadata">
+                    <list>
+                        <bean 
class="org.apache.ignite.cache.CacheTypeMetadata">
+                            <property name="databaseTable" value="PERSON"/>
+                            <property name="keyType" 
value="org.apache.ignite.examples.datagrid.store.model.PersonKey"/>
+                            <property name="valueType" 
value="org.apache.ignite.examples.datagrid.store.model.Person"/>
+                            <property name="keyFields">
+                                <list>
+                                    <bean 
class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                        <property name="databaseName" 
value="ID"/>
+                                        <property name="databaseType">
+                                            <util:constant 
static-field="java.sql.Types.BIGINT"/>
+                                        </property>
+                                        <property name="javaName" value="id"/>
+                                        <property name="javaType" 
value="long"/>
+                                    </bean>
+                                </list>
+                            </property>
+                            <property name="valueFields">
+                                <list>
+                                    <bean 
class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                        <property name="databaseName" 
value="ID"/>
+                                        <property name="databaseType">
+                                            <util:constant 
static-field="java.sql.Types.BIGINT"/>
+                                        </property>
+                                        <property name="javaName" value="id"/>
+                                        <property name="javaType" 
value="long"/>
+                                    </bean>
+                                    <bean 
class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                        <property name="databaseName" 
value="FIRST_NAME"/>
+                                        <property name="databaseType">
+                                            <util:constant 
static-field="java.sql.Types.VARCHAR"/>
+                                        </property>
+                                        <property name="javaName" 
value="firstName"/>
+                                        <property name="javaType" 
value="java.lang.String"/>
+                                    </bean>
+                                    <bean 
class="org.apache.ignite.cache.CacheTypeFieldMetadata">
+                                        <property name="databaseName" 
value="LAST_NAME"/>
+                                        <property name="databaseType">
+                                            <util:constant 
static-field="java.sql.Types.VARCHAR"/>
+                                        </property>
+                                        <property name="javaName" 
value="lastName"/>
+                                        <property name="javaType" 
value="java.lang.String"/>
+                                    </bean>
+                                </list>
+                            </property>
+                        </bean>
+                    </list>
+                </property>
+                ...
+            </bean>
+        </list>
+    </property>
+    ...
+</bean>
+
+Example of java code configuration:
+
+IgniteConfiguration cfg = new IgniteConfiguration();
+...
+CacheConfiguration ccfg = new CacheConfiguration<>();
+
+DataSource dataSource = null; // TODO: Need specify connection pooling 
DataSource to your RDBMS system.
+
+// Create store.
+CacheJdbcPojoStore store = new CacheJdbcPojoStore();
+store.setDataSource(dataSource);
+
+// Create store factory.
+ccfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory<>(store));
+
+// Configure cache to use store.
+ccfg.setReadThrough(true);
+ccfg.setWriteThrough(true);
+
+// Configure cache types.
+Collection<CacheTypeMetadata> meta = new ArrayList<>();
+
+// PERSONS type mapping.
+CacheTypeMetadata tm = new CacheTypeMetadata();
+
+tm.setDatabaseTable("PERSONS");
+
+tm.setKeyType("java.lang.Long");
+tm.setValueType("org.apache.ignite.examples.datagrid.store.model.Person");
+
+// Key fields for PERSONS.
+tm.setKeyFields(F.asList(new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", 
Long.class)));
+
+// Value fields for PERSONS.
+tm.setValueFields(F.asList(
+    new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", long.class),
+    new CacheTypeFieldMetadata("FIRST_NAME", Types.VARCHAR, "firstName", 
String.class),
+    new CacheTypeFieldMetadata("LAST_NAME", Types.VARCHAR, "lastName", 
String.class)
+));
+...
+ccfg.setTypeMetadata(tm);
+
+cfg.setCacheConfiguration(ccfg);
+...
+// Start Ignite node.
+Ignition.start(cfg);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/data_connection_48x48.png
----------------------------------------------------------------------
diff --git 
a/modules/schema-import/src/main/java/media/data_connection_48x48.png 
b/modules/schema-import/src/main/java/media/data_connection_48x48.png
new file mode 100644
index 0000000..475f219
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/data_connection_48x48.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/error_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/error_48x48.png 
b/modules/schema-import/src/main/java/media/error_48x48.png
new file mode 100644
index 0000000..e341b8a
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/error_48x48.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/ignite_128x128.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_128x128.png 
b/modules/schema-import/src/main/java/media/ignite_128x128.png
new file mode 100644
index 0000000..d99a83c
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/ignite_128x128.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/ignite_16x16.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_16x16.png 
b/modules/schema-import/src/main/java/media/ignite_16x16.png
new file mode 100644
index 0000000..3e07d33
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/ignite_16x16.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/ignite_24x24.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_24x24.png 
b/modules/schema-import/src/main/java/media/ignite_24x24.png
new file mode 100644
index 0000000..8da5c97
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/ignite_24x24.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/ignite_32x32.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_32x32.png 
b/modules/schema-import/src/main/java/media/ignite_32x32.png
new file mode 100644
index 0000000..c6c6819
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/ignite_32x32.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/ignite_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_48x48.png 
b/modules/schema-import/src/main/java/media/ignite_48x48.png
new file mode 100644
index 0000000..5b684cc
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/ignite_48x48.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/ignite_64x64.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_64x64.png 
b/modules/schema-import/src/main/java/media/ignite_64x64.png
new file mode 100644
index 0000000..c1d348b
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/ignite_64x64.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/information_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/information_48x48.png 
b/modules/schema-import/src/main/java/media/information_48x48.png
new file mode 100644
index 0000000..8712a1b
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/information_48x48.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/question_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/question_48x48.png 
b/modules/schema-import/src/main/java/media/question_48x48.png
new file mode 100644
index 0000000..84683f9
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/question_48x48.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/sign_warning_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/sign_warning_48x48.png 
b/modules/schema-import/src/main/java/media/sign_warning_48x48.png
new file mode 100644
index 0000000..5e7cccd
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/sign_warning_48x48.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/style.css
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/style.css 
b/modules/schema-import/src/main/java/media/style.css
new file mode 100644
index 0000000..94ba240
--- /dev/null
+++ b/modules/schema-import/src/main/java/media/style.css
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+
+.root {
+    -fx-background-color: eeeeee;
+}
+
+.button {
+    -fx-font-size: 14;
+    -fx-focus-color: gray;
+}
+
+.label {
+    -fx-font-size: 14;
+}
+
+.check-box {
+    -fx-font-size: 14;
+    -fx-focus-color: gray;
+}
+
+.combo-box-base  {
+    -fx-font-size: 14;
+    -fx-focus-color: gray;
+}
+
+.combo-box-popup .list-view {
+    -fx-font-size : 14pt;
+}
+
+.text-area {
+    -fx-font-size: 14;
+    -fx-background-color: transparent, transparent, transparent;
+}
+
+.text-field {
+    -fx-font-size: 14;
+    -fx-background-color: -fx-text-box-border, -fx-control-inner-background, 
-fx-control-inner-background;
+}
+
+.text-field:focused {
+    -fx-background-color: -fx-text-box-border, -fx-control-inner-background, 
-fx-control-inner-background;
+}
+
+.table-view {
+    -fx-focus-color: gray;
+}
+
+.table-view .table-row-cell:selected {
+    -fx-background-color: -fx-table-cell-border-color, -fx-cell-hover-color;
+    -fx-background-insets: 0, 0 0 1 0;
+}
+
+.table-view:focused .table-row-cell:selected {
+     -fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, 
-fx-selection-bar;
+}
+
+.table-row-cell:empty {
+    -fx-background-color: white;
+}
+
+.table-row-cell:empty .table-cell {
+    -fx-border-width: 0px;
+}
+
+.tooltip {
+    -fx-font-size: 14;
+    -fx-background-radius: 0 0 0 0;
+}
+
+.page-corner {
+    -fx-shape: " ";
+}
+
+.progress-indicator {
+    -fx-progress-color: gray
+}
+
+.split-pane {
+    -fx-background-color: -fx-box-border, eeeeee;
+}
+
+.titled-pane {
+    -fx-font-size: 14;
+}
+
+.titled-pane:focused {
+    -fx-text-fill: -fx-text-base-color;
+}
+
+.titled-pane:focused > .title {
+    -fx-color: eeeeee;
+}
+
+.titled-pane:focused > .title > .arrow-button .arrow {
+    -fx-background-color: black;
+}
+
+#banner {
+   -fx-font-size: 20px;
+   -fx-font-weight: bold;
+   -fx-background-color: white
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/media/text_tree_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/text_tree_48x48.png 
b/modules/schema-import/src/main/java/media/text_tree_48x48.png
new file mode 100644
index 0000000..6ca9e65
Binary files /dev/null and 
b/modules/schema-import/src/main/java/media/text_tree_48x48.png differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java
----------------------------------------------------------------------
diff --git 
a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java
 
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java
new file mode 100644
index 0000000..500aa9a
--- /dev/null
+++ 
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/PojoGenerator.java
@@ -0,0 +1,414 @@
+/*
+ * 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.generator;
+
+import org.apache.ignite.schema.model.*;
+import org.apache.ignite.schema.ui.*;
+
+import java.io.*;
+import java.text.*;
+import java.util.*;
+
+import static org.apache.ignite.schema.ui.MessageBox.Result.*;
+
+/**
+ * POJO generator for key and value classes.
+ */
+public class PojoGenerator {
+    /** */
+    private static final String TAB = "    ";
+    /** */
+    private static final String TAB2 = TAB + TAB;
+    /** */
+    private static final String TAB3 = TAB + TAB + TAB;
+
+    /**
+     * Add line to source code without indent.
+     *
+     * @param src Source code.
+     * @param line Code line.
+     */
+    private static void add0(Collection<String> src, String line) {
+        src.add(line);
+    }
+
+    /**
+     * Add line to source code with one indent.
+     *
+     * @param src Source code.
+     * @param line Code line.
+     */
+    private static void add1(Collection<String> src, String line) {
+        src.add(TAB + line);
+    }
+
+    /**
+     * Add line to source code with two indents.
+     *
+     * @param src Source code.
+     * @param line Code line.
+     */
+    private static void add2(Collection<String> src, String line) {
+        src.add(TAB2 + line);
+    }
+
+    /**
+     * Add line to source code with two indents.
+     *
+     * @param src Source code.
+     * @param fmt Code line with format placeholders.
+     * @param args Format arguments.
+     */
+    private static void add2Fmt(Collection<String> src, String fmt, Object... 
args) {
+        add2(src, String.format(fmt, args));
+    }
+
+    /**
+     * Add line to source code with three indents.
+     *
+     * @param src Source code.
+     * @param line Code line.
+     */
+    private static void add3(Collection<String> src, String line) {
+        src.add(TAB3 + line);
+    }
+
+    /**
+     * @param str Source string.
+     * @return String with first letters in upper case.
+     */
+    private static String capitalizeFirst(String str) {
+        return Character.toUpperCase(str.charAt(0)) + str.substring(1);
+    }
+
+    /**
+     * @param field POJO field descriptor.
+     * @return Field java type name.
+     */
+    private static String javaTypeName(PojoField field) {
+        String javaTypeName = field.javaTypeName();
+
+        return javaTypeName.startsWith("java.lang.") ? 
javaTypeName.substring(10) : javaTypeName;
+    }
+
+    /**
+     * Generate java class code.
+     *
+     * @param pojo POJO descriptor.
+     * @param key {@code true} if key class should be generated.
+     * @param pkg Package name.
+     * @param pkgFolder Folder where to save generated class.
+     * @param constructor {@code true} if empty and full constructors should 
be generated.
+     * @param includeKeys {@code true} if key fields should be included into 
value class.
+     * @param askOverwrite Callback to ask user to confirm file overwrite.
+     * @throws IOException If failed to write generated code into file.
+     */
+    private static void generateCode(PojoDescriptor pojo, boolean key, String 
pkg, File pkgFolder,
+        boolean constructor, boolean includeKeys, ConfirmCallable 
askOverwrite) throws IOException {
+        String type = key ? pojo.keyClassName() : pojo.valueClassName();
+
+        File out = new File(pkgFolder, type + ".java");
+
+        if (out.exists()) {
+            MessageBox.Result choice = askOverwrite.confirm(out.getName());
+
+            if (CANCEL == choice)
+                throw new IllegalStateException("POJO generation was 
canceled!");
+
+            if (NO == choice || NO_TO_ALL == choice)
+                return;
+        }
+
+        Collection<String> src = new ArrayList<>(256);
+
+        // License.
+        add0(src, "/*");
+        add0(src, " * Licensed to the Apache Software Foundation (ASF) under 
one or more");
+        add0(src, " * contributor license agreements.  See the NOTICE file 
distributed with");
+        add0(src, " * this work for additional information regarding copyright 
ownership.");
+        add0(src, " * The ASF licenses this file to You under the Apache 
License, Version 2.0");
+        add0(src, " * (the \"License\"); you may not use this file except in 
compliance with");
+        add0(src, " * the License.  You may obtain a copy of the License at");
+        add0(src, " *");
+        add0(src, " *      http://www.apache.org/licenses/LICENSE-2.0";);
+        add0(src, " *");
+        add0(src, " * Unless required by applicable law or agreed to in 
writing, software");
+        add0(src, " * distributed under the License is distributed on an \"AS 
IS\" BASIS,");
+        add0(src, " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.");
+        add0(src, " * See the License for the specific language governing 
permissions and");
+        add0(src, " * limitations under the License.");
+        add0(src, " */");
+        add0(src, "");
+
+        // Package.
+        add0(src, "package " + pkg + ";");
+        add0(src, "");
+
+        // Imports.
+        add0(src, "import java.io.*;");
+        add0(src, "");
+
+        // Class.
+        add0(src, "/**");
+        add0(src, " * " + type + " definition.");
+        add0(src, " *");
+        add0(src, " * Code generated by Apache Ignite Schema Load utility: " + 
new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + ".");
+        add0(src, " */");
+        add0(src, "public class " + type + " implements Serializable {");
+
+        add1(src, "/** */");
+        add1(src, "private static final long serialVersionUID = 0L;");
+        add0(src, "");
+
+        Collection<PojoField> fields = key ? pojo.keyFields() : 
pojo.valueFields(includeKeys);
+
+        // Generate fields declaration.
+        for (PojoField field : fields) {
+            String fldName = field.javaName();
+
+            add1(src, "/** Value for " + fldName + ". */");
+
+            if (key && field.affinityKey())
+                add1(src, "@CacheAffinityKeyMapped");
+
+            add1(src, "private " + javaTypeName(field) + " " + fldName + ";");
+            add0(src, "");
+        }
+
+        // Generate constructors.
+        if (constructor) {
+            add1(src, "/**");
+            add1(src, " * Empty constructor.");
+            add1(src, " */");
+            add1(src, "public " + type + "() {");
+            add2(src, "// No-op.");
+            add1(src, "}");
+
+            add0(src, "");
+
+            add1(src, "/**");
+            add1(src, " * Full constructor.");
+            add1(src, " */");
+            add1(src, "public " + type + "(");
+
+            Iterator<PojoField> it = fields.iterator();
+
+            while (it.hasNext()) {
+                PojoField field = it.next();
+
+                add2(src, javaTypeName(field) + " " + field.javaName() + 
(it.hasNext() ? "," : ""));
+            }
+            add1(src, ") {");
+
+            for (PojoField field : fields)
+                add2Fmt(src, "this.%1$s = %1$s;", field.javaName());
+
+            add1(src, "}");
+            add0(src, "");
+        }
+
+        // Generate getters and setters methods.
+        for (PojoField field : fields) {
+            String fldName = field.javaName();
+
+            String fldType = javaTypeName(field);
+
+            String mtdName = capitalizeFirst(fldName);
+
+            add1(src, "/**");
+            add1(src, " * Gets " + fldName + ".");
+            add1(src, " *");
+            add1(src, " * @return Value for " + fldName + ".");
+            add1(src, " */");
+            add1(src, "public " + fldType + " get" + mtdName + "() {");
+            add2(src, "return " + fldName + ";");
+            add1(src, "}");
+            add0(src, "");
+
+            add1(src, "/**");
+            add1(src, " * Sets " + fldName + ".");
+            add1(src, " *");
+            add1(src, " * @param " + fldName + " New value for " + fldName + 
".");
+            add1(src, " */");
+            add1(src, "public void set" + mtdName + "(" + fldType + " " + 
fldName + ") {");
+            add2(src, "this." + fldName + " = " + fldName + ";");
+            add1(src, "}");
+            add0(src, "");
+        }
+
+        // Generate equals() method.
+        add1(src, "/** {@inheritDoc} */");
+        add1(src, "@Override public boolean equals(Object o) {");
+        add2(src, "if (this == o)");
+        add3(src, "return true;");
+        add0(src, "");
+
+        add2(src, "if (!(o instanceof " + type + "))");
+        add3(src, "return false;");
+        add0(src, "");
+
+        add2Fmt(src, "%1$s that = (%1$s)o;", type);
+
+        for (PojoField field : fields) {
+            add0(src, "");
+
+            String javaName = field.javaName();
+
+            if (field.primitive()) {
+                switch (field.javaTypeName()) {
+                    case "float":
+                        add2Fmt(src, "if (Float.compare(%1$s, that.%1$s) != 
0)", javaName);
+                        break;
+
+                    case "double":
+                        add2Fmt(src, "if (Double.compare(%1$s, that.%1$s) != 
0)", javaName);
+                        break;
+
+                    default:
+                        add2Fmt(src, "if (%1$s != that.%1$s)", javaName);
+                }
+            }
+            else
+                add2Fmt(src, "if (%1$s != null ? !%1$s.equals(that.%1$s) : 
that.%1$s != null)", javaName);
+
+            add3(src, "return false;");
+        }
+
+        add0(src, "");
+        add2(src, "return true;");
+        add1(src, "}");
+        add0(src, "");
+
+        // Generate hashCode() method.
+        add1(src, "/** {@inheritDoc} */");
+        add1(src, "@Override public int hashCode() {");
+
+        List<String> hash = new ArrayList<>(fields.size() * 2);
+
+        boolean first = true;
+        boolean tempVar = false;
+
+        for (PojoField field : fields) {
+            String javaName = field.javaName();
+
+            if (!first)
+                add0(hash, "");
+
+            if (field.primitive()) {
+                switch (field.javaTypeName()) {
+                    case "boolean":
+                        add2Fmt(hash, first ? "int res = %s ? 1 : 0;" : "res = 
31 * res + (%s ? 1 : 0);", javaName);
+                        break;
+
+                    case "byte":
+                    case "short":
+                        add2Fmt(hash, first ? "int res = (int)%s;" : "res = 31 
* res + (int)%s;", javaName);
+                        break;
+
+                    case "int":
+                        add2Fmt(hash, first ? "int res = %s;" : "res = 31 * 
res + %s;", javaName);
+                        break;
+
+                    case "long":
+                        add2Fmt(hash, first
+                            ? "int res = (int)(%1$s ^ (%1$s >>> 32));"
+                            : "res = 31 * res + (int)(%1$s ^ (%1$s >>> 32));", 
javaName);
+                        break;
+
+                    case "float":
+                        add2Fmt(hash, first
+                            ? "int res = %1$s != +0.0f ? 
Float.floatToIntBits(%1$s) : 0;"
+                            : "res = 31 * res + (%1$s != +0.0f ? 
Float.floatToIntBits(%1$s) : 0);", javaName);
+                        break;
+
+                    case "double":
+                        add2Fmt(hash, (tempVar ? "ig_hash_temp" : "long 
ig_hash_temp") +
+                            " = Double.doubleToLongBits(%s);", javaName);
+
+                        add0(hash, "");
+
+                        add2Fmt(hash, first
+                            ? "int res = (int)(ig_hash_temp ^ (ig_hash_temp 
>>> 32));"
+                            : "res = 31 * res + (int)(ig_hash_temp ^ 
(ig_hash_temp >>> 32));", javaName);
+
+                        tempVar = true;
+                        break;
+                }
+            }
+            else
+                add2Fmt(hash, first ? "int res = %1$s != null ? 
%1$s.hashCode() : 0;"
+                    : "res = 31 * res + (%1$s != null ? %1$s.hashCode() : 
0);", javaName);
+
+            first = false;
+        }
+
+        for (String line : hash)
+            add0(src, line);
+
+        add0(src, "");
+        add2(src, "return res;");
+        add1(src, "}");
+        add0(src, "");
+
+        // Generate toString() method.
+        add1(src, "/** {@inheritDoc} */");
+        add1(src, "@Override public String toString() {");
+
+        Iterator<PojoField> it = fields.iterator();
+
+        add2Fmt(src, "return \"%1$s [%2$s=\" + %2$s +", type, 
it.next().javaName());
+
+        while (it.hasNext())
+            add3(src, String.format("\", %1$s=\" + %1$s +", 
it.next().javaName()));
+
+        add3(src, "\"]\";");
+        add1(src, "}");
+
+        add0(src, "}");
+        add0(src, "");
+
+        // Write generated code to file.
+        try (Writer writer = new BufferedWriter(new FileWriter(out))) {
+            for (String line : src)
+                writer.write(line + '\n');
+        }
+    }
+
+    /**
+     * Generate source code for type by its metadata.
+     *
+     * @param pojo POJO descriptor.
+     * @param outFolder Output folder.
+     * @param pkg Types package.
+     * @param constructor {@code true} if empty and full constructors should 
be generated.
+     * @param includeKeys {@code true} if key fields should be included into 
value class.
+     * @param askOverwrite Callback to ask user to confirm file overwrite.
+     * @throws IOException If failed to write generated code into file.
+     */
+    public static void generate(PojoDescriptor pojo, String outFolder, String 
pkg, boolean constructor,
+        boolean includeKeys, ConfirmCallable askOverwrite) throws IOException {
+        File pkgFolder = new File(outFolder, pkg.replace('.', 
File.separatorChar));
+
+        if (!pkgFolder.exists() && !pkgFolder.mkdirs())
+            throw new IOException("Failed to create folders for package: " + 
pkg);
+
+        generateCode(pojo, true, pkg, pkgFolder, constructor, false, 
askOverwrite);
+
+        generateCode(pojo, false, pkg, pkgFolder, constructor, includeKeys, 
askOverwrite);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/SnippetGenerator.java
----------------------------------------------------------------------
diff --git 
a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/SnippetGenerator.java
 
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/SnippetGenerator.java
new file mode 100644
index 0000000..4abd5a6
--- /dev/null
+++ 
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/SnippetGenerator.java
@@ -0,0 +1,138 @@
+/*
+ * 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.generator;
+
+import org.apache.ignite.schema.model.*;
+import org.apache.ignite.schema.ui.*;
+
+import java.io.*;
+import java.util.*;
+
+import static org.apache.ignite.schema.ui.MessageBox.Result.*;
+
+/**
+ * Cache configuration snippet generator.
+ */
+public class SnippetGenerator {
+    /**
+     * Add type fields.
+     *
+     * @param src Source code lines.
+     * @param owner Fields owner collection.
+     * @param fields Fields metadata.
+     */
+    private static void addFields(Collection<String> src, String owner, 
Collection<PojoField> fields) {
+        for (PojoField field : fields) {
+            String javaTypeName = field.javaTypeName();
+
+            if (javaTypeName.startsWith("java.lang."))
+                javaTypeName = javaTypeName.substring(10);
+
+            src.add(owner + ".add(new CacheTypeFieldMetadata(\"" + 
field.dbName() + "\", " +
+                "java.sql.Types." + field.dbTypeName() + ",\"" +
+                field.javaName() + "\", " + javaTypeName + ".class));");
+        }
+    }
+
+    /**
+     * Generate java snippet for cache configuration with JDBC store.
+     *
+     * @param pojos POJO descriptors.
+     * @param pkg Types package.
+     * @param includeKeys {@code true} if key fields should be included into 
value class.
+     * @param out File to output snippet.
+     * @param askOverwrite Callback to ask user to confirm file overwrite.
+     * @throws IOException If generation failed.
+     */
+    public static void generate(Collection<PojoDescriptor> pojos, String pkg, 
boolean includeKeys, File out,
+        ConfirmCallable askOverwrite) throws IOException {
+        if (out.exists()) {
+            MessageBox.Result choice = askOverwrite.confirm(out.getName());
+
+            if (CANCEL == choice)
+                throw new IllegalStateException("Java configuration snippet 
generation was canceled!");
+
+            if (NO == choice || NO_TO_ALL == choice)
+                return;
+        }
+
+        Collection<String> src = new ArrayList<>(256);
+
+        src.add("// Code snippet for cache configuration.");
+        src.add("");
+        src.add("IgniteConfiguration cfg = new IgniteConfiguration();");
+        src.add("");
+        src.add("CacheConfiguration ccfg = new CacheConfiguration<>();");
+        src.add("");
+        src.add("DataSource dataSource = null; // TODO: Create data source for 
your database.");
+        src.add("");
+        src.add("// Create store. ");
+        src.add("CacheJdbcPojoStore store = new CacheJdbcPojoStore();");
+        src.add("store.setDataSource(dataSource);");
+        src.add("");
+        src.add("// Create store factory. ");
+        src.add("ccfg.setCacheStoreFactory(new 
FactoryBuilder.SingletonFactory<>(store));");
+        src.add("");
+        src.add("// Configure cache to use store. ");
+        src.add("ccfg.setReadThrough(true);");
+        src.add("ccfg.setWriteThrough(true);");
+        src.add("");
+        src.add("cfg.setCacheConfiguration(ccfg);");
+        src.add("");
+        src.add("// Configure cache types. ");
+        src.add("Collection<CacheTypeMetadata> meta = new ArrayList<>();");
+        src.add("");
+
+        boolean first = true;
+
+        for (PojoDescriptor pojo : pojos) {
+            String tbl = pojo.table();
+
+            src.add("// " + tbl + ".");
+            src.add((first ? "CacheTypeMetadata " : "") +  "type = new 
CacheTypeMetadata();");
+            src.add("type.setDatabaseSchema(\"" + pojo.schema() + "\");");
+            src.add("type.setDatabaseTable(\"" + tbl + "\");");
+            src.add("type.setKeyType(\"" + pkg + "." + pojo.keyClassName() + 
"\");");
+            src.add("type.setValueType(\"" +  pkg + "." + 
pojo.valueClassName() + "\");");
+            src.add("");
+
+            src.add("// Key fields for " + tbl + ".");
+            src.add((first ? "Collection<CacheTypeFieldMetadata> " : "") + 
"keys = new ArrayList<>();");
+            addFields(src, "keys", pojo.keyFields());
+            src.add("type.setKeyFields(keys);");
+            src.add("");
+
+            src.add("// Value fields for " + tbl + ".");
+            src.add((first ? "Collection<CacheTypeFieldMetadata> " : "") + 
"vals = new ArrayList<>();");
+            addFields(src, "vals", pojo.valueFields(includeKeys));
+            src.add("type.setValueFields(vals);");
+            src.add("");
+
+            first = false;
+        }
+
+        src.add("// Start Ignite node.");
+        src.add("Ignition.start(cfg);");
+
+        // Write generated code to file.
+        try (Writer writer = new BufferedWriter(new FileWriter(out))) {
+            for (String line : src)
+                writer.write(line + '\n');
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cf45b43/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
----------------------------------------------------------------------
diff --git 
a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
 
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
new file mode 100644
index 0000000..c62a720
--- /dev/null
+++ 
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
@@ -0,0 +1,347 @@
+/*
+ * 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.generator;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.schema.model.*;
+import org.apache.ignite.schema.ui.*;
+import org.w3c.dom.*;
+
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import javax.xml.transform.stream.*;
+import java.io.*;
+import java.nio.file.*;
+import java.text.*;
+import java.util.*;
+
+import static org.apache.ignite.schema.ui.MessageBox.Result.*;
+
+/**
+ * Generator of XML files for type metadata.
+ */
+public class XmlGenerator {
+    /**
+     * Add comment with license and generation date.
+     *
+     * @param doc XML document.
+     */
+    private static void addComment(Document doc) {
+        doc.appendChild(doc.createComment("\n" +
+            "  Licensed to the Apache Software Foundation (ASF) under one or 
more\n" +
+            "  contributor license agreements.  See the NOTICE file 
distributed with\n" +
+            "  this work for additional information regarding copyright 
ownership.\n" +
+            "  The ASF licenses this file to You under the Apache License, 
Version 2.0\n" +
+            "  (the \"License\"); you may not use this file except in 
compliance with\n" +
+            "  the License.  You may obtain a copy of the License at\n\n" +
+            "       http://www.apache.org/licenses/LICENSE-2.0\n\n"; +
+            "  Unless required by applicable law or agreed to in writing, 
software\n" +
+            "  distributed under the License is distributed on an \"AS IS\" 
BASIS,\n" +
+            "  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
implied.\n" +
+            "  See the License for the specific language governing permissions 
and\n" +
+            "  limitations under the License.\n"));
+
+        doc.appendChild(doc.createComment("\n    XML generated by Apache 
Ignite Schema Load utility: " +
+            new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + "\n"));
+    }
+
+    /**
+     * Add bean to XML document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param clazz Bean class.
+     */
+    private static Element addBean(Document doc, Node parent, Class<?> clazz) {
+        Element elem = doc.createElement("bean");
+
+        elem.setAttribute("class", clazz.getName());
+
+        parent.appendChild(elem);
+
+        return elem;
+    }
+
+    /**
+     * Add element to XML document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param tagName XML tag name.
+     * @param attr1 Name for first attr.
+     * @param val1 Value for first attribute.
+     * @param attr2 Name for second attr.
+     * @param val2 Value for second attribute.
+     */
+    private static Element addElement(Document doc, Node parent, String 
tagName,
+        String attr1, String val1, String attr2, String val2) {
+        Element elem = doc.createElement(tagName);
+
+        if (attr1 != null)
+            elem.setAttribute(attr1, val1);
+
+        if (attr2 != null)
+            elem.setAttribute(attr2, val2);
+
+        parent.appendChild(elem);
+
+        return elem;
+    }
+
+    /**
+     * Add element to XML document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param tagName XML tag name.
+     */
+    private static Element addElement(Document doc, Node parent, String 
tagName) {
+        return addElement(doc, parent, tagName, null, null, null, null);
+    }
+
+    /**
+     * Add element to XML document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param tagName XML tag name.
+     */
+    private static Element addElement(Document doc, Node parent, String 
tagName, String attrName, String attrVal) {
+        return addElement(doc, parent, tagName, attrName, attrVal, null, null);
+    }
+
+    /**
+     * Add &quot;property&quot; element to XML document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param name Value for &quot;name&quot; attribute
+     * @param val Value for &quot;value&quot; attribute
+     */
+    private static Element addProperty(Document doc, Node parent, String name, 
String val) {
+        String valAttr = val != null ? "value" : null;
+
+        return addElement(doc, parent, "property", "name", name, valAttr, val);
+    }
+
+    /**
+     * Add type descriptors to XML document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param name Property name.
+     * @param fields Collection of POJO fields.
+     */
+    private static void addFields(Document doc, Node parent, String name, 
Collection<PojoField> fields) {
+        if (!fields.isEmpty()) {
+            Element prop = addProperty(doc, parent, name, null);
+
+            Element list = addElement(doc, prop, "list");
+
+            for (PojoField field : fields) {
+                Element item = addBean(doc, list, 
CacheTypeFieldMetadata.class);
+
+                addProperty(doc, item, "databaseName", field.dbName());
+                Element dbType = addProperty(doc, item, "databaseType", null);
+                addElement(doc, dbType, "util:constant", "static-field", 
"java.sql.Types." + field.dbTypeName());
+                addProperty(doc, item, "javaName", field.javaName());
+                addProperty(doc, item, "javaType", field.javaTypeName());
+            }
+        }
+    }
+
+    /**
+     * Add query fields to xml document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param name Property name.
+     * @param fields Map with fields.
+     */
+    private static void addQueryFields(Document doc, Node parent, String name, 
Collection<PojoField> fields) {
+        if (!fields.isEmpty()) {
+            Element prop = addProperty(doc, parent, name, null);
+
+            Element map = addElement(doc, prop, "map");
+
+            for (PojoField field : fields)
+                addElement(doc, map, "entry", "key", field.javaName(), 
"value", field.javaTypeName());
+        }
+    }
+
+    /**
+     * Add indexes to xml document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param groups Map with indexes.
+     */
+    private static void addQueryGroups(Document doc, Node parent,
+        Map<String, Map<String, IgniteBiTuple<String, Boolean>>> groups) {
+        if (!groups.isEmpty()) {
+            Element prop = addProperty(doc, parent, "groups", null);
+
+            Element map = addElement(doc, prop, "map");
+
+            for (Map.Entry<String, Map<String, IgniteBiTuple<String, 
Boolean>>> group : groups.entrySet()) {
+                Element entry1 = addElement(doc, map, "entry", "key", 
group.getKey());
+
+                Element val1 = addElement(doc, entry1, "map");
+
+                Map<String, IgniteBiTuple<String, Boolean>> fields = 
group.getValue();
+
+                for (Map.Entry<String, IgniteBiTuple<String, Boolean>> field : 
fields.entrySet()) {
+                    Element entry2 = addElement(doc, val1, "entry", "key", 
field.getKey());
+
+                    Element val2 = addBean(doc, entry2, IgniteBiTuple.class);
+
+                    IgniteBiTuple<String, Boolean> idx = field.getValue();
+
+                    addElement(doc, val2, "constructor-arg", null, null, 
"value", idx.get1());
+                    addElement(doc, val2, "constructor-arg", null, null, 
"value", String.valueOf(idx.get2()));
+                }
+            }
+        }
+    }
+
+    /**
+     * Add element with type metadata to XML document.
+     *
+     * @param doc XML document.
+     * @param parent Parent XML node.
+     * @param pkg Package fo types.
+     * @param pojo POJO descriptor.
+     */
+    private static void addTypeMetadata(Document doc, Node parent, String pkg, 
PojoDescriptor pojo,
+        boolean includeKeys) {
+        Element bean = addBean(doc, parent, CacheTypeMetadata.class);
+
+        addProperty(doc, bean, "databaseSchema", pojo.schema());
+
+        addProperty(doc, bean, "databaseTable", pojo.table());
+
+        addProperty(doc, bean, "keyType", pkg + "." + pojo.keyClassName());
+
+        addProperty(doc, bean, "valueType", pkg + "." + pojo.valueClassName());
+
+        addFields(doc, bean, "keyFields", pojo.keyFields());
+
+        addFields(doc, bean, "valueFields", pojo.valueFields(includeKeys));
+
+        addQueryFields(doc, bean, "queryFields", pojo.fields());
+
+        addQueryFields(doc, bean, "ascendingFields", pojo.ascendingFields());
+
+        addQueryFields(doc, bean, "descendingFields", pojo.descendingFields());
+
+        addQueryGroups(doc, bean, pojo.groups());
+    }
+
+    /**
+     * Transform metadata into xml.
+     *
+     * @param pkg Package fo types.
+     * @param pojo POJO descriptor.
+     * @param out File to output result.
+     * @param askOverwrite Callback to ask user to confirm file overwrite.
+     */
+    public static void generate(String pkg, PojoDescriptor pojo, boolean 
includeKeys, File out,
+        ConfirmCallable askOverwrite) {
+        generate(pkg, Collections.singleton(pojo), includeKeys, out, 
askOverwrite);
+    }
+
+    /**
+     * Transform metadata into xml.
+     *
+     * @param pkg Package fo types.
+     * @param pojos POJO descriptors.
+     * @param out File to output result.
+     * @param askOverwrite Callback to ask user to confirm file overwrite.
+     */
+    public static void generate(String pkg, Collection<PojoDescriptor> pojos, 
boolean includeKeys, File out,
+        ConfirmCallable askOverwrite) {
+
+        File outFolder = out.getParentFile();
+
+        if (outFolder == null)
+            throw new IllegalStateException("Invalid output file: " + out);
+
+        if (!outFolder.exists() && !outFolder.mkdirs())
+            throw new IllegalStateException("Failed to create output folder 
for XML file: " + outFolder);
+
+        try {
+            if (out.exists()) {
+                MessageBox.Result choice = askOverwrite.confirm(out.getName());
+
+                if (CANCEL == choice)
+                    throw new IllegalStateException("XML generation was 
canceled!");
+
+                if (NO == choice || NO_TO_ALL == choice)
+                    return;
+            }
+
+            DocumentBuilderFactory docFactory = 
DocumentBuilderFactory.newInstance();
+
+            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+
+            Document doc = docBuilder.newDocument();
+            doc.setXmlStandalone(true);
+
+            addComment(doc);
+
+            Element beans = addElement(doc, doc, "beans");
+            beans.setAttribute("xmlns", 
"http://www.springframework.org/schema/beans";);
+            beans.setAttribute("xmlns:xsi", 
"http://www.w3.org/2001/XMLSchema-instance";);
+            beans.setAttribute("xmlns:util", 
"http://www.springframework.org/schema/util";);
+            beans.setAttribute("xsi:schemaLocation",
+                "http://www.springframework.org/schema/beans " +
+                "http://www.springframework.org/schema/beans/spring-beans.xsd 
" +
+                "http://www.springframework.org/schema/util " +
+                "http://www.springframework.org/schema/util/spring-util.xsd";);
+
+            for (PojoDescriptor pojo : pojos)
+                addTypeMetadata(doc, beans, pkg, pojo, includeKeys);
+
+            TransformerFactory transformerFactory = 
TransformerFactory.newInstance();
+
+            Transformer transformer = transformerFactory.newTransformer();
+
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount";, "4");
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream(65536);
+
+            transformer.transform(new DOMSource(doc), new StreamResult(baos));
+
+            // Custom pretty-print of generated XML.
+            Files.write(out.toPath(), baos.toString()
+                .replaceAll("><", ">\n<")
+                .replaceFirst("<!--", "\n<!--")
+                .replaceFirst("-->", "-->\n")
+                .replaceAll("\" xmlns", "\"\n       xmlns")
+                .replaceAll("\" xsi", "\"\n       xsi")
+                .replaceAll(" http://www.springframework";, "\n                 
          http://www.springframework";)
+                .getBytes());
+        }
+        catch (ParserConfigurationException | TransformerException | 
IOException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+}

Reply via email to