Repository: incubator-ignite
Updated Branches:
  refs/heads/sprint-2 42e467c36 -> b7fa7a62f


# Throw correct exception when indexing is not in classpath.


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

Branch: refs/heads/sprint-2
Commit: b7fa7a62f1515c595351490379bcf7a980937141
Parents: 42e467c
Author: Alexey Goncharuk <agoncha...@gridgain.com>
Authored: Wed Mar 25 15:12:42 2015 -0700
Committer: Alexey Goncharuk <agoncha...@gridgain.com>
Committed: Wed Mar 25 15:12:42 2015 -0700

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteComponentType.java  |  7 +++++++
 .../processors/query/GridQueryProcessor.java         | 15 +++++++++++++++
 2 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7fa7a62/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
index 42cc507..6ed8a63 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
@@ -112,6 +112,13 @@ public enum IgniteComponentType {
     }
 
     /**
+     * @return Component module name.
+     */
+    public String module() {
+        return module;
+    }
+
+    /**
      * Check whether real component class is in classpath.
      *
      * @return {@code True} if in classpath.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7fa7a62/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index e83309a..235f434 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -442,6 +442,15 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
     }
 
     /**
+     * @throws IgniteException If indexing is disabled.
+     */
+    private void checkxEnabled() throws IgniteException {
+        if (idx == null)
+            throw new IgniteException("Failed to execute query because 
indexing is disabled (consider adding " +
+                INDEXING.module() + "to classpath).");
+    }
+
+    /**
      * @param space Space.
      * @param clause Clause.
      * @param params Parameters collection.
@@ -478,6 +487,8 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
      * @return Cursor.
      */
     public QueryCursor<List<?>> queryTwoStep(String space, 
GridCacheTwoStepQuery qry) {
+        checkxEnabled();
+
         if (!busyLock.enterBusy())
             throw new IllegalStateException("Failed to execute query (grid is 
stopping).");
 
@@ -495,6 +506,8 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
      * @return Cursor.
      */
     public QueryCursor<List<?>> queryTwoStep(GridCacheContext<?,?> cctx, 
SqlFieldsQuery qry) {
+        checkxEnabled();
+
         if (!busyLock.enterBusy())
             throw new IllegalStateException("Failed to execute query (grid is 
stopping).");
 
@@ -512,6 +525,8 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
      * @return Cursor.
      */
     public <K,V> QueryCursor<Cache.Entry<K,V>> 
queryTwoStep(GridCacheContext<?,?> cctx, SqlQuery qry) {
+        checkxEnabled();
+
         if (!busyLock.enterBusy())
             throw new IllegalStateException("Failed to execute query (grid is 
stopping).");
 

Reply via email to