You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dm...@apache.org on 2017/04/11 01:38:35 UTC

[35/50] [abbrv] ignite git commit: IGNITE-4349 Discontinue the schema-import utility.

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java
deleted file mode 100644
index 07361ba..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java
+++ /dev/null
@@ -1,199 +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.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.schema.parser.DbColumn;
-import org.apache.ignite.schema.parser.DbTable;
-
-/**
- * Metadata dialect that uses standard JDBC for reading metadata.
- */
-public class JdbcMetadataDialect extends DatabaseMetadataDialect {
-    /** */
-    private static final String[] TABLES_ONLY = {"TABLE"};
-
-    /** */
-    private static final String[] TABLES_AND_VIEWS = {"TABLE", "VIEW"};
-
-    /** Schema catalog index. */
-    private static final int TBL_CATALOG_IDX = 1;
-
-    /** Schema name index. */
-    private static final int TBL_SCHEMA_IDX = 2;
-
-    /** Table name index. */
-    private static final int TBL_NAME_IDX = 3;
-
-    /** Primary key column name index. */
-    private static final int PK_COL_NAME_IDX = 4;
-
-    /** Column name index. */
-    private static final int COL_NAME_IDX = 4;
-
-    /** Column data type index. */
-    private static final int COL_DATA_TYPE_IDX = 5;
-
-    /** Column type name index. */
-    private static final int COL_TYPE_NAME_IDX = 6;
-
-    /** Column nullable index. */
-    private static final int COL_NULLABLE_IDX = 11;
-
-    /** Index name index. */
-    private static final int IDX_NAME_IDX = 6;
-
-    /** Index column name index. */
-    private static final int IDX_COL_NAME_IDX = 9;
-
-    /** Index column descend index. */
-    private static final int IDX_ASC_OR_DESC_IDX = 10;
-
-    /** {@inheritDoc} */
-    @Override public Collection<String> schemas(Connection conn) throws SQLException {
-        Collection<String> schemas = new ArrayList<>();
-
-        ResultSet rs = conn.getMetaData().getSchemas();
-
-        Set<String> sys = systemSchemas();
-
-        while(rs.next()) {
-            String schema = rs.getString(1);
-
-            // Skip system schemas.
-            if (sys.contains(schema))
-                continue;
-
-            schemas.add(schema);
-        }
-
-        return schemas;
-    }
-
-    /**
-     * @return If {@code true} use catalogs for table division.
-     */
-    protected boolean useCatalog() {
-        return false;
-    }
-
-    /**
-     * @return If {@code true} use schemas for table division.
-     */
-    protected boolean useSchema() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
-        throws SQLException {
-        DatabaseMetaData dbMeta = conn.getMetaData();
-
-        Set<String> sys = systemSchemas();
-
-        Collection<String> unsignedTypes = unsignedTypes(dbMeta);
-
-        if (schemas.isEmpty())
-            schemas.add(null);
-
-        Collection<DbTable> tbls = new ArrayList<>();
-
-        for (String toSchema: schemas) {
-            try (ResultSet tblsRs = dbMeta.getTables(useCatalog() ? toSchema : null, useSchema() ? toSchema : null, "%",
-                    tblsOnly ? TABLES_ONLY : TABLES_AND_VIEWS)) {
-                while (tblsRs.next()) {
-                    String tblCatalog = tblsRs.getString(TBL_CATALOG_IDX);
-                    String tblSchema = tblsRs.getString(TBL_SCHEMA_IDX);
-                    String tblName = tblsRs.getString(TBL_NAME_IDX);
-
-                    // In case of MySql we should use catalog.
-                    String schema = tblSchema != null ? tblSchema : tblCatalog;
-
-                    // Skip system schemas.
-                    if (sys.contains(schema))
-                        continue;
-
-                    Collection<String> pkCols = new HashSet<>();
-
-                    try (ResultSet pkRs = dbMeta.getPrimaryKeys(tblCatalog, tblSchema, tblName)) {
-                        while (pkRs.next())
-                            pkCols.add(pkRs.getString(PK_COL_NAME_IDX));
-                    }
-
-                    Collection<DbColumn> cols = new ArrayList<>();
-
-                    try (ResultSet colsRs = dbMeta.getColumns(tblCatalog, tblSchema, tblName, null)) {
-                        while (colsRs.next()) {
-                            String colName = colsRs.getString(COL_NAME_IDX);
-
-                            cols.add(new DbColumn(
-                                colName,
-                                colsRs.getInt(COL_DATA_TYPE_IDX),
-                                pkCols.contains(colName),
-                                colsRs.getInt(COL_NULLABLE_IDX) == DatabaseMetaData.columnNullable,
-                                unsignedTypes.contains(colsRs.getString(COL_TYPE_NAME_IDX))));
-                        }
-                    }
-
-                    Map<String, QueryIndex> idxs = new LinkedHashMap<>();
-
-                    try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, false, true)) {
-                        while (idxRs.next()) {
-                            String idxName = idxRs.getString(IDX_NAME_IDX);
-
-                            String colName = idxRs.getString(IDX_COL_NAME_IDX);
-
-                            if (idxName == null || colName == null)
-                                continue;
-
-                            QueryIndex idx = idxs.get(idxName);
-
-                            if (idx == null) {
-                                idx = index(idxName);
-
-                                idxs.put(idxName, idx);
-                            }
-
-                            String askOrDesc = idxRs.getString(IDX_ASC_OR_DESC_IDX);
-
-                            Boolean asc = askOrDesc == null || "A".equals(askOrDesc);
-
-                            idx.getFields().put(colName, asc);
-                        }
-                    }
-
-                    tbls.add(table(schema, tblName, cols, idxs.values()));
-                }
-            }
-        }
-
-        return tbls;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java
deleted file mode 100644
index 7bd6f31..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.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.dialect;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * MySQL specific metadata dialect.
- */
-public class MySQLMetadataDialect extends JdbcMetadataDialect {
-    /** Type name index. */
-    private static final int TYPE_NAME_IDX = 1;
-
-    /** {@inheritDoc} */
-    @Override public Collection<String> schemas(Connection conn) throws SQLException {
-        Collection<String> schemas = new ArrayList<>();
-
-        ResultSet rs = conn.getMetaData().getCatalogs();
-
-        Set<String> sys = systemSchemas();
-
-        while(rs.next()) {
-            String schema = rs.getString(1);
-
-            // Skip system schemas.
-            if (sys.contains(schema))
-                continue;
-
-            schemas.add(schema);
-        }
-
-        return schemas;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean useCatalog() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean useSchema() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set<String> unsignedTypes(DatabaseMetaData dbMeta) throws SQLException {
-        Set<String> unsignedTypes = new HashSet<>();
-
-        try (ResultSet typeRs = dbMeta.getTypeInfo()) {
-            while (typeRs.next()) {
-                String typeName = typeRs.getString(TYPE_NAME_IDX);
-
-                if (typeName.contains("UNSIGNED"))
-                    unsignedTypes.add(typeName);
-            }
-        }
-
-        return unsignedTypes;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
deleted file mode 100644
index 47fb05c..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
+++ /dev/null
@@ -1,360 +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.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-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;
-
-import static java.sql.Types.BIGINT;
-import static java.sql.Types.BLOB;
-import static java.sql.Types.BOOLEAN;
-import static java.sql.Types.CHAR;
-import static java.sql.Types.CLOB;
-import static java.sql.Types.DATE;
-import static java.sql.Types.DOUBLE;
-import static java.sql.Types.FLOAT;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.LONGVARBINARY;
-import static java.sql.Types.LONGVARCHAR;
-import static java.sql.Types.NUMERIC;
-import static java.sql.Types.OTHER;
-import static java.sql.Types.SMALLINT;
-import static java.sql.Types.SQLXML;
-import static java.sql.Types.TIMESTAMP;
-import static java.sql.Types.TINYINT;
-import static java.sql.Types.VARCHAR;
-
-/**
- * Oracle specific metadata dialect.
- */
-public class OracleMetadataDialect extends DatabaseMetadataDialect {
-    /** SQL to get columns metadata. */
-    private static final String SQL_COLUMNS = "SELECT a.owner, a.table_name, a.column_name, a.nullable," +
-        " a.data_type, a.data_precision, a.data_scale " +
-        "FROM all_tab_columns a %s " +
-        " %s " +
-        " ORDER BY a.owner, a.table_name, a.column_id";
-
-    /** SQL to get list of PRIMARY KEYS columns. */
-    private static final String SQL_PRIMARY_KEYS = "SELECT b.column_name" +
-        " FROM all_constraints a" +
-        "  INNER JOIN all_cons_columns b ON a.owner = b.owner AND a.constraint_name = b.constraint_name" +
-        " WHERE a.owner = ? and a.table_name = ? AND a.constraint_type = 'P'";
-
-    /** SQL to get indexes metadata. */
-    private static final String SQL_INDEXES = "SELECT i.index_name, u.column_expression, i.column_name, i.descend" +
-        " FROM all_ind_columns i" +
-        " LEFT JOIN user_ind_expressions u on u.index_name = i.index_name and i.table_name = u.table_name" +
-        " WHERE i.index_owner = ? and i.table_name = ?" +
-        " ORDER BY i.index_name, i.column_position";
-
-    /** Owner index. */
-    private static final int OWNER_IDX = 1;
-
-    /** Table name index. */
-    private static final int TBL_NAME_IDX = 2;
-
-    /** Column name index. */
-    private static final int COL_NAME_IDX = 3;
-
-    /** Nullable index. */
-    private static final int NULLABLE_IDX = 4;
-
-    /** Data type index. */
-    private static final int DATA_TYPE_IDX = 5;
-
-    /** Numeric precision index. */
-    private static final int DATA_PRECISION_IDX = 6;
-
-    /** Numeric scale index. */
-    private static final int DATA_SCALE_IDX = 7;
-
-    /** Index name index. */
-    private static final int IDX_NAME_IDX = 1;
-
-    /** Index name index. */
-    private static final int IDX_EXPR_IDX = 2;
-
-    /** Index column name index. */
-    private static final int IDX_COL_NAME_IDX = 3;
-
-    /** Index column sort order index. */
-    private static final int IDX_COL_DESCEND_IDX = 4;
-
-    /** {@inheritDoc} */
-    @Override public Set<String> systemSchemas() {
-        return new HashSet<>(Arrays.asList("ANONYMOUS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS", "MGMT_VIEW",
-            "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM",
-            "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB",
-
-            "APEX_040000", "APEX_PUBLIC_USER", "DIP", "FLOWS_30000", "FLOWS_FILES", "MDDATA", "ORACLE_OCM",
-            "SPATIAL_CSW_ADMIN_USR", "SPATIAL_WFS_ADMIN_USR", "XS$NULL",
-
-            "BI", "HR", "OE", "PM", "IX", "SH"));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<String> schemas(Connection conn) throws SQLException {
-        Collection<String> schemas = new ArrayList<>();
-
-        ResultSet rs = conn.getMetaData().getSchemas();
-
-        Set<String> sysSchemas = systemSchemas();
-
-        while(rs.next()) {
-            String schema = rs.getString(1);
-
-            if (!sysSchemas.contains(schema) && !schema.startsWith("FLOWS_"))
-                schemas.add(schema);
-        }
-
-        return schemas;
-    }
-
-    /**
-     * @param rs Result set with column type metadata from Oracle database.
-     * @return JDBC type.
-     * @throws SQLException If failed to decode type.
-     */
-    private int decodeType(ResultSet rs) throws SQLException {
-        String type = rs.getString(DATA_TYPE_IDX);
-
-        if (type.startsWith("TIMESTAMP"))
-            return TIMESTAMP;
-        else {
-            switch (type) {
-                case "CHAR":
-                case "NCHAR":
-                    return CHAR;
-
-                case "VARCHAR2":
-                case "NVARCHAR2":
-                    return VARCHAR;
-
-                case "LONG":
-                    return LONGVARCHAR;
-
-                case "LONG RAW":
-                    return LONGVARBINARY;
-
-                case "FLOAT":
-                    return FLOAT;
-
-                case "NUMBER":
-                    int precision = rs.getInt(DATA_PRECISION_IDX);
-                    int scale = rs.getInt(DATA_SCALE_IDX);
-
-                    if (scale > 0) {
-                        if (scale < 4 && precision < 19)
-                            return FLOAT;
-
-                        if (scale > 4 || precision > 19)
-                            return DOUBLE;
-
-                        return NUMERIC;
-                    }
-                    else {
-                        if (precision < 1)
-                            return INTEGER;
-
-                        if (precision < 2)
-                            return BOOLEAN;
-
-                        if (precision < 4)
-                            return TINYINT;
-
-                        if (precision < 6)
-                            return SMALLINT;
-
-                        if (precision < 11)
-                            return INTEGER;
-
-                        if (precision < 20)
-                            return BIGINT;
-
-                        return NUMERIC;
-                    }
-
-                case "DATE":
-                    return DATE;
-
-                case "BFILE":
-                case "BLOB":
-                    return BLOB;
-
-                case "CLOB":
-                case "NCLOB":
-                    return CLOB;
-
-                case "XMLTYPE":
-                    return SQLXML;
-            }
-        }
-
-        return OTHER;
-    }
-
-    /**
-     * Retrieve primary key columns.
-     *
-     * @param stmt Prepared SQL statement to execute.
-     * @param owner DB owner.
-     * @param tbl Table name.
-     * @return Primary key columns.
-     * @throws SQLException If failed to retrieve primary key columns.
-     */
-    private Set<String> primaryKeys(PreparedStatement stmt, String owner, String tbl) throws SQLException {
-        Set<String> pkCols = new HashSet<>();
-
-        stmt.setString(1, owner);
-        stmt.setString(2, tbl);
-
-        try (ResultSet pkRs = stmt.executeQuery()) {
-            while(pkRs.next())
-                pkCols.add(pkRs.getString(1));
-        }
-
-        return pkCols;
-    }
-
-    /**
-     * Retrieve index columns.
-     *
-     * @param stmt Prepared SQL statement to execute.
-     * @param owner DB owner.
-     * @param tbl Table name.
-     * @return Indexes.
-     * @throws SQLException If failed to retrieve indexes columns.
-     */
-    private Collection<QueryIndex> indexes(PreparedStatement stmt, String owner, String tbl) throws SQLException {
-        Map<String, QueryIndex> idxs = new LinkedHashMap<>();
-
-        stmt.setString(1, owner);
-        stmt.setString(2, tbl);
-
-        try (ResultSet idxsRs = stmt.executeQuery()) {
-            while (idxsRs.next()) {
-                String idxName = idxsRs.getString(IDX_NAME_IDX);
-
-                QueryIndex idx = idxs.get(idxName);
-
-                if (idx == null) {
-                    idx = index(idxName);
-
-                    idxs.put(idxName, idx);
-                }
-
-                String expr = idxsRs.getString(IDX_EXPR_IDX);
-
-                String col = expr == null ? idxsRs.getString(IDX_COL_NAME_IDX) : expr.replaceAll("\"", "");
-
-                idx.getFields().put(col, !"DESC".equals(idxsRs.getString(IDX_COL_DESCEND_IDX)));
-            }
-        }
-
-        return idxs.values();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
-        throws SQLException {
-        Collection<DbTable> tbls = new ArrayList<>();
-
-        PreparedStatement pkStmt = conn.prepareStatement(SQL_PRIMARY_KEYS);
-
-        PreparedStatement idxStmt = conn.prepareStatement(SQL_INDEXES);
-
-        if (schemas.isEmpty())
-            schemas.add(null);
-
-        Set<String> sysSchemas = systemSchemas();
-
-        try (Statement colsStmt = conn.createStatement()) {
-            for (String schema: schemas) {
-                if (systemSchemas().contains(schema) || (schema != null && schema.startsWith("FLOWS_")))
-                    continue;
-
-                Collection<DbColumn> cols = new ArrayList<>();
-
-                Set<String> pkCols = Collections.emptySet();
-                Collection<QueryIndex> idxs = Collections.emptyList();
-
-                String sql = String.format(SQL_COLUMNS,
-                        tblsOnly ? "INNER JOIN all_tables b on a.table_name = b.table_name and a.owner = b.owner" : "",
-                        schema != null ? String.format(" WHERE a.owner = '%s' ", schema) : "");
-
-                try (ResultSet colsRs = colsStmt.executeQuery(sql)) {
-                    String prevSchema = "";
-                    String prevTbl = "";
-
-                    boolean first = true;
-
-                    while (colsRs.next()) {
-                        String owner = colsRs.getString(OWNER_IDX);
-                        String tbl = colsRs.getString(TBL_NAME_IDX);
-
-                        if (sysSchemas.contains(owner) || (schema != null && schema.startsWith("FLOWS_")))
-                            continue;
-
-                        boolean changed = !owner.equals(prevSchema) || !tbl.equals(prevTbl);
-
-                        if (changed) {
-                            if (first)
-                                first = false;
-                            else
-                                tbls.add(table(prevSchema, prevTbl, cols, idxs));
-
-                            prevSchema = owner;
-                            prevTbl = tbl;
-                            cols = new ArrayList<>();
-                            pkCols = primaryKeys(pkStmt, owner, tbl);
-                            idxs = indexes(idxStmt, owner, tbl);
-                        }
-
-                        String colName = colsRs.getString(COL_NAME_IDX);
-
-                        cols.add(new DbColumn(colName, decodeType(colsRs), pkCols.contains(colName),
-                            !"N".equals(colsRs.getString(NULLABLE_IDX)), false));
-                    }
-
-                    if (!cols.isEmpty())
-                        tbls.add(table(prevSchema, prevTbl, cols, idxs));
-                }
-            }
-        }
-
-        return tbls;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/README.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/README.txt b/modules/schema-import/README.txt
deleted file mode 100644
index ba185b6..0000000
--- a/modules/schema-import/README.txt
+++ /dev/null
@@ -1,216 +0,0 @@
-Apache Ignite Schema Import Module
-------------------------------------------
-
-Ignite 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.
-
-To start the wizard for generating database schema mapping, execute bin/ignite-schema-import.sh script:
-
-For connection with RDBMS system from utility you need to provide: connection url and jdbc driver.
-Note that JDBC drivers are not supplied with the utility and should be provided separately.
-
-Moving from disk-based architectures to in-memory architectures
-------------------------------------------
-
-Use Schema Import Utility for generation of type mapping and domain model in Java.
-
-For example you may use the following script for create sample type 'Person' in your RDBMS system:
-
-create table PERSON(id integer not null PRIMARY KEY, first_name varchar(50), last_name varchar(50), salary double);
-
-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', 1200);
-insert into PERSON(id, first_name, last_name, salary) values(3, 'Henry', 'More', 1150);
-insert into PERSON(id, first_name, last_name, salary) values(4, 'Polish', 'Brethren', 2000);
-insert into PERSON(id, first_name, last_name, salary) values(5, 'Robert', 'Boyle', 2500);
-insert into PERSON(id, first_name, last_name, salary) values(6, 'Isaac', 'Newton', 1300);
-
-The Ignite Schema Import utility generates the following artifacts:
- # Java POJO key and value classes (enter "org.apache.ignite.schema" package name before generation).
- # XML QueryEntities configuration.
- # Java configuration snippet (alternative to XML).
-
-After you exit from the wizard, you should:
- # Copy generated POJO java classes to you project source folder.
- # Copy XML declaration of QueryEntitres to your Ignite XML configuration file under appropriate
-  CacheConfiguration root.
- # Setup your Ignite XML configuration file DataSource to your RDBMS system for CacheJdbcPojoStore.
- # Or paste Java snippet with cache configuration into your Ignite initialization logic.
- # 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.
-
-Example of spring configuration:
-
-<!-- Sample data source. -->
-<bean id="myDataSource" class="org.h2.jdbcx.JdbcDataSource"/>
-
-<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="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
-                        <property name="dataSourceBean" value="myDataSource"/>
-                        <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore">
-                            <property name="dataSourceBean" value="myDataSource" />
-                            <property name="types">
-                                <list>
-                                    <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
-                                        <property name="cacheName" value="myCache" />
-                                        <property name="databaseSchema" value="MY_DB_SCHEMA" />
-                                        <property name="databaseTable" value="PERSON" />
-                                        <property name="keyType" value="java.lang.Integer" />
-                                        <property name="keyFields">
-                                            <list>
-                                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
-                                                    <property name="databaseFieldType" >
-                                                        <util:constant static-field="java.sql.Types.INTEGER"/>
-                                                    </property>
-                                                    <property name="databaseFieldName" value="ID" />
-                                                    <property name="javaFieldType" value="java.lang.Integer" />
-                                                    <property name="javaFieldName" value="id" />
-                                                </bean>
-                                            </list>
-                                        </property>
-                                        <property name="valueType" value="my.company.Person" />
-                                        <property name="valueFields">
-                                            <list>
-                                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
-                                                    <property name="databaseFieldType" >
-                                                        <util:constant static-field="java.sql.Types.VARCHAR"/>
-                                                    </property>
-                                                    <property name="databaseFieldName" value="first_name" />
-                                                    <property name="javaFieldType" value="java.lang.String" />
-                                                    <property name="javaFieldName" value="firstName" />
-                                                </bean>
-                                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
-                                                    <property name="databaseFieldType" >
-                                                        <util:constant static-field="java.sql.Types.VARCHAR"/>
-                                                    </property>
-                                                    <property name="databaseFieldName" value="last_name" />
-                                                    <property name="javaFieldType" value="java.lang.String" />
-                                                    <property name="javaFieldName" value="lastName" />
-                                                </bean>
-                                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
-                                                    <property name="databaseFieldType" >
-                                                        <util:constant static-field="java.sql.Types.DOUBLE"/>
-                                                    </property>
-                                                    <property name="databaseFieldName" value="salary" />
-                                                    <property name="javaFieldType" value="java.lang.Double" />
-                                                    <property name="javaFieldName" value="salary" />
-                                                </bean>
-                                            </list>
-                                        </property>
-                                    </bean>
-                                </list>
-                            </property>
-                        </bean>
-                    </bean>
-                </property>
-                ...
-            </bean>
-        </list>
-    </property>
-    ...
-</bean>
-
-Example of java code configuration:
-
-IgniteConfiguration cfg = new IgniteConfiguration();
-...
-CacheConfiguration ccfg = new CacheConfiguration<>();
-
-// Create store factory.
-CacheJdbcPojoStoreFactory storeFactory = new CacheJdbcPojoStoreFactory();
-storeFactory.setDataSourceBean("myDataSource");
-
-// Configure cache types.
-Collection<JdbcType> jdbcTypes = new ArrayList<>();
-
-// PERSON type mapping.
-JdbcType jdbcType = new JdbcType();
-
-jdbcType.setCacheName(CACHE_NAME);
-
-jdbcType.setDatabaseSchema("MY_DB_SCHEMA");
-jdbcType.setDatabaseTable("PERSON");
-
-jdbcType.setKeyType("java.lang.Integer");
-jdbcType.setValueType("my.company.Person");
-
-// Key fields for PERSONS.
-jdbcType.setKeyFields(F.asArray(new JdbcType(Types.INTEGER, "ID", Integer.class, "id")));
-
-// Value fields for PERSONS.
-jdbcType.setValueFields(F.asArray(
-    new JdbcType(Types.INTEGER, "ID", int.class, "id"),
-    new JdbcType(Types.VARCHAR, "first_name", String.class, "firstName"),
-    new JdbcType(Types.VARCHAR, "last_name", String.class, "lastName"),
-    new JdbcType(Types.DOUBLE, "salary", Double.class, "salary")
-));
-
-storeFactory.setTypes(jdbcTypes.toArray(new JdbcType[]));
-
-// Configure cache to use store.
-ccfg.setReadThrough(true);
-ccfg.setWriteThrough(true);
-ccfg.setCacheStoreFactory(storeFactory);
-
-cfg.setCacheConfiguration(ccfg);
-
-...
-
-// Start Ignite node.
-Ignition.start(cfg);
-
-Now you can load all data from database to cache:
-    IgniteCache<Long, Person> cache = ignite.jcache(CACHE_NAME);
-    cache.loadCache(null);
-
-Or you can load data from database to cache with custom SQL:
-    cache.loadCache(null, "java.lang.Long", "select * from PERSON where id = 2")
-
-Also if you put data into cache it will be inserted / updated in underlying database.
-
-
-Performance optimization.
-------------------------------------------
-
-1. Use DataSource with connection pool.
-2. Enable write-behind feature by default write-behind is disabled.
-   Note, write-behind should not be used with TRANSACTIONAL caches.
-
-Example of spring configuration:
-
-<bean class="org.apache.ignite.configuration.IgniteConfiguration">
-    ...
-    <!-- Cache configuration. -->
-    <property name="cacheConfiguration">
-        <list>
-            <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                ...
-                <!-- Sets flag indicating whether write-behind is enabled.. -->
-                <property name="writeBehindEnabled" value="true/>
-                ...
-            </bean>
-        </list>
-    </property>
-    ...
-</bean>
-
-Example of java code configuration:
-
-IgniteConfiguration cfg = new IgniteConfiguration();
-...
-CacheConfiguration ccfg = new CacheConfiguration<>();
-...
-ccfg.setWriteBehindEnabled(true);
-...
-// Start Ignite node.
-Ignition.start(cfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
deleted file mode 100644
index 5380dcc..0000000
--- a/modules/schema-import/pom.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?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-parent</artifactId>
-        <version>1</version>
-        <relativePath>../../parent</relativePath>
-    </parent>
-
-    <artifactId>ignite-schema-import</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
-    <url>http://ignite.apache.org</url>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-schema-import-db</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <version>${h2.version}</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>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-deploy-plugin</artifactId>
-                <configuration>
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>schema-import</id>
-            <activation>
-                <file>
-                    <exists>${java.home}/lib/jfxrt.jar</exists>
-                </file>
-            </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/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 475f219..0000000
Binary files a/modules/schema-import/src/main/java/media/data_connection_48x48.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index e341b8a..0000000
Binary files a/modules/schema-import/src/main/java/media/error_48x48.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index d99a83c..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_128x128.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 3e07d33..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_16x16.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 8da5c97..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_24x24.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index c6c6819..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_32x32.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 5b684cc..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_48x48.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index c1d348b..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_64x64.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 8712a1b..0000000
Binary files a/modules/schema-import/src/main/java/media/information_48x48.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 84683f9..0000000
Binary files a/modules/schema-import/src/main/java/media/question_48x48.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 5e7cccd..0000000
Binary files a/modules/schema-import/src/main/java/media/sign_warning_48x48.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 6eee5f9..0000000
--- a/modules/schema-import/src/main/java/media/style.css
+++ /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.
- */
-
-.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 : 14;
-}
-
-.text-area {
-    -fx-font-size: 14;
-    -fx-background-color: transparent, transparent, transparent;
-}
-
-.text-area .scroll-pane {
-    -fx-background-color: transparent;
-}
-
-.text-area .scroll-pane .viewport{
-    -fx-background-color: transparent;
-}
-
-.text-area .scroll-pane .content{
-    -fx-background-color: transparent;
-}
-
-.text-area .scroll-bar:vertical:disabled {
-    -fx-opacity: 0;
-}
-
-.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;
-    -fx-font-size: 14;
-}
-
-.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/ignite/blob/f6ee9c0f/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
deleted file mode 100644
index 6ca9e65..0000000
Binary files a/modules/schema-import/src/main/java/media/text_tree_48x48.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
deleted file mode 100644
index 5cdc6c6..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
+++ /dev/null
@@ -1,831 +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.generator;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.model.PojoField;
-import org.apache.ignite.schema.ui.ConfirmCallable;
-import org.apache.ignite.schema.ui.MessageBox;
-
-import static org.apache.ignite.schema.ui.MessageBox.Result.CANCEL;
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO;
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO_TO_ALL;
-
-/**
- * Code generator of POJOs for key and value classes and configuration snippet.
- */
-public class CodeGenerator {
-    /** */
-    private static final String TAB = "    ";
-    /** */
-    private static final String TAB2 = TAB + TAB;
-    /** */
-    private static final String TAB3 = TAB + TAB + TAB;
-
-    /** Java key words. */
-    private static final Set<String> JAVA_KEYWORDS = new HashSet<>(Arrays.asList(
-        "abstract",     "assert",        "boolean",      "break",           "byte",
-        "case",         "catch",         "char",         "class",           "const",
-        "continue",     "default",       "do",           "double",          "else",
-        "enum",         "extends",       "false",        "final",           "finally",
-        "float",        "for",           "goto",         "if",              "implements",
-        "import",       "instanceof",    "int",          "interface",       "long",
-        "native",       "new",           "null",         "package",         "private",
-        "protected",    "public",        "return",       "short",           "static",
-        "strictfp",     "super",         "switch",       "synchronized",    "this",
-        "throw",        "throws",        "transient",    "true",            "try",
-        "void",         "volatile",      "while"
-    ));
-
-    /** java.lang.* */
-    private static final String JAVA_LANG_PKG = "java.lang.";
-
-    /** java.util.* */
-    private static final String JAVA_UTIL_PKG = "java.util.";
-
-    /** Regexp to validate java identifier. */
-    private static final Pattern VALID_JAVA_IDENTIFIER =
-        Pattern.compile("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*");
-
-    /**
-     * Checks if string is a valid java identifier.
-     *
-     * @param identifier String to check.
-     * @param split If {@code true} then identifier will be split by dots.
-     * @param msg Identifier type.
-     * @param type Checked type.
-     * @throws IllegalStateException If passed string is not valid java identifier.
-     */
-    private static void checkValidJavaIdentifier(String identifier, boolean split, String msg, String type)
-        throws IllegalStateException {
-        if (identifier.isEmpty())
-            throw new IllegalStateException(msg + " could not be empty!");
-
-        String[] parts = split ? identifier.split("\\.") : new String[] {identifier};
-
-        if (parts.length == 0)
-            throw new IllegalStateException(msg + " could not has empty parts!");
-
-        for (String part : parts) {
-            if (part.isEmpty())
-                throw new IllegalStateException(msg + " could not has empty parts!");
-
-            if (JAVA_KEYWORDS.contains(part))
-                throw new IllegalStateException(msg + " could not contains reserved keyword:" +
-                    " [type = " + type + ", identifier=" + identifier + ", keyword=" + part + "]");
-
-            if (!VALID_JAVA_IDENTIFIER.matcher(part).matches())
-                throw new IllegalStateException("Invalid " + msg.toLowerCase() + " name: " +
-                    " [type = " + type + ", identifier=" + identifier + ", illegal part=" + part + "]");
-        }
-    }
-
-    /**
-     * 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 type Full type name.
-     * @return Field java type name.
-     */
-    private static String javaTypeName(String type) {
-        return type.startsWith("java.lang.") ? type.substring(10) : type;
-    }
-
-    /**
-     * @param field POJO field descriptor.
-     * @return Field java type name.
-     */
-    private static String javaTypeName(PojoField field) {
-        return javaTypeName(field.javaTypeName());
-    }
-
-    /**
-     * Generate class header.
-     *
-     * @param src Source code.
-     * @param pkg Package name.
-     * @param desc Class description.
-     * @param cls Class declaration.
-     * @param imports Optional imports.
-     */
-    private static void header(Collection<String> src, String pkg, String desc, String cls, String... imports) {
-        // 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.
-        if (imports != null && imports.length > 0) {
-            for (String imp : imports)
-                add0(src, imp.isEmpty() ? "" : "import " + imp + ";");
-
-            add0(src, "");
-        }
-
-        // Class.
-        add0(src, "/**");
-        add0(src, " * " + desc + " definition.");
-        add0(src, " *");
-        add0(src, " * Code generated by Apache Ignite Schema Import utility: "
-            + new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + ".");
-        add0(src, " */");
-        add0(src, "public class " + cls + " {");
-    }
-
-    /**
-     * Write source code to file.
-     *
-     * @param src Source code.
-     * @param out Target file.
-     * @throws IOException If failed to write source code to file.
-     */
-    private static void write(Collection<String> src, File out) throws IOException {
-        // Write generated code to file.
-        try (Writer writer = new BufferedWriter(new FileWriter(out))) {
-            for (String line : src)
-                writer.write(line + '\n');
-        }
-    }
-
-    /**
-     * Ensure that all folders for packages exist.
-     *
-     * @param pkg Packages.
-     * @throws IOException If failed to ensure.
-     */
-    private static void ensurePackages(File pkg) throws IOException {
-        if (!pkg.exists() && !pkg.mkdirs())
-            throw new IOException("Failed to create folders for package: " + pkg);
-    }
-
-    /**
-     * 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();
-
-        checkValidJavaIdentifier(pkg, true, "Package", type);
-
-        checkValidJavaIdentifier(type, false, "Type", type);
-
-        ensurePackages(pkgFolder);
-
-        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);
-
-        header(src, pkg, type, type + " implements Serializable", "java.io.*");
-
-        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();
-
-            checkValidJavaIdentifier(fldName, false, "Field", type);
-
-            add1(src, "/** Value for " + fldName + ". */");
-
-            if (key && field.affinityKey())
-                add1(src, "@AffinityKeyMapped");
-
-            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.
-        write(src, out);
-    }
-
-    /**
-     * 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 pojos(PojoDescriptor pojo, String outFolder, String pkg, boolean constructor,
-        boolean includeKeys, ConfirmCallable askOverwrite) throws IOException {
-        File pkgFolder = new File(outFolder, pkg.replace('.', File.separatorChar));
-
-        generateCode(pojo, true, pkg, pkgFolder, constructor, false, askOverwrite);
-
-        generateCode(pojo, false, pkg, pkgFolder, constructor, includeKeys, askOverwrite);
-    }
-
-    /**
-     * 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_PKG))
-                javaTypeName = javaTypeName.substring(JAVA_LANG_PKG.length());
-            else if (javaTypeName.startsWith(JAVA_UTIL_PKG))
-                javaTypeName = javaTypeName.substring(JAVA_UTIL_PKG.length());
-
-            add2(src, owner + ".add(new JdbcTypeField(Types." + field.dbTypeName() + ", \"" + field.dbName() + "\", " +
-                javaTypeName + ".class, \"" + field.javaName() + "\"));");
-        }
-    }
-
-    /**
-     * Generate java snippet for cache configuration with JDBC store and types metadata.
-     *
-     * @param pojos POJO descriptors.
-     * @param pkg Types package.
-     * @param includeKeys {@code true} if key fields should be included into value class.
-     * @param generateAliases {@code true} if aliases should be generated for query fields.
-     * @param outFolder Output folder.
-     * @param askOverwrite Callback to ask user to confirm file overwrite.
-     * @throws IOException If generation failed.
-     */
-    public static void snippet(Collection<PojoDescriptor> pojos, String pkg, boolean includeKeys,
-        boolean generateAliases, String outFolder, ConfirmCallable askOverwrite) throws IOException {
-        File pkgFolder = new File(outFolder, pkg.replace('.', File.separatorChar));
-
-        ensurePackages(pkgFolder);
-
-        File cacheCfg = new File(pkgFolder, "CacheConfig.java");
-
-        if (cacheCfg.exists()) {
-            MessageBox.Result choice = askOverwrite.confirm(cacheCfg.getName());
-
-            if (CANCEL == choice)
-                throw new IllegalStateException("Java snippet generation was canceled!");
-
-            if (NO == choice || NO_TO_ALL == choice)
-                return;
-        }
-
-        Collection<String> src = new ArrayList<>(256);
-
-        header(src, pkg, "CacheConfig", "CacheConfig", "java.sql.*", "java.util.*", "", "org.apache.ignite.cache.*",
-            "org.apache.ignite.cache.store.jdbc.*", "org.apache.ignite.configuration.*");
-
-        // Generate methods for each type in order to avoid compiler error "java: code too large".
-        for (PojoDescriptor pojo : pojos) {
-            String tbl = pojo.table();
-            String valClsName = pojo.valueClassName();
-            Collection<PojoField> fields = pojo.valueFields(true);
-
-            add1(src, "/**");
-            add1(src, " * Create JDBC type for " + tbl + ".");
-            add1(src, " *");
-            add1(src, " * @param cacheName Cache name.");
-            add1(src, " * @return Configured JDBC type.");
-            add1(src, " */");
-            add1(src, "private static JdbcType jdbcType" + valClsName + "(String cacheName) {");
-
-            add2(src, "JdbcType jdbcType = new JdbcType();");
-            add0(src, "");
-
-            add2(src, "jdbcType.setCacheName(cacheName);");
-
-            // Database schema.
-            if (pojo.schema() != null)
-                add2(src, "jdbcType.setDatabaseSchema(\"" + pojo.schema() + "\");");
-
-            // Database table.
-            add2(src, "jdbcType.setDatabaseTable(\"" + tbl + "\");");
-
-            // Java info.
-            add2(src, "jdbcType.setKeyType(\"" + pkg + "." + pojo.keyClassName() + "\");");
-            add2(src, "jdbcType.setValueType(\"" + pkg + "." + valClsName + "\");");
-            add0(src, "");
-
-            // Key fields.
-            add2(src, "// Key fields for " + tbl + ".");
-            add2(src, "Collection<JdbcTypeField> keys = new ArrayList<>();");
-            addFields(src, "keys", pojo.keyFields());
-            add2(src, "jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));");
-            add0(src, "");
-
-            // Value fields.
-            add2(src, "// Value fields for " + tbl + ".");
-            add2(src, "Collection<JdbcTypeField> vals = new ArrayList<>();");
-            addFields(src, "vals", pojo.valueFields(includeKeys));
-            add2(src, "jdbcType.setValueFields(vals.toArray(new JdbcTypeField[vals.size()]));");
-            add0(src, "");
-            add2(src, "return jdbcType;");
-            add1(src, "}");
-            add0(src, "");
-
-            add1(src, "/**");
-            add1(src, " * Create SQL Query descriptor for " + tbl + ".");
-            add1(src, " *");
-            add1(src, " * @return Configured query entity.");
-            add1(src, " */");
-            add1(src, "private static QueryEntity queryEntity" + valClsName + "() {");
-
-            // Query entity.
-            add2(src, "QueryEntity qryEntity = new QueryEntity();");
-            add0(src, "");
-            add2(src, "qryEntity.setKeyType(\"" + pkg + "." + pojo.keyClassName() + "\");");
-            add2(src, "qryEntity.setValueType(\"" + pkg + "." + valClsName + "\");");
-
-            add0(src, "");
-
-            // Query fields.
-            add2(src, "// Query fields for " + tbl + ".");
-            add2(src, "LinkedHashMap<String, String> fields = new LinkedHashMap<>();");
-            add0(src, "");
-
-            for (PojoField field : fields)
-                add2(src, "fields.put(\"" + field.javaName() + "\", \"" +
-                    GeneratorUtils.boxPrimitiveType(field.javaTypeName()) + "\");");
-
-            add0(src, "");
-            add2(src, "qryEntity.setFields(fields);");
-            add0(src, "");
-
-            // Aliases.
-            if (generateAliases) {
-                Collection<PojoField> aliases = new ArrayList<>();
-
-                for (PojoField field : fields) {
-                    if (!field.javaName().equalsIgnoreCase(field.dbName()))
-                        aliases.add(field);
-                }
-
-                if (!aliases.isEmpty()) {
-                    add2(src, "// Aliases for fields.");
-                    add2(src, "Map<String, String> aliases = new HashMap<>();");
-                    add0(src, "");
-
-                    for (PojoField alias : aliases)
-                        add2(src, "aliases.put(\"" + alias.javaName() + "\", \"" + alias.dbName() + "\");");
-
-                    add0(src, "");
-                    add2(src, "qryEntity.setAliases(aliases);");
-                    add0(src, "");
-                }
-            }
-
-            // Indexes.
-            Collection<QueryIndex> idxs = pojo.indexes();
-
-            if (!idxs.isEmpty()) {
-                boolean first = true;
-                boolean firstIdx = true;
-
-                for (QueryIndex idx : idxs) {
-                    Set<Map.Entry<String, Boolean>> dbIdxFlds = idx.getFields().entrySet();
-
-                    int sz = dbIdxFlds.size();
-
-                    List<T2<String, Boolean>> idxFlds = new ArrayList<>(sz);
-
-                    for (Map.Entry<String, Boolean> idxFld : dbIdxFlds) {
-                        PojoField field = GeneratorUtils.findFieldByName(fields, idxFld.getKey());
-
-                        if (field != null)
-                            idxFlds.add(new T2<>(field.javaName(), idxFld.getValue()));
-                        else
-                            break;
-                    }
-
-                    // Only if all fields present, add index description.
-                    if (idxFlds.size() == sz) {
-                        if (first) {
-                            add2(src, "// Indexes for " + tbl + ".");
-                            add2(src, "Collection<QueryIndex> idxs = new ArrayList<>();");
-                            add0(src, "");
-                        }
-
-                        if (sz == 1) {
-                            T2<String, Boolean> idxFld = idxFlds.get(0);
-
-                            add2(src, "idxs.add(new QueryIndex(\"" + idxFld.getKey() + "\", " + idxFld.getValue() + ", \"" +
-                                idx.getName() + "\"));");
-                            add0(src, "");
-                        }
-                        else {
-                            add2(src, (firstIdx ? "QueryIndex " : "") + "idx = new QueryIndex();");
-                            add0(src, "");
-
-                            add2(src, "idx.setName(\"" + idx.getName() + "\");");
-                            add0(src, "");
-
-                            add2(src, "idx.setIndexType(QueryIndexType." + idx.getIndexType() + ");");
-                            add0(src, "");
-
-                            add2(src, (firstIdx ? "LinkedHashMap<String, Boolean> " : "") +
-                                "idxFlds = new LinkedHashMap<>();");
-                            add0(src, "");
-
-                            for (T2<String, Boolean> idxFld : idxFlds)
-                                add2(src, "idxFlds.put(\"" + idxFld.getKey() + "\", " + idxFld.getValue() + ");");
-
-                            add0(src, "");
-
-                            add2(src, "idx.setFields(idxFlds);");
-                            add0(src, "");
-
-                            add2(src, "idxs.add(idx);");
-                            add0(src, "");
-
-                            firstIdx = false;
-                        }
-
-                        first = false;
-                    }
-                }
-
-                if (!first) {
-                    add2(src, "qryEntity.setIndexes(idxs);");
-                    add0(src, "");
-                }
-            }
-
-            add2(src, "return qryEntity;");
-
-            add1(src, "}");
-            add0(src, "");
-        }
-
-        add1(src, "/**");
-        add1(src, " * Configure cache.");
-        add1(src, " *");
-        add1(src, " * @param cacheName Cache name.");
-        add1(src, " * @param storeFactory Cache store factory.");
-        add1(src, " * @return Cache configuration.");
-        add1(src, " */");
-        add1(src, "public static <K, V> CacheConfiguration<K, V> cache(String cacheName," +
-            " CacheJdbcPojoStoreFactory<K, V> storeFactory) {");
-        add2(src, "if (storeFactory == null)");
-        add3(src, " throw new IllegalArgumentException(\"Cache store factory cannot be null.\");");
-        add0(src, "");
-        add2(src, "CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(cacheName);");
-        add0(src, "");
-        add2(src, "ccfg.setCacheStoreFactory(storeFactory);");
-        add2(src, "ccfg.setReadThrough(true);");
-        add2(src, "ccfg.setWriteThrough(true);");
-        add0(src, "");
-
-        add2(src, "// Configure JDBC types.");
-        add2(src, "Collection<JdbcType> jdbcTypes = new ArrayList<>();");
-        add0(src, "");
-
-        for (PojoDescriptor pojo : pojos)
-            add2(src, "jdbcTypes.add(jdbcType" + pojo.valueClassName() + "(cacheName));");
-
-        add0(src, "");
-
-        add2(src, "storeFactory.setTypes(jdbcTypes.toArray(new JdbcType[jdbcTypes.size()]));");
-        add0(src, "");
-
-
-        add2(src, "// Configure query entities.");
-        add2(src, "Collection<QueryEntity> qryEntities = new ArrayList<>();");
-        add0(src, "");
-
-        for (PojoDescriptor pojo : pojos)
-            add2(src, "qryEntities.add(queryEntity" + pojo.valueClassName() + "());");
-
-        add0(src, "");
-
-        add2(src, "ccfg.setQueryEntities(qryEntities);");
-        add0(src, "");
-
-        add2(src, "return ccfg;");
-        add1(src, "}");
-
-        add0(src, "}");
-
-        write(src, cacheCfg);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java
deleted file mode 100644
index ac710db..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java
+++ /dev/null
@@ -1,70 +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.generator;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.ignite.schema.model.PojoField;
-
-/**
- * Schema import generator utils.
- */
-public class GeneratorUtils {
-    /** Map of conformity between primitive type and Java class. */
-    private static final Map<String, String> primitiveToObject = new HashMap<>();
-
-    static {
-        primitiveToObject.put("boolean", "java.lang.Boolean");
-        primitiveToObject.put("byte", "java.lang.Byte");
-        primitiveToObject.put("short", "java.lang.Short");
-        primitiveToObject.put("int", "java.lang.Integer");
-        primitiveToObject.put("long", "java.lang.Long");
-        primitiveToObject.put("float", "java.lang.Float");
-        primitiveToObject.put("double", "java.lang.Double");
-    }
-
-    /**
-     * Convert primitive type to conformity Java class.
-     *
-     * @param type Primitive type.
-     * @return Conformity Java class
-     */
-    public static String boxPrimitiveType(String type) {
-        if (primitiveToObject.containsKey(type))
-            return primitiveToObject.get(type);
-
-        return type;
-    }
-
-    /**
-     * Find field by name.
-     *
-     * @param fields Field descriptors.
-     * @param name Field name to find.
-     * @return Field descriptor or {@code null} if not found.
-     */
-    public static PojoField findFieldByName(Collection<PojoField> fields, String name) {
-        for (PojoField field: fields)
-            if (field.dbName().equals(name))
-                return field;
-
-        return null;
-    }
-}