ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [26/31] ignite git commit: IGNITE-5121: REST API call with empty cache name to call "default." - Fixes #1920.
Date Wed, 24 May 2017 13:36:31 GMT
IGNITE-5121: REST API call with empty cache name to call "default." - Fixes #1920.

Signed-off-by: shroman <rshtykh@yahoo.com>


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

Branch: refs/heads/ignite-5075
Commit: d8eeea84bef33d33470052fbb86c96d75490c9b8
Parents: 8c9b1bd
Author: shroman <rshtykh@yahoo.com>
Authored: Wed May 24 17:19:26 2017 +0900
Committer: shroman <rshtykh@yahoo.com>
Committed: Wed May 24 17:19:26 2017 +0900

----------------------------------------------------------------------
 .../rest/handlers/GridRestCommandHandlerAdapter.java   |  3 +++
 .../rest/handlers/cache/GridCacheCommandHandler.java   |  2 +-
 .../rest/handlers/query/QueryCommandHandler.java       | 13 +++++++------
 3 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d8eeea84/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/GridRestCommandHandlerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/GridRestCommandHandlerAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/GridRestCommandHandlerAdapter.java
index 31c26b3..def11dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/GridRestCommandHandlerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/GridRestCommandHandlerAdapter.java
@@ -24,6 +24,9 @@ import org.apache.ignite.internal.GridKernalContext;
  * Abstract command handler.
  */
 public abstract class GridRestCommandHandlerAdapter implements GridRestCommandHandler {
+    /** Used cache name in case the name was not defined in a request. */
+    protected static final String DFLT_CACHE_NAME = "default";
+
     /** Kernal context. */
     protected final GridKernalContext ctx;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d8eeea84/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index 18cd6af..9edf37e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -360,7 +360,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
 
         GridRestCacheRequest req0 = (GridRestCacheRequest)req;
 
-        final String cacheName = req0.cacheName();
+        final String cacheName = req0.cacheName() == null ? DFLT_CACHE_NAME: req0.cacheName();
 
         final Object key = req0.key();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d8eeea84/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index ee728a6..e7cc3dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -219,11 +219,11 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter
{
         assert req instanceof RestQueryRequest : "Invalid type of query request.";
 
         if (req.command() != CLOSE_SQL_QUERY) {
-            Integer pageSize = ((RestQueryRequest) req).pageSize();
+            Integer pageSize = ((RestQueryRequest)req).pageSize();
 
             if (pageSize == null)
                 return new GridFinishedFuture<>(
-                        new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("pageSize"))
+                    new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("pageSize"))
                 );
         }
 
@@ -232,17 +232,17 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter
{
             case EXECUTE_SQL_FIELDS_QUERY:
             case EXECUTE_SCAN_QUERY: {
                 return ctx.closure().callLocalSafe(
-                        new ExecuteQueryCallable(ctx, (RestQueryRequest) req, qryCurs), false);
+                    new ExecuteQueryCallable(ctx, (RestQueryRequest)req, qryCurs), false);
             }
 
             case FETCH_SQL_QUERY: {
                 return ctx.closure().callLocalSafe(
-                        new FetchQueryCallable((RestQueryRequest) req, qryCurs), false);
+                    new FetchQueryCallable((RestQueryRequest)req, qryCurs), false);
             }
 
             case CLOSE_SQL_QUERY: {
                 return ctx.closure().callLocalSafe(
-                        new CloseQueryCallable((RestQueryRequest) req, qryCurs), false);
+                    new CloseQueryCallable((RestQueryRequest)req, qryCurs), false);
             }
         }
 
@@ -315,7 +315,8 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter
{
                         throw new IgniteException("Incorrect query type [type=" + req.queryType()
+ "]");
                 }
 
-                IgniteCache<Object, Object> cache = ctx.grid().cache(req.cacheName());
+                IgniteCache<Object, Object> cache = ctx.grid().cache(
+                    req.cacheName() == null ? DFLT_CACHE_NAME : req.cacheName());
 
                 if (cache == null)
                     return new GridRestResponse(GridRestResponse.STATUS_FAILED,


Mime
View raw message