ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-1753 Renamed SIMPLE -> BUILT_IN.
Date Tue, 03 Nov 2015 10:07:20 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1753-1282 8bc4399aa -> 7278e0367


IGNITE-1753 Renamed SIMPLE -> BUILT_IN.


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

Branch: refs/heads/ignite-1753-1282
Commit: 7278e0367d7da248d1f4cb93b033462586f02e9d
Parents: 8bc4399
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Tue Nov 3 17:07:19 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Tue Nov 3 17:07:19 2015 +0700

----------------------------------------------------------------------
 .../store/jdbc/CacheAbstractJdbcStore.java      | 48 ++++++++++----------
 .../store/jdbc/CacheJdbcBlobStoreFactory.java   | 14 +++---
 .../cache/store/jdbc/CacheJdbcPojoStore.java    | 26 +++++------
 .../store/jdbc/CacheJdbcPojoStoreFactory.java   |  4 +-
 4 files changed, 46 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7278e036/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index e2e79d1..49cd284 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -127,24 +127,24 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
     /** Connection attribute property name. */
     protected static final String ATTR_CONN_PROP = "JDBC_STORE_CONNECTION";
 
-    /** Simple types names. */
-    protected static final Collection<String> SIMPLE_TYPES = new HashSet<>();
+    /** Built in Java types names. */
+    protected static final Collection<String> BUILT_IN_TYPES = new HashSet<>();
 
     static {
-        SIMPLE_TYPES.add("java.math.BigDecimal");
-        SIMPLE_TYPES.add("java.lang.Boolean");
-        SIMPLE_TYPES.add("java.lang.Byte");
-        SIMPLE_TYPES.add("java.lang.Character");
-        SIMPLE_TYPES.add("java.lang.Double");
-        SIMPLE_TYPES.add("java.util.Date");
-        SIMPLE_TYPES.add("java.sql.Date");
-        SIMPLE_TYPES.add("java.lang.Float");
-        SIMPLE_TYPES.add("java.lang.Integer");
-        SIMPLE_TYPES.add("java.lang.Long");
-        SIMPLE_TYPES.add("java.lang.Short");
-        SIMPLE_TYPES.add("java.lang.String");
-        SIMPLE_TYPES.add("java.sql.Timestamp");
-        SIMPLE_TYPES.add("java.util.UUID");
+        BUILT_IN_TYPES.add("java.math.BigDecimal");
+        BUILT_IN_TYPES.add("java.lang.Boolean");
+        BUILT_IN_TYPES.add("java.lang.Byte");
+        BUILT_IN_TYPES.add("java.lang.Character");
+        BUILT_IN_TYPES.add("java.lang.Double");
+        BUILT_IN_TYPES.add("java.util.Date");
+        BUILT_IN_TYPES.add("java.sql.Date");
+        BUILT_IN_TYPES.add("java.lang.Float");
+        BUILT_IN_TYPES.add("java.lang.Integer");
+        BUILT_IN_TYPES.add("java.lang.Long");
+        BUILT_IN_TYPES.add("java.lang.Short");
+        BUILT_IN_TYPES.add("java.lang.String");
+        BUILT_IN_TYPES.add("java.sql.Timestamp");
+        BUILT_IN_TYPES.add("java.util.UUID");
     }
 
     /** Auto-injected store session. */
@@ -169,7 +169,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
     /** Cache with entry mapping description. (cache name, (keyID, mapping description)).
*/
     protected volatile Map<String, Map<Object, EntryMapping>> cacheMappings =
Collections.emptyMap();
 
-    /** Map for quick check whether type is Simple, POJO or Portable. */
+    /** Map for quick check whether type is Built in, POJO or Portable. */
     private volatile Map<String, Map<String, TypeKind>> typeKinds = new HashMap<>();
 
     /** Maximum batch size for writeAll and deleteAll operations. */
