#ignite-758: remove createScanQuery from CacheQueries.

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

Branch: refs/heads/ignite-737
Commit: 4b1789d4b1b8b43f026b9cbec2d0a09bf386504e
Parents: 33cdafc
Author: ivasilinets <ivasilin...@gridgain.com>
Authored: Thu Apr 16 23:10:08 2015 +0300
Committer: ivasilinets <ivasilin...@gridgain.com>
Committed: Thu Apr 16 23:10:08 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |  2 +-
 .../processors/cache/IgniteCacheProxy.java      |  3 ++-
 .../processors/cache/query/CacheQueries.java    |  8 -------
 .../cache/query/CacheQueriesImpl.java           | 12 -----------
 .../cache/query/GridCacheQueryManager.java      | 20 +++++++++++++++++-
 ...achePartitionedPreloadLifecycleSelfTest.java |  2 +-
 ...CacheReplicatedPreloadLifecycleSelfTest.java |  2 +-
 .../GridCacheSwapScanQueryAbstractSelfTest.java | 22 ++++++++++----------
 8 files changed, 35 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 3266cff..9938cbc 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -3682,7 +3682,7 @@ public abstract class GridCacheAdapter<K, V> implements 
IgniteInternalCache<K, V
 
         final CacheOperationContext opCtx = ctx.operationContextPerCall();
 
-        CacheQueryFuture<Map.Entry<K, V>> fut = queries().createScanQuery(null)
+        CacheQueryFuture<Map.Entry<K, V>> fut = 
ctx0.queries().createScanQuery(null, false)
             .keepAll(false)
             .execute();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index a7647ea..b3512b3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -320,7 +320,8 @@ public class IgniteCacheProxy<K, V> extends 
