ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [23/50] [abbrv] incubator-ignite git commit: # IGNITE-330 Reworked snippet generation - we need to pass factory, not datasource.
Date Tue, 24 Mar 2015 10:16:27 GMT
# IGNITE-330 Reworked snippet generation - we need to pass factory, not datasource.


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

Branch: refs/heads/ignite-497-stick
Commit: 03170829bdd6e4d704f072a5e5567a87e6bd38fb
Parents: f586d43
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Tue Mar 24 10:06:45 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Tue Mar 24 10:06:45 2015 +0700

----------------------------------------------------------------------
 .../ignite/schema/generator/CodeGenerator.java  | 22 ++++++--------------
 1 file changed, 6 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/03170829/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
index 6782d38..31a8a1c 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
@@ -511,23 +511,13 @@ public class CodeGenerator {
             "CacheConfig", "CacheConfig");
 
         add1(src, "/** Configure cache. */");
-        add1(src, "public static CacheConfiguration cache(String name, final DataSource dataSource)
{");
-        add2(src, "if (dataSource == null)");
-        add3(src, "throw new NullPointerException(\"Datasource cannot be null.\");");
+        add1(src, " public static CacheConfiguration cache(String name, Factory<CacheStore>
factory) {");
+        add2(src, "if (factory == null)");
+        add3(src, " throw new IllegalArgumentException(\"Cache store factory cannot be null.\");");
         add0(src, "");
         add2(src, "CacheConfiguration ccfg = new CacheConfiguration(name);");
         add0(src, "");
-        add2(src, "ccfg.setCacheStoreFactory(new Factory<CacheStore>() {");
-        add3(src, "@Override public CacheStore create () {");
-        add4(src, "final CacheJdbcPojoStore store = new CacheJdbcPojoStore();");
-        add0(src, "");
-        add4(src, "store.setDataSource(dataSource);");
-        add0(src, "");
-        add4(src, "return store;");
-        add3(src, "}");
-        add2(src, "});");
-        add0(src, "");
-
+        add2(src, "ccfg.setCacheStoreFactory(factory);");
         add2(src, "ccfg.setReadThrough(true);");
         add2(src, "ccfg.setWriteThrough(true);");
         add0(src, "");
@@ -545,8 +535,8 @@ public class CodeGenerator {
             add2(src, (first ? "CacheTypeMetadata " : "") + "type = new CacheTypeMetadata();");
             add2(src, "type.setDatabaseSchema(\"" + pojo.schema() + "\");");
             add2(src, "type.setDatabaseTable(\"" + tbl + "\");");
-            add2(src, "type.setKeyType(\"" + pkg + "." + pojo.keyClassName() + "\");");
-            add2(src, "type.setValueType(\"" + pkg + "." + pojo.valueClassName() + "\");");
+            add2(src, "type.setKeyType(" + pojo.keyClassName() + ".class.getName());");
+            add2(src, "type.setValueType(" + pojo.valueClassName() + ".class.getName());");
             add0(src, "");
 
             add2(src, "meta.add(type);");


Mime
View raw message