You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/12/09 11:52:18 UTC

[1/2] ignite git commit: IGNITE-2108 Fixed cache store examples.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1.5 afbb0dc0c -> 3ba7e541c


IGNITE-2108 Fixed cache store examples.


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

Branch: refs/heads/ignite-1.5
Commit: e0ffc29593648391d7f45d7879451a687fca6e81
Parents: 5ea19a4
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Dec 9 17:52:02 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Dec 9 17:52:02 2015 +0700

----------------------------------------------------------------------
 .../java/org/apache/ignite/schema/Demo.java     |  6 ++-
 .../store/auto/CacheAutoStoreExample.java       | 49 ++++++++++----------
 2 files changed, 29 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e0ffc295/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
index a981f5a..a8934cb 100644
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
+++ b/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
@@ -41,11 +41,13 @@ public class Demo {
      * Constructs and returns a fully configured instance of a {@link CacheJdbcPojoStoreFactory}.
      */
     private static class H2DemoStoreFactory<K, V> extends CacheJdbcPojoStoreFactory<K, V> {
-        /** Default constructor. */
-        H2DemoStoreFactory() {
+        /** {@inheritDoc} */
+        @Override public CacheJdbcPojoStore<K, V> create() {
             setDialect(new H2Dialect());
 
             setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/~/schema-import/demo", "sa", ""));
+
+            return super.create();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0ffc295/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
index 5498e57..7d21fce 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
@@ -65,30 +65,9 @@ public class CacheAutoStoreExample {
     private static final class CacheJdbcPojoStoreExampleFactory extends CacheJdbcPojoStoreFactory<Long, Person> {
         /** {@inheritDoc} */
         @Override public CacheJdbcPojoStore<Long, Person> create() {
-            JdbcType jdbcType = new JdbcType();
+            setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
 
-            jdbcType.setCacheName(CACHE_NAME);
-            jdbcType.setDatabaseSchema("PUBLIC");
-            jdbcType.setDatabaseTable("PERSON");
-
-            jdbcType.setKeyType("java.lang.Long");
-            jdbcType.setKeyFields(new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"));
-
-            jdbcType.setValueType("org.apache.ignite.examples.model.Person");
-            jdbcType.setValueFields(
-                    new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"),
-                    new JdbcTypeField(Types.VARCHAR, "FIRST_NAME", String.class, "firstName"),
-                    new JdbcTypeField(Types.VARCHAR, "LAST_NAME", String.class, "lastName")
-            );
-
-            CacheJdbcPojoStore<Long, Person> store = new CacheJdbcPojoStore<>();
-
-            store.setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
-            store.setDialect(new H2Dialect());
-
-            store.setTypes(jdbcType);
-
-            return store;
+            return super.create();
         }
     }
 
@@ -98,7 +77,29 @@ public class CacheAutoStoreExample {
     private static CacheConfiguration<Long, Person> cacheConfiguration() {
         CacheConfiguration<Long, Person> cfg = new CacheConfiguration<>(CACHE_NAME);
 
-        cfg.setCacheStoreFactory(new CacheJdbcPojoStoreExampleFactory());
+        CacheJdbcPojoStoreExampleFactory storeFactory = new CacheJdbcPojoStoreExampleFactory();
+
+        storeFactory.setDialect(new H2Dialect());
+
+        JdbcType jdbcType = new JdbcType();
+
+        jdbcType.setCacheName(CACHE_NAME);
+        jdbcType.setDatabaseSchema("PUBLIC");
+        jdbcType.setDatabaseTable("PERSON");
+
+        jdbcType.setKeyType("java.lang.Long");
+        jdbcType.setKeyFields(new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"));
+
+        jdbcType.setValueType("org.apache.ignite.examples.model.Person");
+        jdbcType.setValueFields(
+            new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"),
+            new JdbcTypeField(Types.VARCHAR, "FIRST_NAME", String.class, "firstName"),
+            new JdbcTypeField(Types.VARCHAR, "LAST_NAME", String.class, "lastName")
+        );
+
+        storeFactory.setTypes(jdbcType);
+
+        cfg.setCacheStoreFactory(storeFactory);
 
         // Set atomicity as transaction, since we are showing transactions in the example.
         cfg.setAtomicityMode(TRANSACTIONAL);


[2/2] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ak...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1.5
Commit: 3ba7e541caa8f2dd2c4301203b07bfc58ef4cabb
Parents: e0ffc29 afbb0dc
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Dec 9 17:53:04 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Dec 9 17:53:04 2015 +0700

----------------------------------------------------------------------
 .../portable/PortableClassDescriptor.java       | 46 ++++++++++----------
 .../portable/BinaryMarshallerSelfTest.java      | 14 +++++-
 2 files changed, 36 insertions(+), 24 deletions(-)
----------------------------------------------------------------------