IGNITE-171: javax.cache.* dependency moved from IgniteUtils to GridCacheUtils.


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

Branch: refs/heads/ignite-185
Commit: 17344fb3765bed8ebb541c2b216c2be566eac18f
Parents: f139706
Author: iveselovskiy <iveselovs...@gridgain.com>
Authored: Thu Feb 19 16:53:05 2015 +0300
Committer: iveselovskiy <iveselovs...@gridgain.com>
Committed: Thu Feb 19 16:53:05 2015 +0300

----------------------------------------------------------------------
 bin/setup-hadoop.sh                             |  2 +-
 .../processors/cache/GridCacheAdapter.java      |  2 +-
 .../processors/cache/GridCacheUtils.java        | 28 ++++++++++++++++++++
 .../processors/cache/IgniteCacheProxy.java      |  2 +-
 .../ignite/internal/util/IgniteUtils.java       | 27 ++++++-------------
 modules/hadoop/pom.xml                          |  6 -----
 6 files changed, 39 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17344fb3/bin/setup-hadoop.sh
----------------------------------------------------------------------
diff --git a/bin/setup-hadoop.sh b/bin/setup-hadoop.sh
index 3e1cf7d..8969dfa 100755
--- a/bin/setup-hadoop.sh
+++ b/bin/setup-hadoop.sh
@@ -54,7 +54,7 @@ setIgniteHome
 #
 # Set utility environment.
 #
-export MAIN_CLASS=org.apache.ignite.hadoop.GridHadoopSetup
+export MAIN_CLASS=org.apache.ignite.internal.processors.hadoop.GridHadoopSetup
 
 #
 # Start utility.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17344fb3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 9d8f243..8148ea3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -5286,7 +5286,7 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
                         break;
                     }
                     catch (IgniteCheckedException e) {
-                        throw U.convertToCacheException(e);
+                        throw CU.convertToCacheException(e);
                     }
                     catch (GridCacheEntryRemovedException ignore) {
                         // No-op.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17344fb3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index a3a5b20..9bcded2 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1739,4 +1739,32 @@ public class GridCacheUtils {
             }
         };
     }
+
+
+    /* Solely to publish U.getExceptionConverter(clazz) without explicit 
inheritance. */
+    private static class UU extends U {
+        public static C1<IgniteCheckedException, IgniteException> 
getExceptionConverter(Class<? extends IgniteCheckedException> clazz) {
+            return U.getExceptionConverter(clazz);
+        }
+    }
+
+    /**
+     * @param e Ignite checked exception.
+     * @return Ignite runtime exception.
+     */
+    @Nullable
+    public static CacheException 
convertToCacheException(IgniteCheckedException e) {
+        if (e instanceof CachePartialUpdateCheckedException)
+            return new 
CachePartialUpdateException((CachePartialUpdateCheckedException)e);
+        else if (e instanceof CacheAtomicUpdateTimeoutCheckedException)
+            return new CacheAtomicUpdateTimeoutException(e.getMessage(), e);
+
+        if (e.getCause() instanceof CacheException)
+            return (CacheException)e.getCause();
+
+        C1<IgniteCheckedException, IgniteException> converter = 
UU.getExceptionConverter(e.getClass());
+
+        return converter != null ? new CacheException(converter.apply(e)) : 
new CacheException(e);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17344fb3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 79f3994..699c211 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -1346,7 +1346,7 @@ public class IgniteCacheProxy<K, V> extends 
AsyncSupportAdapter<IgniteCache<K, V
      * @return Cache exception.
      */
     private CacheException cacheException(IgniteCheckedException e) {
-        return U.convertToCacheException(e);
+        return CU.convertToCacheException(e);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17344fb3/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java 
b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 103b0ad..d580913 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -47,7 +47,6 @@ import org.jdk8.backport.*;
 import org.jetbrains.annotations.*;
 import sun.misc.*;
 
-import javax.cache.*;
 import javax.management.*;
 import javax.naming.*;
 import javax.net.ssl.*;
@@ -517,6 +516,14 @@ public abstract class IgniteUtils {
         exceptionConverters = 
Collections.unmodifiableMap(exceptionConverters());
     }
 
+    /**
+     * Gets IgniteClosure for an IgniteCheckedException class.
+     * @param clazz
+     * @return The IgniteClosure mapped to this exception class, or null if 
none.
+     */
+    protected static C1<IgniteCheckedException, IgniteException> 
getExceptionConverter(Class<? extends IgniteCheckedException> clazz) {
+        return exceptionConverters.get(clazz);
+    }
 
     /**
      * Gets map with converters to convert internal checked exceptions to 
public API unchecked exceptions.
@@ -619,24 +626,6 @@ public abstract class IgniteUtils {
     }
 
     /**
-     * @param e Ignite checked exception.
-     * @return Ignite runtime exception.
-     */
-    @Nullable public static CacheException 
convertToCacheException(IgniteCheckedException e) {
-        if (e instanceof CachePartialUpdateCheckedException)
-            return new 
CachePartialUpdateException((CachePartialUpdateCheckedException)e);
-        else if (e instanceof CacheAtomicUpdateTimeoutCheckedException)
-            return new CacheAtomicUpdateTimeoutException(e.getMessage(), e);
-
-        if (e.getCause() instanceof CacheException)
-            return (CacheException)e.getCause();
-
-        C1<IgniteCheckedException, IgniteException> converter = 
exceptionConverters.get(e.getClass());
-
-        return converter != null ? new CacheException(converter.apply(e)) : 
new CacheException(e);
-    }
-
-    /**
      * @return System time approximated by 10 ms.
      */
     public static long currentTimeMillis() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17344fb3/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index 312f247..d965e58 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -37,12 +37,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>javax.cache</groupId>
-            <artifactId>cache-api</artifactId>
-            <version>1.0.0</version>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-core</artifactId>
             <version>${ignite.version}</version>

Reply via email to