ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [08/35] incubator-ignite git commit: # IGNITE-261 Cleanup API: WIP scalar.
Date Mon, 16 Feb 2015 14:16:45 GMT
# IGNITE-261 Cleanup API: WIP scalar.


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

Branch: refs/heads/ignite-239
Commit: 7007771c58d376fe3ea1e7ae9cb9465fe98a3b96
Parents: da1fa4e
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Mon Feb 16 16:51:22 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Mon Feb 16 16:51:22 2015 +0700

----------------------------------------------------------------------
 .../starschema/CacheStarSchemaExample.java      |   11 +-
 .../examples/ScalarCacheAffinityExample1.scala  |    6 +-
 .../examples/ScalarCacheAffinityExample2.scala  |    4 +-
 .../ScalarCacheAffinitySimpleExample.scala      |   10 +-
 .../scalar/examples/ScalarCacheExample.scala    |   51 +-
 .../ScalarCachePopularNumbersExample.scala      |    4 +-
 .../examples/ScalarCacheQueryExample.scala      |   16 +-
 .../examples/ScalarSnowflakeSchemaExample.scala |   45 +-
 .../ignite/scalar/ScalarConversions.scala       |   47 +-
 .../pimps/ScalarCacheConfigurationHelper.java   |   33 +
 .../ignite/scalar/pimps/ScalarCachePimp.scala   | 1933 ++++++++++++++++-
 .../pimps/ScalarCacheProjectionPimp.scala       | 2004 ------------------
 .../scala/org/apache/ignite/scalar/scalar.scala |    4 +-
 .../scalar/tests/ScalarCacheQueriesSpec.scala   |   13 +-
 14 files changed, 2022 insertions(+), 2159 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