@@ -562,9 +562,9 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
      */
     private void checkMapping(@Nullable String cacheName, TypeKind kind, String typeName,
JdbcTypeField[] fields) throws CacheException {
         try {
-            if (kind == TypeKind.SIMPLE) {
+            if (kind == TypeKind.BUILT_IN) {
                 if (fields.length != 1)
-                    throw new CacheException("More than one field for simple type [cache="
+  U.maskName(cacheName) +
+                    throw new CacheException("More than one field for built in type [cache="
+  U.maskName(cacheName) +
                         ", type=" + typeName + " ]");
 
                 JdbcTypeField field = fields[0];
@@ -618,7 +618,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
     }
 
     /**
-     * Checks for Simple/POJO/Portable type kind.
+     * Checks for Built in/POJO/Portable type kind.
      *
      * @param cacheName Cache name to get types settings.
      * @param typeName Type name to check for POJO/portable format.
@@ -644,8 +644,8 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
      * @return {@code True} if class not found.
      */
     private TypeKind kindForName(String type) {
-        if (SIMPLE_TYPES.contains(type))
-            return TypeKind.SIMPLE;
+        if (BUILT_IN_TYPES.contains(type))
+            return TypeKind.BUILT_IN;
 
         try {
             Class.forName(type);
@@ -1649,8 +1649,8 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
      * Type kind.
      */
     protected enum TypeKind {
-        /** Type is known java build type, like {@link String} */
-        SIMPLE,
+        /** Type is known as Java built in type, like {@link String} */
+        BUILT_IN,
         /** Class for this type is available. */
         POJO,
         /** Class for this type is not available. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7278e036/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
index 74ab30b..6a46619 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
@@ -35,7 +35,7 @@ import org.apache.ignite.resources.SpringApplicationContextResource;
  *
  * <h2 class="header">Spring Example</h2>
  * <pre name="code" class="xml">
- *     &lt;bean id= "simpleDataSource" class="org.h2.jdbcx.JdbcDataSource"/&gt;
+ *     &lt;bean id= "myDataSource" class="org.h2.jdbcx.JdbcDataSource"/&gt;
  *
  *     &lt;bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"&gt;
  *          ...
@@ -46,7 +46,7 @@ import org.apache.ignite.resources.SpringApplicationContextResource;
  *                      &lt;property name="cacheStoreFactory"&gt;
  *                          &lt;bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory"&gt;
  *                              &lt;property name="user" value = "Ignite" /&gt;
- *                              &lt;property name="dataSourceBean" value = "simpleDataSource"
/&gt;
+ *                              &lt;property name="dataSourceBean" value = "myDataSource"
/&gt;
  *                          &lt;/bean&gt;
  *                      &lt;/property&gt;
  *                  &lt;/bean&gt;
@@ -99,7 +99,7 @@ public class CacheJdbcBlobStoreFactory<K, V> implements Factory<CacheJdbcBlobSto
 
     /** Application context. */
     @SpringApplicationContextResource
-    private Object appContext;
+    private Object appCtx;
 
     /** {@inheritDoc} */
     @Override public CacheJdbcBlobStore<K, V> create() {
@@ -118,7 +118,7 @@ public class CacheJdbcBlobStoreFactory<K, V> implements Factory<CacheJdbcBlobSto
         if (dataSrc != null)
             store.setDataSource(dataSrc);
         else if (dataSrcBean != null) {
-            if (appContext == null)
+            if (appCtx == null)
                 throw new IgniteException("Spring application context resource is not injected.");
 
             IgniteSpringHelper spring;
@@ -126,13 +126,13 @@ public class CacheJdbcBlobStoreFactory<K, V> implements Factory<CacheJdbcBlobSto
             try {
                 spring = IgniteComponentType.SPRING.create(false);
 
-                DataSource data = spring.loadBeanFromAppContext(appContext, dataSrcBean);
+                DataSource data = spring.loadBeanFromAppContext(appCtx, dataSrcBean);
 
                 store.setDataSource(data);
             }
             catch (IgniteCheckedException e) {
                 throw new IgniteException("Failed to load bean in application context [beanName="
+ dataSrcBean +
-                    ", igniteConfig=" + appContext + ']');
+                    ", igniteConfig=" + appCtx + ']');
             }
         }
 
@@ -287,4 +287,4 @@ public class CacheJdbcBlobStoreFactory<K, V> implements Factory<CacheJdbcBlobSto
     @Override public String toString() {
         return S.toString(CacheJdbcBlobStoreFactory.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7278e036/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
index 48d4972..ce22bdc 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
@@ -63,7 +63,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
     @Override @Nullable protected Object extractParameter(@Nullable String cacheName, String
typeName, String fieldName,
         Object obj) throws CacheException {
         switch (typeKind(cacheName, typeName)) {
-            case SIMPLE:
+            case BUILT_IN:
                 return obj;
             case POJO:
                 return extractPojoParameter(cacheName, typeName, fieldName, obj);
@@ -98,7 +98,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
             Method getter = mc.getters.get(fieldName);
 
             if (getter == null)
-                throw new CacheLoaderException("Failed to find getter in POJO class [clsName="
+ typeName +
+                throw new CacheLoaderException("Failed to find getter in POJO class [class="
+ typeName +
                     ", prop=" + fieldName + "]");
 
             return getter.invoke(obj);
@@ -123,7 +123,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
             return pobj.field(fieldName);
         }
 
-        throw new CacheException("Failed to read property value from non portable object
[class name=" +
+        throw new CacheException("Failed to read property value from non portable object
[class=" +
             obj.getClass() + ", property=" + fieldName + "]");
     }
 
@@ -132,7 +132,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
         JdbcTypeField[] fields, Collection<String> hashFields, Map<String, Integer>
loadColIdxs, ResultSet rs)
         throws CacheLoaderException {
         switch (typeKind(cacheName, typeName)) {
-            case SIMPLE:
+            case BUILT_IN:
                 return (R)buildSimpleObject(typeName, fields, loadColIdxs, rs);
             case POJO:
                 return (R)buildPojoObject(cacheName, typeName, fields, loadColIdxs, rs);
@@ -142,13 +142,13 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
     }
 
     /**
-     * Construct simple object from query result.
+     * Construct Java built in object from query result.
      *
      * @param typeName Type name.
      * @param fields Fields descriptors.
-     * @param loadColIdxs Select query columns index.
-     * @param rs ResultSet.
-     * @return Constructed POJO.
+     * @param loadColIdxs Select query columns indexes.
+     * @param rs ResultSet to take data from.
+     * @return Constructed object.
      * @throws CacheLoaderException If failed to construct POJO.
      */
     private Object buildSimpleObject(String typeName, JdbcTypeField[] fields, Map<String,
Integer> loadColIdxs,
@@ -197,7 +197,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
                 Method setter = mc.setters.get(fldJavaName);
 
                 if (setter == null)
-                    throw new IllegalStateException("Failed to find setter in POJO class
[clsName=" + typeName +
+                    throw new IllegalStateException("Failed to find setter in POJO class
[type=" + typeName +
                         ", prop=" + fldJavaName + "]");
 
                 String fldDbName = field.getDatabaseFieldName();
@@ -211,12 +211,12 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
                         setter.invoke(obj, colVal);
                     }
                     catch (Exception e) {
-                        throw new CacheLoaderException("Failed to set property in POJO class
[clsName=" + typeName +
+                        throw new CacheLoaderException("Failed to set property in POJO class
[type=" + typeName +
                             ", prop=" + fldJavaName + ", col=" + colIdx + ", dbName=" + fldDbName
+ "]", e);
                     }
                 }
                 catch (SQLException e) {
-                    throw new CacheLoaderException("Failed to read object property [clsName=:
" + typeName +
+                    throw new CacheLoaderException("Failed to read object property [type=
" + typeName +
                         ", prop=" + fldJavaName + ", col=" + colIdx + ", dbName=" + fldDbName
+ "]", e);
                 }
             }
@@ -417,7 +417,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
                         getters.put(field.getJavaFieldName(), cls.getMethod("is" + prop));
                     }
                     catch (NoSuchMethodException e) {
-                        throw new CacheException("Failed to find getter in POJO class [clsName="
+ clsName +
+                        throw new CacheException("Failed to find getter in POJO class [class="
+ clsName +
                             ", prop=" + field.getJavaFieldName() + "]", e);
                     }
                 }
@@ -426,7 +426,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
                     setters.put(field.getJavaFieldName(), cls.getMethod("set" + prop, field.getJavaFieldType()));
                 }
                 catch (NoSuchMethodException e) {
-                    throw new CacheException("Failed to find setter in POJO class [clsName="
+ clsName +
+                    throw new CacheException("Failed to find setter in POJO class [class="
+ clsName +
                         ", prop=" + field.getJavaFieldName() + "]", e);
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7278e036/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
index 2aa004f..2fa3b8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
@@ -34,7 +34,7 @@ import org.apache.ignite.resources.SpringApplicationContextResource;
  *
  * <h2 class="header">Spring Example</h2>
  * <pre name="code" class="xml">
- *     &lt;bean id= "simpleDataSource" class="org.h2.jdbcx.JdbcDataSource"/&gt;
+ *     &lt;bean id= "myDataSource" class="org.h2.jdbcx.JdbcDataSource"/&gt;
  *
  *     &lt;bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"&gt;
  *          ...
@@ -47,7 +47,7 @@ import org.apache.ignite.resources.SpringApplicationContextResource;
  *                          &lt;bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory"&gt;
  *                              &lt;property name="configuration" &gt;
  *                                  &lt;bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcStoreFactory"&gt;
- *                                      &lt;property name="dataSourceBean" value="simpleDataSource"
+ *                                      &lt;property name="dataSourceBean" value="myDataSource"
  *                                      &lt;property name="types"&gt;
  *                                          &lt;list&gt;
  *                                              &lt;bean class="org.apache.ignite.cache.store.jdbc.JdbcType"&gt;


Mime
View raw message