You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/02/02 12:23:58 UTC

[2/2] incubator-ignite git commit: #IGNITE-106: Remove examples using cache.projection

#IGNITE-106: Remove examples using cache.projection


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

Branch: refs/heads/ignite-106
Commit: b4a4f1b0de96536f2889206bf9c829b5977e2718
Parents: 72b94af
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Feb 2 14:13:24 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Feb 2 14:13:24 2015 +0300

----------------------------------------------------------------------
 .../starschema/CacheStarSchemaExample.java      | 23 --------------------
 .../examples/ScalarSnowflakeSchemaExample.scala | 22 +------------------
 2 files changed, 1 insertion(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b4a4f1b0/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 b1413dc..2283b3c 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
@@ -75,7 +75,6 @@ public class CacheStarSchemaExample {
 
         try {
             populateDimensions();
-            populateFacts();
 
             queryStorePurchases();
             queryProductPurchases();
@@ -110,28 +109,6 @@ public class CacheStarSchemaExample {
     }
 
     /**
-     * Populate cache with {@code 'facts'}, which in our case are {@link FactPurchase} objects.
-     *
-     * @throws IgniteCheckedException If failed.
-     */
-    private static void populateFacts() throws IgniteCheckedException {
-        GridCache<Integer, Object> dimCache = Ignition.ignite().cache(REPLICATED_CACHE_NAME);
-        GridCache<Integer, Object> factCache = Ignition.ignite().cache(PARTITIONED_CACHE_NAME);
-
-        CacheProjection<Integer, DimStore> stores = dimCache.projection(Integer.class, DimStore.class);
-        CacheProjection<Integer, DimProduct> prods = dimCache.projection(Integer.class, DimProduct.class);
-
-        for (int i = 0; i < 100; i++) {
-            int id = idGen++;
-
-            DimStore store = rand(stores.values());
-            DimProduct prod = rand(prods.values());
-
-            factCache.put(id, new FactPurchase(id, prod.getId(), store.getId(), (i + 1)));
-        }
-    }
-
-    /**
      * 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.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b4a4f1b0/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 9791d87..ec42a40 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
@@ -66,7 +66,6 @@ object ScalarSnowflakeSchemaExample {
             cache$(PART_CACHE_NAME).get.globalClearAll(0)
 
             populateDimensions()
-            populateFacts()
 
             queryStorePurchases()
             queryProductPurchases()
@@ -78,7 +77,7 @@ object ScalarSnowflakeSchemaExample {
      * `DimStore` and `DimProduct` instances.
      */
     def populateDimensions() {
-        val dimCache = grid$.cache[Int, Object](REPL_CACHE_NAME)
+        val dimCache = grid$.jcache[Int, Object](REPL_CACHE_NAME)
 
         val store1 = new DimStore(idGen.next(), "Store1", "12345", "321 Chilly Dr, NY")
         val store2 = new DimStore(idGen.next(), "Store2", "54321", "123 Windy Dr, San Francisco")
@@ -95,25 +94,6 @@ object ScalarSnowflakeSchemaExample {
     }
 
     /**
-     * Populate cache with `facts`, which in our case are `FactPurchase` objects.
-     */
-    def populateFacts() {
-        val dimCache = grid$.cache[Int, Object](REPL_CACHE_NAME)
-        val factCache = grid$.cache[Int, FactPurchase](PART_CACHE_NAME)
-
-        val stores: CacheProjection[Int, DimStore] = dimCache.viewByType(classOf[Int], classOf[DimStore])
-        val prods: CacheProjection[Int, DimProduct] = dimCache.viewByType(classOf[Int], classOf[DimProduct])
-
-        for (i <- 1 to 100) {
-            val store: DimStore = rand(stores.values)
-            val prod: DimProduct = rand(prods.values)
-            val purchase: FactPurchase = new FactPurchase(idGen.next(), prod.id, store.id, i + 1)
-
-            factCache.put(purchase.id, purchase)
-        }
-    }
-
-    /**
      * Query all purchases made at a specific store. This query uses cross-cache joins
      * between `DimStore` objects stored in `replicated` cache and
      * `FactPurchase` objects stored in `partitioned` cache.