AsyncSupportAdapter<IgniteCache<K, V
         if (filter instanceof ScanQuery) {
             IgniteBiPredicate<K, V> p = ((ScanQuery)filter).getFilter();
 
-            qry = delegate.queries().createScanQuery(p != null ? p : 
ACCEPT_ALL);
+            qry = ctx.queries().createScanQuery(p != null ? p : ACCEPT_ALL,
+                    prjCtx != null ? prjCtx.isKeepPortable() : false);
 
             if (grp != null)
                 qry.projection(grp);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
index 4dafdd0..e99f31c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
@@ -46,14 +46,6 @@ public interface CacheQueries<K, V> {
     public CacheQuery<Map.Entry<K, V>> createFullTextQuery(String clsName, 
String search);
 
     /**
-     * Creates user's predicate based scan query.
-     *
-     * @param filter Scan filter.
-     * @return Created query.
-     */
-    public CacheQuery<Map.Entry<K, V>> createScanQuery(@Nullable 
IgniteBiPredicate<K, V> filter);
-
-    /**
      * Creates SQL fields query which will include results metadata if needed.
      *
      * @param qry SQL query.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java
index 757e341..7179e12 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java
@@ -76,18 +76,6 @@ public class CacheQueriesImpl<K, V> implements 
CacheQueries<K, V> {
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public CacheQuery<Map.Entry<K, V>> createScanQuery(@Nullable 
IgniteBiPredicate<K, V> filter) {
-        return new GridCacheQueryAdapter<>(ctx,
-            SCAN,
-            null,
-            null,
-            (IgniteBiPredicate<Object, Object>)filter,
-            false,
-            keepPortable);
-    }
-
-    /** {@inheritDoc} */
     @Override public CacheQuery<List<?>> createSqlFieldsQuery(String qry, 
boolean incMeta) {
         assert qry != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 945a9c1..9c2c0dd 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -2904,7 +2904,7 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
      *
      * @return Query.
      */
-     public <R> CacheQuery<R> createSpiQuery(boolean keepPortable) {
+    public <R> CacheQuery<R> createSpiQuery(boolean keepPortable) {
         return new GridCacheQueryAdapter<>(cctx,
                 SPI,
                 null,
@@ -2913,4 +2913,22 @@ public abstract class GridCacheQueryManager<K, V> 
extends GridCacheManagerAdapte
                 false,
                 keepPortable);
     }
+
+    /**
+     * Creates user's predicate based scan query.
+     *
+     * @param filter Scan filter.
+     * @return Created query.
+     */
+    @SuppressWarnings("unchecked")
+    public CacheQuery<Map.Entry<K, V>> createScanQuery(@Nullable 
IgniteBiPredicate<K, V> filter,
+                                                       boolean keepPortable) {
+        return new GridCacheQueryAdapter<>(cctx,
+                SCAN,
+                null,
+                null,
+                (IgniteBiPredicate<Object, Object>)filter,
+                false,
+                keepPortable);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
index a794e78..9d41074 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
@@ -176,7 +176,7 @@ public class GridCachePartitionedPreloadLifecycleSelfTest 
extends GridCachePrelo
             for (int j = 0; j < G.allGrids().size(); j++) {
                 GridCacheAdapter<Object, MyValue> c2 = 
((IgniteKernal)grid(j)).internalCache("two");
 
-                CacheQuery<Map.Entry<Object, MyValue>> qry = 
c2.queries().createScanQuery(null);
+                CacheQuery<Map.Entry<Object, MyValue>> qry = 
c2.context().queries().createScanQuery(null, false);
 
                 int totalCnt = F.sumInt(qry.execute(new 
IgniteReducer<Map.Entry<Object, MyValue>, Integer>() {
                     @IgniteInstanceResource

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
index 4e6e08c..62bf3f7 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
@@ -179,7 +179,7 @@ public class GridCacheReplicatedPreloadLifecycleSelfTest 
extends GridCachePreloa
             for (int j = 0; j < G.allGrids().size(); j++) {
                 GridCacheAdapter<Object, MyValue> c2 = 
((IgniteKernal)grid(j)).internalCache("two");
 
-                CacheQuery<Map.Entry<Object, MyValue>> qry = 
c2.queries().createScanQuery(null);
+                CacheQuery<Map.Entry<Object, MyValue>> qry = 
c2.context().queries().createScanQuery(null, false);
 
                 final int i0 = j;
                 final int j0 = i;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b1789d4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
index 597f115..ed8cd0d 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
@@ -132,14 +132,14 @@ public abstract class 
GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
             cache.getAndPut(new Key(i), new Person("p-" + i, i));
 
         try {
-            CacheQuery<Map.Entry<Key, Person>> qry = 
cache.queries().createScanQuery(
+            CacheQuery<Map.Entry<Key, Person>> qry = 
cache.context().queries().createScanQuery(
                 new IgniteBiPredicate<Key, Person>() {
                     @Override public boolean apply(Key key, Person p) {
                         assertEquals(key.id, (Integer)p.salary);
 
                         return key.id % 2 == 0;
                     }
-                }
+                }, false
             );
 
             Collection<Map.Entry<Key, Person>> res = qry.execute().get();
@@ -154,7 +154,7 @@ public abstract class 
GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
                 assertEquals(0, k.id % 2);
             }
 
-            qry = cache.queries().createScanQuery(null);
+            qry = cache.context().queries().createScanQuery(null, false);
 
             res = qry.execute().get();
 
@@ -179,14 +179,14 @@ public abstract class 
GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
         GridTestUtils.runMultiThreaded(new Callable<Void>() {
             @SuppressWarnings("unchecked")
             @Override public Void call() throws Exception {
-                CacheQuery<Map.Entry<Key, Person>> qry = 
cache.queries().createScanQuery(
+                CacheQuery<Map.Entry<Key, Person>> qry = 
cache.context().queries().createScanQuery(
                     new IgniteBiPredicate<Key, Person>() {
                         @Override public boolean apply(Key key, Person p) {
                             assertEquals(key.id, (Integer)p.salary);
 
                             return key.id % 2 == 0;
                         }
-                    }
+                    }, false
                 );
 
                 for (int i = 0; i < 250; i++) {
@@ -224,14 +224,14 @@ public abstract class 
GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
             cache.getAndPut(String.valueOf(i), (long) i);
 
         try {
-            CacheQuery<Map.Entry<String, Long>> qry = 
cache.queries().createScanQuery(
+            CacheQuery<Map.Entry<String, Long>> qry = 
cache.context().queries().createScanQuery(
                 new IgniteBiPredicate<String, Long>() {
                     @Override public boolean apply(String key, Long val) {
                         assertEquals(key, String.valueOf(val));
 
                         return val % 2 == 0;
                     }
-                }
+                }, false
             );
 
             Collection<Map.Entry<String, Long>> res = qry.execute().get();
@@ -247,7 +247,7 @@ public abstract class 
GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
                 assertEquals(0, val % 2);
             }
 
-            qry = cache.queries().createScanQuery(null);
+            qry = cache.context().queries().createScanQuery(null, false);
 
             res = qry.execute().get();
 
@@ -280,14 +280,14 @@ public abstract class 
GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
             cache.getAndPut(i, new byte[i]);
 
         try {
-            CacheQuery<Map.Entry<Integer, byte[]>> qry = 
cache.queries().createScanQuery(
+            CacheQuery<Map.Entry<Integer, byte[]>> qry = 
cache.context().queries().createScanQuery(
                 new IgniteBiPredicate<Integer, byte[]>() {
                     @Override public boolean apply(Integer key, byte[] val) {
                         assertEquals(key, (Integer)val.length);
 
                         return key % 2 == 0;
                     }
-                }
+                }, false
             );
 
             Collection<Map.Entry<Integer, byte[]>> res = qry.execute().get();
@@ -303,7 +303,7 @@ public abstract class 
GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
                 assertEquals(0, key % 2);
             }
 
-            qry = cache.queries().createScanQuery(null);
+            qry = cache.context().queries().createScanQuery(null, false);
 
             res = qry.execute().get();
 

Reply via email to