index 9cdb70f..e8eb2be 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
@@ -70,9 +70,8 @@ public class CacheStarSchemaExample {
      * Executes example.
      *
      * @param args Command line arguments, none required.
-     * @throws IgniteCheckedException If example execution failed.
      */
-    public static void main(String[] args) throws IgniteCheckedException {
+    public static void main(String[] args) {
         Ignite ignite = Ignition.start("examples/config/example-cache.xml");
 
         System.out.println();
@@ -147,10 +146,8 @@ public class CacheStarSchemaExample {
      * Query all purchases made at a specific store. This query uses cross-cache joins
      * between {@link DimStore} objects stored in {@code 'replicated'} cache and
      * {@link FactPurchase} objects stored in {@code 'partitioned'} cache.
-     *
-     * @throws IgniteException If failed.
      */
-    private static void queryStorePurchases() throws IgniteCheckedException {
+    private static void queryStorePurchases() {
         IgniteCache<Integer, FactPurchase> factCache = Ignition.ignite().jcache(PARTITIONED_CACHE_NAME);
 
         // All purchases for store1.
@@ -173,7 +170,7 @@ public class CacheStarSchemaExample {
      *
      * @throws IgniteException If failed.
      */
-    private static void queryProductPurchases() throws IgniteCheckedException {
+    private static void queryProductPurchases() {
         IgniteCache<Integer, FactPurchase> factCache = Ignition.ignite().jcache(PARTITIONED_CACHE_NAME);
 
         // All purchases for certain product made at store2.
@@ -213,7 +210,7 @@ public class CacheStarSchemaExample {
     /**
      * Gets random value from given collection.
      *
-     * @param c Input collection (no {@code null} and not emtpy).
+     * @param c Input collection (no {@code null} and not empty).
      * @return Random value from the input collection.
      */
     @SuppressWarnings("UnusedDeclaration")

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample1.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample1.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample1.scala
index d932d39..7f6e3ee 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample1.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample1.scala
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.scalar.examples
 
-import java.util.concurrent.Callable
-
 import org.apache.ignite._
 import org.apache.ignite.cache.affinity.CacheAffinityKeyMapped
 import org.apache.ignite.lang.IgniteCallable
@@ -53,7 +51,7 @@ object ScalarCacheAffinityExample1 {
     def main(args: Array[String]) {
         scalar(CONFIG) {
             // Clean up caches on all nodes before run.
-            cache$(NAME).get.clear(0)
+            cache$(NAME).get.clear()
 
             var keys = Seq.empty[String]
 
@@ -83,7 +81,7 @@ object ScalarCacheAffinityExample1 {
                                 "Error"
                             }
                             else
-                                cache.get.peek(key)
+                                cache.get.localPeek(key)
                         }
                     },
                     null

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample2.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample2.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample2.scala
index 891869d..d1d9cdd 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample2.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample2.scala
@@ -47,7 +47,7 @@ object ScalarCacheAffinityExample2 {
     def main(args: Array[String]) {
         scalar(CONFIG) {
             // Clean up caches on all nodes before run.
-            cache$(NAME).get.clear(0)
+            cache$(NAME).get.clear()
 
             var keys = Seq.empty[String]
 
@@ -77,7 +77,7 @@ object ScalarCacheAffinityExample2 {
                                     ", cacheName=" + NAME + ']').^^
 
                             // Check cache without loading the value.
-                            mappedKeys.foreach(key => println(">>> Peeked at:
" + cache.get.peek(key)))
+                            mappedKeys.foreach(key => println(">>> Peeked at:
" + cache.get.localPeek(key)))
                         }
                     }, null)
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinitySimpleExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinitySimpleExample.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinitySimpleExample.scala
index a13252f..eff4fda 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinitySimpleExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinitySimpleExample.scala
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.scalar.examples
 
-import org.apache.ignite.cache.GridCache
+import org.apache.ignite.IgniteCache
 import org.apache.ignite.scalar.scalar
 import org.apache.ignite.scalar.scalar._
 
@@ -43,7 +43,7 @@ object ScalarCacheAffinitySimpleExample extends App {
     private val NAME = "partitioned"
 
     /** Type alias. */
-    type Cache = GridCache[Int, String]
+    type Cache = IgniteCache[Int, String]
 
     /*
      * Note that in case of `LOCAL` configuration,
@@ -51,9 +51,9 @@ object ScalarCacheAffinitySimpleExample extends App {
      */
     scalar("examples/config/example-cache.xml") {
         // Clean up caches on all nodes before run.
-        cache$(NAME).get.clear(0)
+        cache$(NAME).get.clear()
 
-        val c = ignite$.cache[Int, String](NAME)
+        val c = ignite$.jcache[Int, String](NAME)
 
         populate(c)
         visit(c)
@@ -68,7 +68,7 @@ object ScalarCacheAffinitySimpleExample extends App {
     private def visit(c: Cache) {
         (0 until KEY_CNT).foreach(i =>
             ignite$.compute().affinityRun(NAME, i,
-                () => println("Co-located [key= " + i + ", value=" + c.peek(i) + ']'))
+                () => println("Co-located [key= " + i + ", value=" + c.localPeek(i) +
']'))
         )
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
index 8df7dd8..a263350 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.scalar.examples
 
-import javax.cache.Cache
+import org.apache.ignite.cache.CachePeekMode
 
 import org.apache.ignite.events.Event
 import org.apache.ignite.events.EventType._
@@ -38,23 +38,22 @@ object ScalarCacheExample extends App {
     /** Name of cache specified in spring configuration. */
     private val NAME = "partitioned"
 
+    private val peekModes = Array.empty[CachePeekMode]
+
     scalar("examples/config/example-cache.xml") {
         // Clean up caches on all nodes before run.
-        cache$(NAME).get.clear(0)
+        cache$(NAME).get.clear()
 
         registerListener()
 
         basicOperations()
-        twoViewsOneCache()
     }
 
     /**
      * Demos basic cache operations.
      */
     def basicOperations() {
-        // Create cache predicate-based projection (all values > 30).
-        val c = cache$(NAME).get.viewByType(classOf[String], classOf[Int]).
-            viewByKv((k: String, v: Int) => v < 30)
+        val c = cache$[String, Int](NAME).get
 
         // Add few values.
         c += (1.toString -> 1)
@@ -64,7 +63,6 @@ object ScalarCacheExample extends App {
         c += (1.toString -> 11)
         c += (2.toString -> 22)
 
-        // These should be filtered out by projection.
         c += (1.toString -> 31)
         c += (2.toString -> 32)
         c += ((2.toString, 32))
@@ -75,17 +73,6 @@ object ScalarCacheExample extends App {
         // Put one more value.
         c += (3.toString -> 11)
 
-        val gt10 = (e: Cache.Entry[String, Int]) => e.getValue() > 10
-
-        // These should pass the predicate.
-        // Note that the predicate checks current state of entry, not the new value.
-        c += (3.toString -> 9, gt10)
-
-        // These should not pass the predicate
-        // because value less then 10 was put on previous step.
-        c += (3.toString -> 8, gt10)
-        c += (3.toString -> 12, gt10)
-
         // Get with option...
         c.opt(44.toString) match {
             case Some(v) => sys.error("Should never happen.")
@@ -93,33 +80,7 @@ object ScalarCacheExample extends App {
         }
 
         // Print all values.
-        c.values foreach println
-    }
-
-    /**
-     * Demos basic type features.
-     */
-    def twoViewsOneCache() {
-        // Create two typed views on the same cache.
-        val view1 = cache$(NAME).get.viewByType(classOf[String], classOf[Int])
-        val view2 = cache$(NAME).get.viewByType(classOf[Int], classOf[String])
-
-        view1 += ("key1" -> 1)
-        view1 += ("key2" -> 2)
-
-        // Attempt to update with predicate (will not update due to predicate failing).
-        view1 += ("key2" -> 3, (k: String, v: Int) => v != 2)
-
-        view2 += (1 -> "val1")
-        view2 += (2 -> "val2")
-
-        println("Values in view1:")
-        view1.values foreach println
-        println("view1 size is: " + view1.size)
-
-        println("Values in view2:")
-        view2.values foreach println
-        println("view2 size is: " + view2.size)
+        c.iterator() foreach println
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
index e376bda..69fe0ed 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
@@ -53,7 +53,7 @@ object ScalarCachePopularNumbersExample extends App {
 
     scalar("examples/config/example-cache.xml") {
         // Clean up caches on all nodes before run.
-        cache$(CACHE_NAME).get.clear(0)
+        cache$(CACHE_NAME).get.clear()
 
         println()
         println(">>> Cache popular numbers example started.")
@@ -75,7 +75,7 @@ object ScalarCachePopularNumbersExample extends App {
                 query(POPULAR_NUMBERS_CNT)
 
                 // Clean up caches on all nodes after run.
-                ignite$.cluster().forCacheNodes(CACHE_NAME).bcastRun(() => ignite$.cache(CACHE_NAME).clear(),
null)
+                ignite$.cluster().forCacheNodes(CACHE_NAME).bcastRun(() => ignite$.jcache(CACHE_NAME).clear(),
null)
             }
             finally {
                 popularNumbersQryTimer.cancel()

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
index 95d42c9..44b0deb 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
@@ -19,11 +19,9 @@ package org.apache.ignite.scalar.examples
 
 import java.util._
 
-import org.apache.ignite.Ignite
+import org.apache.ignite.{IgniteCache, Ignite}
 import org.apache.ignite.cache.CacheMode._
-import org.apache.ignite.cache.CacheProjection
 import org.apache.ignite.cache.affinity.CacheAffinityKey
-import org.apache.ignite.internal.processors.cache.CacheFlag
 import org.apache.ignite.scalar.scalar
 import org.apache.ignite.scalar.scalar._
 
@@ -64,7 +62,10 @@ object ScalarCacheQueryExample {
         // Using distributed queries for partitioned cache and local queries for replicated
cache.
         // Since in replicated caches data is available on all nodes, including local one,
         // it is enough to just query the local node.
-        val prj = if (cache$(CACHE_NAME).get.configuration.getCacheMode == PARTITIONED) ignite.cluster()
else ignite.cluster().forLocal()
+        val prj = if (cache$[Any, Any](CACHE_NAME).get.configuration().getCacheMode == PARTITIONED)
+            ignite.cluster().forRemotes()
+        else
+            ignite.cluster().forLocal()
 
         // Example for SQL-based querying employees based on salary ranges.
         // Gets all persons with 'salary > 1000'.
@@ -104,17 +105,14 @@ object ScalarCacheQueryExample {
      *
      * @return Cache to use.
      */
-    private def mkCache[K, V]: CacheProjection[K, V] = {
-        // Using distributed queries.
-        cache$[K, V](CACHE_NAME).get.flagsOn(CacheFlag.SYNC_COMMIT)
-    }
+    private def mkCache[K, V]: IgniteCache[K, V] = cache$[K, V](CACHE_NAME).get
 
     /**
      * Populates cache with test data.
      */
     private def initialize() {
         // Clean up caches on all nodes before run.
-        cache$(CACHE_NAME).get.clear(0)
+        cache$(CACHE_NAME).get.clear()
 
         // Organization cache projection.
         val orgCache = mkCache[UUID, Organization]

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
index b5ea3a3..723f3be 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
@@ -17,15 +17,13 @@
 
 package org.apache.ignite.scalar.examples
 
-import java.util
-import java.util.ConcurrentModificationException
-
-import org.apache.ignite.cache.CacheProjection
+import org.apache.ignite.Ignition
 import org.apache.ignite.scalar.scalar
 import org.apache.ignite.scalar.scalar._
+
 import org.jdk8.backport.ThreadLocalRandom8
 
-import scala.collection.JavaConversions._
+import java.util.ConcurrentModificationException
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Snowflake_schema">Snowflake Schema</a>
is a logical
@@ -68,8 +66,8 @@ object ScalarSnowflakeSchemaExample {
     def main(args: Array[String]) {
         scalar("examples/config/example-cache.xml") {
             // Clean up caches on all nodes before run.
-            cache$(REPL_CACHE_NAME).get.clear(0)
-            cache$(PART_CACHE_NAME).get.clear(0)
+            cache$(REPL_CACHE_NAME).get.clear()
+            cache$(PART_CACHE_NAME).get.clear()
 
             populateDimensions()
             populateFacts()
@@ -127,7 +125,7 @@ object ScalarSnowflakeSchemaExample {
      * `FactPurchase` objects stored in `partitioned` cache.
      */
     def queryStorePurchases() {
-        val factCache = ignite$.cache[Int, FactPurchase](PART_CACHE_NAME)
+        val factCache = ignite$.jcache[Int, FactPurchase](PART_CACHE_NAME)
 
         val storePurchases = factCache.sql(
             "from \"replicated\".DimStore, \"partitioned\".FactPurchase " +
@@ -143,25 +141,24 @@ object ScalarSnowflakeSchemaExample {
      * stored in `partitioned` cache.
      */
     private def queryProductPurchases() {
-        val dimCache = ignite$.cache[Int, Object](REPL_CACHE_NAME)
-        val factCache = ignite$.cache[Int, FactPurchase](PART_CACHE_NAME)
-
-        val prods: CacheProjection[Int, DimProduct] = dimCache.viewByType(classOf[Int], classOf[DimProduct])
+        val factCache = Ignition.ignite.jcache(PART_CACHE_NAME)
 
-        val p1: DimProduct = rand(prods.values)
-        val p2: DimProduct = rand(prods.values)
-        val p3: DimProduct = rand(prods.values)
+        // All purchases for certain product made at store2.
+        // =================================================
+        val p1: DimProduct = rand(dataProduct.values)
+        val p2: DimProduct = rand(dataProduct.values)
+        val p3: DimProduct = rand(dataProduct.values)
 
         println("IDs of products [p1=" + p1.id + ", p2=" + p2.id + ", p3=" + p3.id + ']')
 
-        val prodPurchases = factCache.sql(
-            "from \"replicated\".DimStore, \"replicated\".DimProduct, \"partitioned\".FactPurchase
" +
-            "where DimStore.id=FactPurchase.storeId and " +
-                "DimProduct.id=FactPurchase.productId and " +
-                "DimStore.name=? and DimProduct.id in(?, ?, ?)",
-            "Store2", p1.id, p2.id, p3.id)
-
-        printQueryResults("All purchases made at store2 for 3 specific products:", prodPurchases)
+//        val prodPurchases = factCache.sql(
+//            "from \"replicated\".DimStore, \"replicated\".DimProduct, \"partitioned\".FactPurchase
" +
+//            "where DimStore.id=FactPurchase.storeId and " +
+//                "DimProduct.id=FactPurchase.productId and " +
+//                "DimStore.name=? and DimProduct.id in(?, ?, ?)",
+//            "Store2", p1.id, p2.id, p3.id)
+//
+//        printQueryResults("All purchases made at store2 for 3 specific products:", prodPurchases)
     }
 
     /**
@@ -183,7 +180,7 @@ object ScalarSnowflakeSchemaExample {
      * @param c Input collection (no `null` and not emtpy).
      * @return Random value from the input collection.
      */
-    def rand[T](c: util.Collection[_ <: T]): T = {
+    def rand[T](c: Iterable[_ <: T]): T = {
         val n: Int = ThreadLocalRandom8.current.nextInt(c.size)
 
         var i: Int = 0

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/modules/scalar/src/main/scala/org/apache/ignite/scalar/ScalarConversions.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/main/scala/org/apache/ignite/scalar/ScalarConversions.scala
b/modules/scalar/src/main/scala/org/apache/ignite/scalar/ScalarConversions.scala
index 452793a..d9565af 100644
--- a/modules/scalar/src/main/scala/org/apache/ignite/scalar/ScalarConversions.scala
+++ b/modules/scalar/src/main/scala/org/apache/ignite/scalar/ScalarConversions.scala
@@ -17,10 +17,7 @@
 
 package org.apache.ignite.scalar
 
-import javax.cache.Cache
-
-import org.apache.ignite.Ignite
-import org.apache.ignite.cache._
+import org.apache.ignite.{IgniteCache, Ignite}
 import org.apache.ignite.cluster.ClusterGroup
 import org.apache.ignite.compute.ComputeJob
 import org.apache.ignite.internal.util.lang._
@@ -30,7 +27,6 @@ import org.apache.ignite.scalar.pimps._
 import org.jetbrains.annotations._
 
 import java.util.TimerTask
-import java.util.concurrent._
 
 import scala.collection._
 import scala.util.control.Breaks._
@@ -115,13 +111,13 @@ trait ScalarConversions {
     def toScalaSeq[A](@Nullable i: java.lang.Iterable[A]): Seq[A] =
         toScalaSeq(i, (e: A) => e)
 
-    /**
-     * Helper converter from Java collection to Scala sequence.
-     *
-     * @param c Java collection to convert.
-     */
-    def toScalaSeq[A](@Nullable c: java.util.Collection[A]): Seq[A] =
-        toScalaSeq(c, (e: A) => e)
+//    /**
+//     * Helper converter from Java collection to Scala sequence.
+//     *
+//     * @param c Java collection to convert.
+//     */
+//    def toScalaSeq[A](@Nullable c: java.util.Collection[A]): Seq[A] =
+//        toScalaSeq(c, (e: A) => e)
 
     /**
      * Helper converter from Java entry collection to Scala iterable of pair.
@@ -266,15 +262,14 @@ trait ScalarConversions {
             Option(t._3)
     }
 
-    /**
-     * Implicit converter from cache KV-pair predicate to cache entry predicate. Note that
predicate
-     * will use peek()
-     *
-     * @param p Cache KV-pair predicate to convert.
-     */
-    implicit def toEntryPred[K, V](p: (K, V) => Boolean): (_ >: Cache.Entry[K, V])
=> Boolean =
-        (e: Cache.Entry[K, V]) =>
-            p(e.getKey, e.getValue)
+//    /**
+//     * Implicit converter from cache KV-pair predicate to cache entry predicate. Note that
predicate
+//     * will use peek()
+//     *
+//     * @param p Cache KV-pair predicate to convert.
+//     */
+//    implicit def toEntryPred[K, V](p: (K, V) => Boolean): (_ >: Cache.Entry[K, V])
=> Boolean =
+//        (e: Cache.Entry[K, V]) => p(e.getKey, e.getValue)
 
     /**
      * Implicit converter from vararg of one-argument Scala functions to Java `GridPredicate`s.
@@ -400,18 +395,10 @@ trait ScalarConversions {
      *
      * @param impl Grid cache to convert.
      */
-    implicit def toScalarCache[K, V](impl: GridCache[K, V]): ScalarCachePimp[K, V] =
+    implicit def toScalarCache[K, V](impl: IgniteCache[K, V]): ScalarCachePimp[K, V] =
         ScalarCachePimp[K, V](impl)
 
     /**
-     * Implicit converter from `CacheProjection` to `ScalarCacheProjectionPimp` "pimp".
-     *
-     * @param impl Grid cache projection to convert.
-     */
-    implicit def toScalarCacheProjection[K, V](impl: CacheProjection[K, V]): ScalarCacheProjectionPimp[K,
V] =
-        ScalarCacheProjectionPimp[K, V](impl)
-
-    /**
      * Implicit converter from Scala function to `ComputeJob`.
      *
      * @param f Scala function to convert.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7007771c/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCacheConfigurationHelper.java
----------------------------------------------------------------------
diff --git a/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCacheConfigurationHelper.java
b/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCacheConfigurationHelper.java
new file mode 100644
index 0000000..55a4ab6
--- /dev/null
+++ b/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCacheConfigurationHelper.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.scalar.pimps;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+
+/**
+ * TODO: Add class description.
+ */
+public class ScalarCacheConfigurationHelper {
+    /**
+     * @param cache Cache.
+     */
+    public static CacheConfiguration extract(IgniteCache cache) {
+        return (CacheConfiguration)cache.getConfiguration(CacheConfiguration.class);
+    }
+}


Mime
View raw message