You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2017/04/08 11:20:09 UTC
[2/7] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml
deleted file mode 100644
index fc481f0..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml
+++ /dev/null
@@ -1,666 +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.
--->
-
-<!--
- XML generated by Apache Ignite Schema Import utility: 08/18/2016
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- 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">
- <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
- <property name="types">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
- <property name="databaseSchema" value="PUBLIC"/>
- <property name="databaseTable" value="OBJECTS"/>
- <property name="keyType" value="org.apache.ignite.schema.test.model.ObjectsKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Objects"/>
- <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="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- </list>
- </property>
- <property name="valueFields">
- <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="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BOOLEAN"/>
- </property>
- <property name="databaseFieldName" value="BOOLCOL"/>
- <property name="javaFieldType" value="java.lang.Boolean"/>
- <property name="javaFieldName" value="boolcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TINYINT"/>
- </property>
- <property name="databaseFieldName" value="BYTECOL"/>
- <property name="javaFieldType" value="java.lang.Byte"/>
- <property name="javaFieldName" value="bytecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.SMALLINT"/>
- </property>
- <property name="databaseFieldName" value="SHORTCOL"/>
- <property name="javaFieldType" value="java.lang.Short"/>
- <property name="javaFieldName" value="shortcol"/>
- </bean>
- <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="INTCOL"/>
- <property name="javaFieldType" value="java.lang.Integer"/>
- <property name="javaFieldName" value="intcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BIGINT"/>
- </property>
- <property name="databaseFieldName" value="LONGCOL"/>
- <property name="javaFieldType" value="java.lang.Long"/>
- <property name="javaFieldName" value="longcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.REAL"/>
- </property>
- <property name="databaseFieldName" value="FLOATCOL"/>
- <property name="javaFieldType" value="java.lang.Float"/>
- <property name="javaFieldName" value="floatcol"/>
- </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="DOUBLECOL"/>
- <property name="javaFieldType" value="java.lang.Double"/>
- <property name="javaFieldName" value="doublecol"/>
- </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="DOUBLECOL2"/>
- <property name="javaFieldType" value="java.lang.Double"/>
- <property name="javaFieldName" value="doublecol2"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DECIMAL"/>
- </property>
- <property name="databaseFieldName" value="BIGDECIMALCOL"/>
- <property name="javaFieldType" value="java.math.BigDecimal"/>
- <property name="javaFieldName" value="bigdecimalcol"/>
- </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="STRCOL"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="strcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DATE"/>
- </property>
- <property name="databaseFieldName" value="DATECOL"/>
- <property name="javaFieldType" value="java.sql.Date"/>
- <property name="javaFieldName" value="datecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIME"/>
- </property>
- <property name="databaseFieldName" value="TIMECOL"/>
- <property name="javaFieldType" value="java.sql.Time"/>
- <property name="javaFieldName" value="timecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIMESTAMP"/>
- </property>
- <property name="databaseFieldName" value="TSCOL"/>
- <property name="javaFieldType" value="java.sql.Timestamp"/>
- <property name="javaFieldName" value="tscol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARBINARY"/>
- </property>
- <property name="databaseFieldName" value="ARRCOL"/>
- <property name="javaFieldType" value="java.lang.Object"/>
- <property name="javaFieldName" value="arrcol"/>
- </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="FIELD_WITH_ALIAS"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="fieldWithAlias"/>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
- <property name="databaseSchema" value="PUBLIC"/>
- <property name="databaseTable" value="PRIMITIVES"/>
- <property name="keyType" value="org.apache.ignite.schema.test.model.PrimitivesKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Primitives"/>
- <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="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- </list>
- </property>
- <property name="valueFields">
- <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="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BOOLEAN"/>
- </property>
- <property name="databaseFieldName" value="BOOLCOL"/>
- <property name="javaFieldType" value="boolean"/>
- <property name="javaFieldName" value="boolcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TINYINT"/>
- </property>
- <property name="databaseFieldName" value="BYTECOL"/>
- <property name="javaFieldType" value="byte"/>
- <property name="javaFieldName" value="bytecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.SMALLINT"/>
- </property>
- <property name="databaseFieldName" value="SHORTCOL"/>
- <property name="javaFieldType" value="short"/>
- <property name="javaFieldName" value="shortcol"/>
- </bean>
- <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="INTCOL"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="intcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BIGINT"/>
- </property>
- <property name="databaseFieldName" value="LONGCOL"/>
- <property name="javaFieldType" value="long"/>
- <property name="javaFieldName" value="longcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.REAL"/>
- </property>
- <property name="databaseFieldName" value="FLOATCOL"/>
- <property name="javaFieldType" value="float"/>
- <property name="javaFieldName" value="floatcol"/>
- </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="DOUBLECOL"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol"/>
- </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="DOUBLECOL2"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol2"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DECIMAL"/>
- </property>
- <property name="databaseFieldName" value="BIGDECIMALCOL"/>
- <property name="javaFieldType" value="java.math.BigDecimal"/>
- <property name="javaFieldName" value="bigdecimalcol"/>
- </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="STRCOL"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="strcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DATE"/>
- </property>
- <property name="databaseFieldName" value="DATECOL"/>
- <property name="javaFieldType" value="java.sql.Date"/>
- <property name="javaFieldName" value="datecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIME"/>
- </property>
- <property name="databaseFieldName" value="TIMECOL"/>
- <property name="javaFieldType" value="java.sql.Time"/>
- <property name="javaFieldName" value="timecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIMESTAMP"/>
- </property>
- <property name="databaseFieldName" value="TSCOL"/>
- <property name="javaFieldType" value="java.sql.Timestamp"/>
- <property name="javaFieldName" value="tscol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARBINARY"/>
- </property>
- <property name="databaseFieldName" value="ARRCOL"/>
- <property name="javaFieldType" value="java.lang.Object"/>
- <property name="javaFieldName" value="arrcol"/>
- </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="FIELD_WITH_ALIAS"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="fieldWithAlias"/>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
- <property name="databaseSchema" value="TESTSCHEMA"/>
- <property name="databaseTable" value="TST"/>
- <property name="keyType" value="org.apache.ignite.schema.test.model.TstKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Tst"/>
- <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="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- </list>
- </property>
- <property name="valueFields">
- <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="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BOOLEAN"/>
- </property>
- <property name="databaseFieldName" value="BOOLCOL"/>
- <property name="javaFieldType" value="boolean"/>
- <property name="javaFieldName" value="boolcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TINYINT"/>
- </property>
- <property name="databaseFieldName" value="BYTECOL"/>
- <property name="javaFieldType" value="byte"/>
- <property name="javaFieldName" value="bytecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.SMALLINT"/>
- </property>
- <property name="databaseFieldName" value="SHORTCOL"/>
- <property name="javaFieldType" value="short"/>
- <property name="javaFieldName" value="shortcol"/>
- </bean>
- <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="INTCOL"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="intcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BIGINT"/>
- </property>
- <property name="databaseFieldName" value="LONGCOL"/>
- <property name="javaFieldType" value="long"/>
- <property name="javaFieldName" value="longcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.REAL"/>
- </property>
- <property name="databaseFieldName" value="FLOATCOL"/>
- <property name="javaFieldType" value="float"/>
- <property name="javaFieldName" value="floatcol"/>
- </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="DOUBLECOL"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol"/>
- </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="DOUBLECOL2"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol2"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DECIMAL"/>
- </property>
- <property name="databaseFieldName" value="BIGDECIMALCOL"/>
- <property name="javaFieldType" value="java.math.BigDecimal"/>
- <property name="javaFieldName" value="bigdecimalcol"/>
- </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="STRCOL"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="strcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DATE"/>
- </property>
- <property name="databaseFieldName" value="DATECOL"/>
- <property name="javaFieldType" value="java.sql.Date"/>
- <property name="javaFieldName" value="datecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIME"/>
- </property>
- <property name="databaseFieldName" value="TIMECOL"/>
- <property name="javaFieldType" value="java.sql.Time"/>
- <property name="javaFieldName" value="timecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIMESTAMP"/>
- </property>
- <property name="databaseFieldName" value="TSCOL"/>
- <property name="javaFieldType" value="java.sql.Timestamp"/>
- <property name="javaFieldName" value="tscol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARBINARY"/>
- </property>
- <property name="databaseFieldName" value="ARRCOL"/>
- <property name="javaFieldType" value="java.lang.Object"/>
- <property name="javaFieldName" value="arrcol"/>
- </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="FIELD_WITH_ALIAS"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="fieldWithAlias"/>
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="org.apache.ignite.schema.test.model.ObjectsKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Objects"/>
- <property name="fields">
- <util:map map-class="java.util.LinkedHashMap">
- <entry key="pk" value="java.lang.Integer"/>
- <entry key="boolcol" value="java.lang.Boolean"/>
- <entry key="bytecol" value="java.lang.Byte"/>
- <entry key="shortcol" value="java.lang.Short"/>
- <entry key="intcol" value="java.lang.Integer"/>
- <entry key="longcol" value="java.lang.Long"/>
- <entry key="floatcol" value="java.lang.Float"/>
- <entry key="doublecol" value="java.lang.Double"/>
- <entry key="doublecol2" value="java.lang.Double"/>
- <entry key="bigdecimalcol" value="java.math.BigDecimal"/>
- <entry key="strcol" value="java.lang.String"/>
- <entry key="datecol" value="java.sql.Date"/>
- <entry key="timecol" value="java.sql.Time"/>
- <entry key="tscol" value="java.sql.Timestamp"/>
- <entry key="arrcol" value="java.lang.Object"/>
- <entry key="fieldWithAlias" value="java.lang.String"/>
- </util:map>
- </property>
- <property name="aliases">
- <map>
- <entry key="fieldWithAlias" value="FIELD_WITH_ALIAS"/>
- </map>
- </property>
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="PRIMARY_KEY_C"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="pk" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_1"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_2"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="false"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="org.apache.ignite.schema.test.model.PrimitivesKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Primitives"/>
- <property name="fields">
- <util:map map-class="java.util.LinkedHashMap">
- <entry key="pk" value="java.lang.Integer"/>
- <entry key="boolcol" value="java.lang.Boolean"/>
- <entry key="bytecol" value="java.lang.Byte"/>
- <entry key="shortcol" value="java.lang.Short"/>
- <entry key="intcol" value="java.lang.Integer"/>
- <entry key="longcol" value="java.lang.Long"/>
- <entry key="floatcol" value="java.lang.Float"/>
- <entry key="doublecol" value="java.lang.Double"/>
- <entry key="doublecol2" value="java.lang.Double"/>
- <entry key="bigdecimalcol" value="java.math.BigDecimal"/>
- <entry key="strcol" value="java.lang.String"/>
- <entry key="datecol" value="java.sql.Date"/>
- <entry key="timecol" value="java.sql.Time"/>
- <entry key="tscol" value="java.sql.Timestamp"/>
- <entry key="arrcol" value="java.lang.Object"/>
- <entry key="fieldWithAlias" value="java.lang.String"/>
- </util:map>
- </property>
- <property name="aliases">
- <map>
- <entry key="fieldWithAlias" value="FIELD_WITH_ALIAS"/>
- </map>
- </property>
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="PRIMARY_KEY_D"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="pk" value="true"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="org.apache.ignite.schema.test.model.TstKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Tst"/>
- <property name="fields">
- <util:map map-class="java.util.LinkedHashMap">
- <entry key="pk" value="java.lang.Integer"/>
- <entry key="boolcol" value="java.lang.Boolean"/>
- <entry key="bytecol" value="java.lang.Byte"/>
- <entry key="shortcol" value="java.lang.Short"/>
- <entry key="intcol" value="java.lang.Integer"/>
- <entry key="longcol" value="java.lang.Long"/>
- <entry key="floatcol" value="java.lang.Float"/>
- <entry key="doublecol" value="java.lang.Double"/>
- <entry key="doublecol2" value="java.lang.Double"/>
- <entry key="bigdecimalcol" value="java.math.BigDecimal"/>
- <entry key="strcol" value="java.lang.String"/>
- <entry key="datecol" value="java.sql.Date"/>
- <entry key="timecol" value="java.sql.Time"/>
- <entry key="tscol" value="java.sql.Timestamp"/>
- <entry key="arrcol" value="java.lang.Object"/>
- <entry key="fieldWithAlias" value="java.lang.String"/>
- </util:map>
- </property>
- <property name="aliases">
- <map>
- <entry key="fieldWithAlias" value="FIELD_WITH_ALIAS"/>
- </map>
- </property>
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="PRIMARY_KEY_1"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="pk" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_3"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_4"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="false"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java
deleted file mode 100644
index a550bfc..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.schema.test.parser;
-
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.model.PojoField;
-import org.apache.ignite.schema.test.AbstractSchemaImportTest;
-
-/**
- * Tests for metadata parsing.
- */
-public class DbMetadataParserTest extends AbstractSchemaImportTest {
- /**
- * Check that field is correspond to expected.
- *
- * @param field Field descriptor.
- * @param name Expected field name.
- * @param primitive Expected field primitive type.
- * @param cls Expected field type.
- */
- private void checkField(PojoField field, String name, boolean primitive, Class<?> cls) {
- assertEquals("Name of field should be " + name, name, field.javaName());
-
- assertEquals("Type of field should be " + cls.getName(), cls.getName(), field.javaTypeName());
-
- assertEquals("Field primitive should be " + primitive, primitive, field.primitive());
- }
-
- /**
- * Check that type is correspond to expected.
- *
- * @param type Type descriptor.
- */
- private void checkType(PojoDescriptor type) {
- assertFalse("Type key class name should be defined", type.keyClassName().isEmpty());
-
- assertFalse("Type value class name should be defined", type.valueClassName().isEmpty());
-
- Collection<PojoField> keyFields = type.keyFields();
-
- assertEquals("Key type should have 1 field", 1, keyFields.size());
-
- checkField(keyFields.iterator().next(), "pk", true, int.class);
-
- List<PojoField> fields = type.fields();
-
- assertEquals("Value type should have 15 fields", 16, fields.size());
-
- Iterator<PojoField> fieldsIt = fields.iterator();
-
- checkField(fieldsIt.next(), "pk", true, int.class);
-
- if ("Objects".equals(type.valueClassName())) {
- checkField(fieldsIt.next(), "boolcol", false, Boolean.class);
- checkField(fieldsIt.next(), "bytecol", false, Byte.class);
- checkField(fieldsIt.next(), "shortcol", false, Short.class);
- checkField(fieldsIt.next(), "intcol", false, Integer.class);
- checkField(fieldsIt.next(), "longcol", false, Long.class);
- checkField(fieldsIt.next(), "floatcol", false, Float.class);
- checkField(fieldsIt.next(), "doublecol", false, Double.class);
- checkField(fieldsIt.next(), "doublecol2", false, Double.class);
- }
- else {
- checkField(fieldsIt.next(), "boolcol", true, boolean.class);
- checkField(fieldsIt.next(), "bytecol", true, byte.class);
- checkField(fieldsIt.next(), "shortcol", true, short.class);
- checkField(fieldsIt.next(), "intcol", true, int.class);
- checkField(fieldsIt.next(), "longcol", true, long.class);
- checkField(fieldsIt.next(), "floatcol", true, float.class);
- checkField(fieldsIt.next(), "doublecol", true, double.class);
- checkField(fieldsIt.next(), "doublecol2", true, double.class);
- }
-
- checkField(fieldsIt.next(), "bigdecimalcol", false, BigDecimal.class);
- checkField(fieldsIt.next(), "strcol", false, String.class);
- checkField(fieldsIt.next(), "datecol", false, Date.class);
- checkField(fieldsIt.next(), "timecol", false, Time.class);
- checkField(fieldsIt.next(), "tscol", false, Timestamp.class);
- checkField(fieldsIt.next(), "arrcol", false, Object.class);
- }
-
- /**
- * Check that type has not null full db name.
- *
- * @param type Type to check.
- */
- private void checkSchemaHasFullDbName(PojoDescriptor type) {
- assertNotNull("The DB schema should have a non-null fullDbName", type.fullDbName());
- }
-
- /**
- * Test that metadata generated correctly.
- */
- public void testCheckMetadata() {
- assertEquals("Metadata should contain 5 elements", 5, all.size());
-
- Iterator<PojoDescriptor> it = all.iterator();
-
- PojoDescriptor schema = it.next();
-
- assertTrue("First element is schema description. Its class name should be empty",
- schema.valueClassName().isEmpty());
-
- checkType(it.next());
-
- checkType(it.next());
-
- checkSchemaHasFullDbName(it.next());
-
- checkType(it.next());
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java
deleted file mode 100644
index ca769c8..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java
+++ /dev/null
@@ -1,42 +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.test.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.schema.test.generator.CodeGeneratorTest;
-import org.apache.ignite.schema.test.generator.XmlGeneratorTest;
-import org.apache.ignite.schema.test.parser.DbMetadataParserTest;
-
-/**
- * Ignite Schema Import Utility Tests.
- */
-public class IgniteSchemaImportTestSuite {
- /**
- * @return Test suite.
- * @throws Exception Thrown in case of the failure.
- */
- public static TestSuite suite() throws Exception {
- TestSuite suite = new TestSuite("Ignite Apache Schema Import Utility Test Suite");
-
- suite.addTestSuite(CodeGeneratorTest.class);
- suite.addTestSuite(XmlGeneratorTest.class);
- suite.addTestSuite(DbMetadataParserTest.class);
-
- return suite;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/pom.xml b/modules/web-console/web-agent/pom.xml
index a2ead7d..530aef6 100644
--- a/modules/web-console/web-agent/pom.xml
+++ b/modules/web-console/web-agent/pom.xml
@@ -66,18 +66,6 @@
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-schema-import-db</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.gridgain</groupId>
- <artifactId>ignite-shmem</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
new file mode 100644
index 0000000..723ee25
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
@@ -0,0 +1,88 @@
+/*
+ * 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.console.agent.db;
+
+/**
+ * Database table column.
+ */
+public class DbColumn {
+ /** Column name. */
+ private final String name;
+
+ /** Column JDBC type. */
+ private final int type;
+
+ /** Is this column belongs to primary key. */
+ private final boolean key;
+
+ /** Is {@code NULL} allowed for column in database. */
+ private final boolean nullable;
+
+ /** Whether column unsigned. */
+ private final boolean unsigned;
+
+ /**
+ * @param name Column name.
+ * @param type Column JDBC type.
+ * @param key {@code true} if this column belongs to primary key.
+ * @param nullable {@code true} if {@code NULL } allowed for column in database.
+ * @param unsigned {@code true} if column is unsigned.
+ */
+ public DbColumn(String name, int type, boolean key, boolean nullable, boolean unsigned) {
+ this.name = name;
+ this.type = type;
+ this.key = key;
+ this.nullable = nullable;
+ this.unsigned = unsigned;
+ }
+
+ /**
+ * @return Column name.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * @return Column JDBC type.
+ */
+ public int type() {
+ return type;
+ }
+
+ /**
+ * @return {@code true} if this column belongs to primary key.
+ */
+ public boolean key() {
+ return key;
+ }
+
+ /**
+ * @return {@code true} if {@code NULL } allowed for column in database.
+ */
+ public boolean nullable() {
+ return nullable;
+ }
+
+ /**
+ * @return {@code true} if column is unsigned.
+ */
+ public boolean unsigned() {
+ return unsigned;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java
new file mode 100644
index 0000000..9aa0321
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java
@@ -0,0 +1,142 @@
+/*
+ * 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.console.agent.db;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.ignite.console.agent.db.dialect.DB2MetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.DatabaseMetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.JdbcMetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.MySQLMetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.OracleMetadataDialect;
+import org.apache.log4j.Logger;
+
+/**
+ * Singleton to extract database metadata.
+ */
+public class DbMetadataReader {
+ /** Logger. */
+ private static final Logger log = Logger.getLogger(DbMetadataReader.class.getName());
+
+ /** */
+ private final Map<String, Driver> drivers = new HashMap<>();
+
+ /**
+ * Get specified dialect object for selected database.
+ *
+ * @param conn Connection to database.
+ * @return Specific dialect object.
+ */
+ private DatabaseMetadataDialect dialect(Connection conn) {
+ try {
+ String dbProductName = conn.getMetaData().getDatabaseProductName();
+
+ if ("Oracle".equals(dbProductName))
+ return new OracleMetadataDialect();
+
+ if (dbProductName.startsWith("DB2/"))
+ return new DB2MetadataDialect();
+
+ if ("MySQL".equals(dbProductName))
+ return new MySQLMetadataDialect();
+
+ return new JdbcMetadataDialect();
+ }
+ catch (SQLException e) {
+ log.error("Failed to resolve dialect (JdbcMetaDataDialect will be used.", e);
+
+ return new JdbcMetadataDialect();
+ }
+ }
+
+ /**
+ * Get list of schemas from database.
+ *
+ * @param conn Connection to database.
+ * @return List of schema names.
+ * @throws SQLException If schemas loading failed.
+ */
+ public Collection<String> schemas(Connection conn) throws SQLException {
+ return dialect(conn).schemas(conn);
+ }
+
+ /**
+ * Extract DB metadata.
+ *
+ * @param conn Connection.
+ * @param schemas List of database schemas to process. In case of empty list all schemas will be processed.
+ * @param tblsOnly Tables only flag.
+ */
+ public Collection<DbTable> metadata(Connection conn, List<String> schemas, boolean tblsOnly) throws SQLException {
+ return dialect(conn).tables(conn, schemas, tblsOnly);
+ }
+
+ /**
+ * Connect to database.
+ *
+ * @param jdbcDrvJarPath Path to JDBC driver.
+ * @param jdbcDrvCls JDBC class name.
+ * @param jdbcUrl JDBC connection URL.
+ * @param jdbcInfo Connection properties.
+ * @return Connection to database.
+ * @throws SQLException if connection failed.
+ */
+ public Connection connect(String jdbcDrvJarPath, String jdbcDrvCls, String jdbcUrl, Properties jdbcInfo)
+ throws SQLException {
+ Driver drv = drivers.get(jdbcDrvCls);
+
+ if (drv == null) {
+ if (jdbcDrvJarPath.isEmpty())
+ throw new IllegalStateException("Driver jar file name is not specified.");
+
+ File drvJar = new File(jdbcDrvJarPath);
+
+ if (!drvJar.exists())
+ throw new IllegalStateException("Driver jar file is not found.");
+
+ try {
+ URL u = new URL("jar:" + drvJar.toURI() + "!/");
+
+ URLClassLoader ucl = URLClassLoader.newInstance(new URL[] {u});
+
+ drv = (Driver)Class.forName(jdbcDrvCls, true, ucl).newInstance();
+
+ drivers.put(jdbcDrvCls, drv);
+ }
+ catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ Connection conn = drv.connect(jdbcUrl, jdbcInfo);
+
+ if (conn == null)
+ throw new IllegalStateException("Connection was not established (JDBC driver returned null value).");
+
+ return conn;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
new file mode 100644
index 0000000..b74cfe5
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
@@ -0,0 +1,82 @@
+/*
+ * 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.console.agent.db;
+
+import org.apache.ignite.cache.QueryIndex;
+
+import java.util.Collection;
+
+/**
+ * Database table.
+ */
+public class DbTable {
+ /** Schema name. */
+ private final String schema;
+
+ /** Table name. */
+ private final String tbl;
+
+ /** Columns. */
+ private final Collection<DbColumn> cols;
+
+ /** Indexes. */
+ private final Collection<QueryIndex> idxs;
+
+ /**
+ * Default columns.
+ *
+ * @param schema Schema name.
+ * @param tbl Table name.
+ * @param cols Columns.
+ * @param idxs Indexes;
+ */
+ public DbTable(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex> idxs) {
+ this.schema = schema;
+ this.tbl = tbl;
+ this.cols = cols;
+ this.idxs = idxs;
+ }
+
+ /**
+ * @return Schema name.
+ */
+ public String schema() {
+ return schema;
+ }
+
+ /**
+ * @return Table name.
+ */
+ public String table() {
+ return tbl;
+ }
+
+ /**
+ * @return Columns.
+ */
+ public Collection<DbColumn> columns() {
+ return cols;
+ }
+
+ /**
+ * @return Indexes.
+ */
+ public Collection<QueryIndex> indexes() {
+ return idxs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java
new file mode 100644
index 0000000..2f41a8c
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java
@@ -0,0 +1,33 @@
+/*
+ * 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.console.agent.db.dialect;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * DB2 specific metadata dialect.
+ */
+public class DB2MetadataDialect extends JdbcMetadataDialect {
+ /** {@inheritDoc} */
+ @Override public Set<String> systemSchemas() {
+ return new HashSet<>(Arrays.asList("SYSIBM", "SYSCAT", "SYSSTAT", "SYSTOOLS", "SYSFUN", "SYSIBMADM",
+ "SYSIBMINTERNAL", "SYSIBMTS", "SYSPROC", "SYSPUBLIC"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
new file mode 100644
index 0000000..674bda5
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
@@ -0,0 +1,102 @@
+/*
+ * 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.console.agent.db.dialect;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.console.agent.db.DbColumn;
+import org.apache.ignite.console.agent.db.DbTable;
+
+/**
+ * Base class for database metadata dialect.
+ */
+public abstract class DatabaseMetadataDialect {
+ /**
+ * Gets schemas from database.
+ *
+ * @param conn Database connection.
+ * @return Collection of schema descriptors.
+ * @throws SQLException If failed to get schemas.
+ */
+ public abstract Collection<String> schemas(Connection conn) throws SQLException;
+
+ /**
+ * Gets tables from database.
+ *
+ * @param conn Database connection.
+ * @param schemas Collection of schema names to load.
+ * @param tblsOnly If {@code true} then gets only tables otherwise gets tables and views.
+ * @return Collection of table descriptors.
+ * @throws SQLException If failed to get tables.
+ */
+ public abstract Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
+ throws SQLException;
+
+ /**
+ * @return Collection of database system schemas.
+ */
+ public Set<String> systemSchemas() {
+ return Collections.singleton("INFORMATION_SCHEMA");
+ }
+
+ /**
+ * @return Collection of unsigned type names.
+ * @throws SQLException If failed to get unsigned type names.
+ */
+ public Set<String> unsignedTypes(DatabaseMetaData dbMeta) throws SQLException {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Create table descriptor.
+ *
+ * @param schema Schema name.
+ * @param tbl Table name.
+ * @param cols Table columns.
+ * @param idxs Table indexes.
+ * @return New {@code DbTable} instance.
+ */
+ protected DbTable table(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex>idxs) {
+ return new DbTable(schema, tbl, cols, idxs);
+ }
+
+ /**
+ * Create index descriptor.
+ *
+ * @param idxName Index name.
+ * @return New initialized {@code QueryIndex} instance.
+ */
+ protected QueryIndex index(String idxName) {
+ QueryIndex idx = new QueryIndex();
+
+ idx.setName(idxName);
+ idx.setIndexType(QueryIndexType.SORTED);
+ idx.setFields(new LinkedHashMap<String, Boolean>());
+
+ return idx;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
new file mode 100644
index 0000000..dcfd9c0
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
@@ -0,0 +1,199 @@
+/*
+ * 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.console.agent.db.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.console.agent.db.DbColumn;
+import org.apache.ignite.console.agent.db.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/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
new file mode 100644
index 0000000..4adeeb3
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
@@ -0,0 +1,82 @@
+/*
+ * 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.console.agent.db.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;
+ }
+}