# ignite-140 : fix review comments
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3c7d787e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3c7d787e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3c7d787e Branch: refs/heads/ignite-6 Commit: 3c7d787ed1858826852ab09c14cd7dd628fe65df Parents: 75ecf4a Author: Artem SHutak <ashu...@gridgain.com> Authored: Mon Feb 2 18:40:22 2015 +0300 Committer: Artem SHutak <ashu...@gridgain.com> Committed: Mon Feb 2 18:40:22 2015 +0300 ---------------------------------------------------------------------- modules/geospatial/pom.xml | 2 +- modules/geospatial/readme.txt | 1 + .../testsuites/GeoSpatialIndexingTestSuite.java | 4 +- .../processors/query/h2/IgniteH2Indexing.java | 40 +++++++++++---- .../query/h2/opt/SpatialIndexInitiator.java | 52 -------------------- 5 files changed, 35 insertions(+), 64 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c7d787e/modules/geospatial/pom.xml ---------------------------------------------------------------------- diff --git a/modules/geospatial/pom.xml b/modules/geospatial/pom.xml index d0f2bb9..32494c8 100644 --- a/modules/geospatial/pom.xml +++ b/modules/geospatial/pom.xml @@ -15,7 +15,7 @@ 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. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c7d787e/modules/geospatial/readme.txt ---------------------------------------------------------------------- diff --git a/modules/geospatial/readme.txt b/modules/geospatial/readme.txt index 4403156..4688c26 100644 --- a/modules/geospatial/readme.txt +++ b/modules/geospatial/readme.txt @@ -6,6 +6,7 @@ Apache Ignite geospatial module provides capabilities to geospatial index cache To enable geospatial module when starting a standalone node, move 'optional/ignite-geospatial' folder to 'libs' folder before running 'ggstart.{sh|bat}' script. The content of the module folder will be added to classpath in this case. +Note! This module can be used only when Ignite indexing module is enabled. Importing geospatial Module In Maven Project ------------------------------------------ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c7d787e/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java b/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java index 683215d..88ca5a0 100644 --- a/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java +++ b/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java @@ -21,7 +21,7 @@ import junit.framework.*; import org.apache.ignite.internal.processors.query.h2.*; /** - * Geo spatial indexing tests. + * Geospatial indexing tests. */ public class GeoSpatialIndexingTestSuite extends TestSuite { /** @@ -29,7 +29,7 @@ public class GeoSpatialIndexingTestSuite extends TestSuite { * @throws Exception Thrown in case of the failure. */ public static TestSuite suite() throws Exception { - TestSuite suite = new TestSuite("H2 Indexing SPI Test Suite"); + TestSuite suite = new TestSuite("H2 Geospatial Indexing Test Suite"); // Geo. suite.addTestSuite(GridH2IndexingGeoSelfTest.class); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c7d787e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index 89ad194..718d271 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@ -19,28 +19,27 @@ package org.apache.ignite.internal.processors.query.h2; import org.apache.ignite.*; import org.apache.ignite.cache.*; -import org.apache.ignite.cache.GridCache; import org.apache.ignite.cache.query.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.query.*; +import org.apache.ignite.internal.processors.query.*; +import org.apache.ignite.internal.processors.query.h2.opt.*; import org.apache.ignite.internal.processors.query.h2.sql.*; import org.apache.ignite.internal.processors.query.h2.twostep.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.future.GridFinishedFutureEx; +import org.apache.ignite.internal.util.future.*; +import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.internal.util.offheap.unsafe.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.indexing.*; -import org.apache.ignite.internal.processors.query.*; -import org.apache.ignite.internal.processors.query.h2.opt.*; -import org.apache.ignite.internal.util.lang.*; -import org.apache.ignite.internal.util.offheap.unsafe.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; import org.h2.api.*; import org.h2.command.*; import org.h2.constant.*; @@ -1684,7 +1683,7 @@ public class IgniteH2Indexing implements GridQueryIndexing { if (idx.type() == SORTED) idxs.add(new GridH2TreeIndex(name, tbl, false, KEY_COL, VAL_COL, cols)); else if (idx.type() == GEO_SPATIAL) - idxs.add(SpatialIndexInitiator.createH2SpatialIndex(tbl, name, cols, KEY_COL, VAL_COL)); + idxs.add(createH2SpatialIndex(tbl, name, cols, KEY_COL, VAL_COL)); else throw new IllegalStateException(); } @@ -1692,6 +1691,29 @@ public class IgniteH2Indexing implements GridQueryIndexing { return idxs; } + + /** + * @param tbl Table. + * @param idxName Index name. + * @param cols Columns. + * @param keyCol Key column. + * @param valCol Value column. + */ + public SpatialIndex createH2SpatialIndex(Table tbl, String idxName, + IndexColumn[] cols, int keyCol, int valCol) { + String className = "org.apache.ignite.internal.processors.query.h2.opt.GridH2SpatialIndex"; + try { + Class<?> cls = Class.forName(className); + + Constructor<?> ctor = cls.getConstructor(Table.class, String.class, + IndexColumn[].class, int.class, int.class); + + return (SpatialIndex)ctor.newInstance(tbl, idxName, cols, keyCol, valCol); + } + catch (Exception e) { + throw new IgniteException("Failed to instantiate: " + className, e); + } + } } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c7d787e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/SpatialIndexInitiator.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/SpatialIndexInitiator.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/SpatialIndexInitiator.java deleted file mode 100644 index 3d7bc18..0000000 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/SpatialIndexInitiator.java +++ /dev/null @@ -1,52 +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.internal.processors.query.h2.opt; - -import org.apache.ignite.*; -import org.h2.index.*; -import org.h2.table.*; - -import java.lang.reflect.*; - -/** - * Util class for SpatialIndex instantiation. Do instantiation via reflection mechanism. - */ -public class SpatialIndexInitiator { - /** Class for instantiation. */ - private static final String CLASS_NAME = "org.apache.ignite.internal.processors.query.h2.opt.GridH2SpatialIndex"; - - /** - * @param tbl Table. - * @param idxName Index name. - * @param cols Columns. - * @param keyCol Key column. - * @param valCol Value column. - */ - public static SpatialIndex createH2SpatialIndex(Table tbl, String idxName, IndexColumn[] cols, int keyCol, int valCol) { - try { - Class<?> cls = Class.forName(CLASS_NAME); - - Constructor<?> ctor = cls.getConstructor(Table.class, String.class, IndexColumn[].class, int.class, int.class); - - return (SpatialIndex)ctor.newInstance(tbl, idxName, cols, keyCol, valCol); - } - catch (Exception e) { - throw new IgniteException("Failed to instantiate: " + CLASS_NAME, e); - } - } -}