ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [05/10] incubator-ignite git commit: # ignite-113 : Grid-prefix was deleted (renamed to Ignite) in part of classes
Date Thu, 29 Jan 2015 09:51:59 GMT
# ignite-113 : Grid-prefix was deleted (renamed to Ignite) in part of classes


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

Branch: refs/heads/ignite-113
Commit: 0c0fcf3c0b833fe5e84acd379d44d95c0c7915bb
Parents: 6712053
Author: Artem SHutak <ashutak@gridgain.com>
Authored: Thu Jan 29 12:30:49 2015 +0300
Committer: Artem SHutak <ashutak@gridgain.com>
Committed: Thu Jan 29 12:30:49 2015 +0300

----------------------------------------------------------------------
 examples/config/servlet/WEB-INF/web.xml         |    2 +-
 .../main/java/org/apache/ignite/Ignition.java   |    2 +-
 .../apache/ignite/cache/query/CacheQuery.java   |    3 +-
 .../cache/query/CacheQuerySqlFunction.java      |    4 +-
 .../query/annotations/QuerySqlFunction.java     |    2 +-
 .../apache/ignite/cache/store/CacheStore.java   |    2 +-
 .../configuration/GridQueryConfiguration.java   |  201 ---
 .../configuration/IgniteConfiguration.java      |    6 +-
 .../configuration/IgniteQueryConfiguration.java |  201 +++
 .../ignite/spi/deployment/DeploymentSpi.java    |    2 +-
 .../apache/ignite/transactions/IgniteTx.java    |    2 +-
 modules/core/src/test/webapp/WEB-INF/web.xml    |    2 +-
 .../hibernate/GridCacheHibernateBlobStore.java  |  593 --------
 .../GridCacheHibernateBlobStoreEntry.hbm.xml    |   29 -
 .../GridCacheHibernateBlobStoreEntry.java       |   86 --
 .../IgniteCacheHibernateBlobStore.java          |  593 ++++++++
 .../IgniteCacheHibernateBlobStoreEntry.hbm.xml  |   29 +
 .../IgniteCacheHibernateBlobStoreEntry.java     |   86 ++
 ...idHibernateL2CacheTransactionalSelfTest.java |    2 +-
 .../GridCacheHibernateBlobStoreSelfTest.java    |  108 --
 .../IgniteCacheHibernateBlobStoreSelfTest.java  |  108 ++
 .../testsuites/IgniteHibernateTestSuite.java    |    2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |    6 +-
 .../cache/GridCacheAbstractQuerySelfTest.java   |    2 +-
 .../GridCacheQueryMultiThreadedSelfTest.java    |    2 +-
 .../query/h2/sql/GridQueryParsingTest.java      |    2 +-
 .../ignite/cache/jta/GridCacheTmLookup.java     |   50 -
 .../ignite/cache/jta/IgniteCacheTmLookup.java   |   50 +
 .../cache/jta/jndi/GridCacheJndiTmLookup.java   |   74 -
 .../cache/jta/jndi/IgniteCacheJndiTmLookup.java |   74 +
 .../reflect/GridCacheReflectionTmLookup.java    |  115 --
 .../reflect/IgniteCacheReflectionTmLookup.java  |  115 ++
 .../processors/cache/jta/CacheJtaManager.java   |    4 +-
 ...CacheJtaConfigurationValidationSelfTest.java |    2 +-
 .../processors/cache/GridCacheJtaSelfTest.java  |    2 +-
 .../GridTmLookupLifecycleAwareSelfTest.java     |    4 +-
 .../ignite/cache/spring/SpringCacheManager.java |    2 +-
 .../uri/GridUriDeploymentFileProcessor.java     |    2 +-
 .../deployment/uri/GridUriDeploymentSpi.java    | 1367 ------------------
 .../uri/GridUriDeploymentSpiMBean.java          |   53 -
 .../deployment/uri/IgniteUriDeploymentSpi.java  | 1367 ++++++++++++++++++
 .../uri/IgniteUriDeploymentSpiMBean.java        |   53 +
 .../GridTaskUriDeploymentDeadlockSelfTest.java  |    2 +-
 .../ignite/p2p/GridP2PDisabledSelfTest.java     |    2 +-
 .../uri/GridUriDeploymentAbstractSelfTest.java  |    2 +-
 .../GridUriDeploymentClassLoaderSelfTest.java   |    2 +-
 ...riDeploymentClassloaderRegisterSelfTest.java |    4 +-
 .../uri/GridUriDeploymentConfigSelfTest.java    |   10 +-
 .../GridUriDeploymentFileProcessorSelfTest.java |    2 +-
 .../uri/GridUriDeploymentMd5CheckSelfTest.java  |    2 +-
 ...loymentMultiScannersErrorThrottlingTest.java |    2 +-
 .../GridUriDeploymentMultiScannersSelfTest.java |    2 +-
 .../uri/GridUriDeploymentSimpleSelfTest.java    |   10 +-
 .../file/GridFileDeploymentSelfTest.java        |    2 +-
 .../GridFileDeploymentUndeploySelfTest.java     |    8 +-
 .../uri/scanners/ftp/GridFtpDeploymentTest.java |    2 +-
 .../http/GridHttpDeploymentSelfTest.java        |    2 +-
 .../IgniteUriDeploymentTestSuite.java           |    3 +-
 .../cache/websession/GridWebSessionFilter.java  |    4 +-
 .../GridServletContextListenerStartup.java      |  181 ---
 .../startup/servlet/GridServletStartup.java     |  187 ---
 .../IgniteServletContextListenerStartup.java    |  181 +++
 .../startup/servlet/IgniteServletStartup.java   |  187 +++
 63 files changed, 3102 insertions(+), 3106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/examples/config/servlet/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/examples/config/servlet/WEB-INF/web.xml b/examples/config/servlet/WEB-INF/web.xml
index 603f74b..ff26506 100644
--- a/examples/config/servlet/WEB-INF/web.xml
+++ b/examples/config/servlet/WEB-INF/web.xml
@@ -31,6 +31,6 @@
     </context-param>
 
     <listener>
-        <listener-class>org.apache.ignite.startup.servlet.GridServletContextListenerStartup</listener-class>
+        <listener-class>org.apache.ignite.startup.servlet.IgniteServletContextListenerStartup</listener-class>
     </listener>
 </web-app>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/Ignition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignition.java b/modules/core/src/main/java/org/apache/ignite/Ignition.java
index 0046993..0abcf66 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignition.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignition.java
@@ -34,7 +34,7 @@ import java.util.*;
  * {@link org.apache.ignite.startup} package, for example:
  * <ul>
  * <li>{@link org.apache.ignite.startup.cmdline.CommandLineStartup}</li>
- * <li>{@ignitelink org.apache.ignite.startup.servlet.GridServletStartup}</li>
+ * <li>{@ignitelink org.apache.ignite.startup.servlet.IgniteServletStartup}</li>
  * </ul>
  * <h1 class="header">Examples</h1>
  * Use {@link #start()} method to start grid with default configuration. You can also use

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuery.java
index 4be4f95..355f1f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuery.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.cache.query;
 
 import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
 
@@ -52,7 +51,7 @@ import org.jetbrains.annotations.*;
  * <h2 class="header">Custom functions in SQL queries.</h2>
  * It is possible to write custom Java methods and call then form SQL queries. These methods must be public static
  * and annotated with {@link CacheQuerySqlFunction}. Classes containing these methods must be registered in
- * {@link GridQueryConfiguration#setIndexCustomFunctionClasses(Class[])}.
+ * {@link org.apache.ignite.configuration.IgniteQueryConfiguration#setIndexCustomFunctionClasses(Class[])}.
  * <h1 class="header">Full Text Queries</h1>
  * GridGain supports full text queries based on Apache Lucene engine. This queries are created by
  * {@link CacheQueries#createFullTextQuery(Class, String)} method. Note that all fields that

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuerySqlFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuerySqlFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuerySqlFunction.java
index 02b9e2b..2fd11f4 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuerySqlFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuerySqlFunction.java
@@ -17,14 +17,12 @@
 
 package org.apache.ignite.cache.query;
 
-import org.apache.ignite.configuration.*;
-
 import java.lang.annotation.*;
 
 /**
  * Annotates public static methods in classes to be used in SQL queries as custom functions.
  * Annotated class must be registered in H2 indexing SPI using following method
- * {@link GridQueryConfiguration#setIndexCustomFunctionClasses(Class[])}.
+ * {@link org.apache.ignite.configuration.IgniteQueryConfiguration#setIndexCustomFunctionClasses(Class[])}.
  * <p>
  * Example usage:
  * <pre name="code" class="java">

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlFunction.java
index eebf86c..73db722 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlFunction.java
@@ -22,7 +22,7 @@ import java.lang.annotation.*;
 /**
  * Annotates public static methods in classes to be used in SQL queries as custom functions.
  * Annotated class must be registered in H2 indexing SPI using following method
- * {@link org.apache.ignite.configuration.GridQueryConfiguration#setIndexCustomFunctionClasses(java.lang.Class[])}.
+ * {@link org.apache.ignite.configuration.IgniteQueryConfiguration#setIndexCustomFunctionClasses(java.lang.Class[])}.
  * <p>
  * Example usage:
  * <pre name="code" class="java">

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
index 3906354..bf5ffdf 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
@@ -50,7 +50,7 @@ import static javax.cache.Cache.*;
  * <p>
  * Provided implementations may be used for test purposes:
  * <ul>
- *     <li>{@ignitelink org.apache.ignite.cache.store.hibernate.GridCacheHibernateBlobStore}</li>
+ *     <li>{@ignitelink org.apache.ignite.cache.store.hibernate.IgniteCacheHibernateBlobStore}</li>
  *     <li>{@link CacheJdbcBlobStore}</li>
  * </ul>
  * <p>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java
deleted file mode 100644
index d329a2c..0000000
--- a/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.configuration;
-
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-/**
- * Configuration for embedded indexing facilities.
- */
-public class GridQueryConfiguration {
-    /** Default query execution time interpreted as long query (3 seconds). */
-    public static final long DFLT_LONG_QRY_EXEC_TIMEOUT = 3000;
-
-    /** Default value for {@link #setUseOptimizedSerializer(boolean)} flag. */
-    public static final boolean DFLT_USE_OPTIMIZED_SERIALIZER = true;
-
-    /** */
-    private Class<?>[] idxCustomFuncClss;
-
-    /** */
-    private String[] searchPath;
-
-    /** */
-    private String initScriptPath;
-
-    /** */
-    private long maxOffHeapMemory = -1;
-
-    /** */
-    private long longQryExecTimeout = DFLT_LONG_QRY_EXEC_TIMEOUT;
-
-    /** */
-    private boolean longQryExplain;
-
-    /** */
-    private boolean useOptimizedSerializer = DFLT_USE_OPTIMIZED_SERIALIZER;
-
-    /**
-     * Sets maximum amount of memory available to off-heap storage. Possible values are
-     * <ul>
-     * <li>{@code -1} - Means that off-heap storage is disabled.</li>
-     * <li>
-     *     {@code 0} - GridGain will not limit off-heap storage (it's up to user to properly
-     *     add and remove entries from cache to ensure that off-heap storage does not grow
-     *     indefinitely.
-     * </li>
-     * <li>Any positive value specifies the limit of off-heap storage in bytes.</li>
-     * </ul>
-     * Default value is {@code -1}, which means that off-heap storage is disabled by default.
-     * <p>
-     * Use off-heap storage to load gigabytes of data in memory without slowing down
-     * Garbage Collection. Essentially in this case you should allocate very small amount
-     * of memory to JVM and GridGain will cache most of the data in off-heap space
-     * without affecting JVM performance at all.
-     *
-     * @param maxOffHeapMemory Maximum memory in bytes available to off-heap memory space.
-     */
-    public void setMaxOffHeapMemory(long maxOffHeapMemory) {
-        this.maxOffHeapMemory = maxOffHeapMemory;
-    }
-
-    /** {@inheritDoc} */
-    public long getMaxOffHeapMemory() {
-        return maxOffHeapMemory;
-    }
-
-    /**
-     * Specifies max allowed size of cache for deserialized offheap rows to avoid deserialization costs for most
-     * frequently used ones. In general performance is better with greater cache size. Must be more than 128 items.
-     *
-     * @param size Cache size in items.
-     */
-    public void setMaxOffheapRowsCacheSize(int size) {
-        A.ensure(size >= 128, "Offheap rows cache size must be not less than 128.");
-
-//        rowCache = new CacheLongKeyLIRS<>(size, 1, 128, 256); TODO
-    }
-
-    /**
-     * Sets the optional search path consisting of space names to search SQL schema objects. Useful for cross cache
-     * queries to avoid writing fully qualified table names.
-     *
-     * @param searchPath Search path.
-     */
-    public void setSearchPath(String... searchPath) {
-        this.searchPath = searchPath;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable public String[] getSearchPath() {
-        return searchPath;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable public String getInitialScriptPath() {
-        return initScriptPath;
-    }
-
-    /**
-     * Sets script path to be ran against H2 database after opening.
-     * The script must be UTF-8 encoded file.
-     *
-     * @param initScriptPath Script path.
-     */
-    public void setInitialScriptPath(String initScriptPath) {
-        this.initScriptPath = initScriptPath;
-    }
-
-    /**
-     * Sets classes with methods annotated by {@link org.apache.ignite.cache.query.CacheQuerySqlFunction}
-     * to be used as user-defined functions from SQL queries.
-     *
-     * @param idxCustomFuncClss List of classes.
-     */
-    public void setIndexCustomFunctionClasses(Class<?>... idxCustomFuncClss) {
-        this.idxCustomFuncClss = idxCustomFuncClss;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable public Class<?>[] getIndexCustomFunctionClasses() {
-        return idxCustomFuncClss;
-    }
-
-    /** {@inheritDoc} */
-    public long getLongQueryExecutionTimeout() {
-        return longQryExecTimeout;
-    }
-
-    /**
-     * Set query execution time threshold. If queries exceed this threshold,
-     * then a warning will be printed out. If {@link #setLongQueryExplain(boolean)} is
-     * set to {@code true}, then execution plan will be printed out as well.
-     * <p>
-     * If not provided, default value is defined by {@link #DFLT_LONG_QRY_EXEC_TIMEOUT}.
-     *
-     * @param longQryExecTimeout Long query execution timeout.
-     * @see #setLongQueryExplain(boolean)
-     */
-    public void setLongQueryExecutionTimeout(long longQryExecTimeout) {
-        this.longQryExecTimeout = longQryExecTimeout;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isLongQueryExplain() {
-        return longQryExplain;
-    }
-
-    /**
-     * If {@code true}, SPI will print SQL execution plan for long queries (explain SQL query).
-     * The time threshold of long queries is controlled via {@link #setLongQueryExecutionTimeout(long)}
-     * parameter.
-     * <p>
-     * If not provided, default value is {@code false}.
-     *
-     * @param longQryExplain Flag marking SPI should print SQL execution plan for long queries (explain SQL query).
-     * @see #setLongQueryExecutionTimeout(long)
-     */
-    public void setLongQueryExplain(boolean longQryExplain) {
-        this.longQryExplain = longQryExplain;
-    }
-
-    /**
-     * The flag indicating that serializer for H2 database will be set to GridGain's marshaller.
-     * This setting usually makes sense for offheap indexing only.
-     * <p>
-     * Default is {@link #DFLT_USE_OPTIMIZED_SERIALIZER}.
-     *
-     * @param useOptimizedSerializer Flag value.
-     */
-    public void setUseOptimizedSerializer(boolean useOptimizedSerializer) {
-        this.useOptimizedSerializer = useOptimizedSerializer;
-    }
-
-    /**
-     * The flag indicating that serializer for H2 database will be set to GridGain's marshaller.
-     * This setting usually makes sense for offheap indexing only.
-     * <p>
-     * Default is {@link #DFLT_USE_OPTIMIZED_SERIALIZER}.
-     *
-     * @return Flag value.
-     */
-    public boolean isUseOptimizedSerializer() {
-        return useOptimizedSerializer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 96db5d5..7ad5abf 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -526,7 +526,7 @@ public class IgniteConfiguration {
     private IgniteInClosure<IgniteConfiguration> warmupClos;
 
     /** */
-    private GridQueryConfiguration qryCfg;
+    private IgniteQueryConfiguration qryCfg;
 
     /**
      * Creates valid grid configuration with all default values.
@@ -3169,14 +3169,14 @@ public class IgniteConfiguration {
     /**
      * @return Query configuration.
      */
-    public GridQueryConfiguration getQueryConfiguration() {
+    public IgniteQueryConfiguration getQueryConfiguration() {
         return qryCfg;
     }
 
     /**
      * @param qryCfg Query configuration.
      */
-    public void setQueryConfiguration(GridQueryConfiguration qryCfg) {
+    public void setQueryConfiguration(IgniteQueryConfiguration qryCfg) {
         this.qryCfg = qryCfg;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/configuration/IgniteQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteQueryConfiguration.java
new file mode 100644
index 0000000..d4a5e2f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteQueryConfiguration.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.configuration;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Configuration for embedded indexing facilities.
+ */
+public class IgniteQueryConfiguration {
+    /** Default query execution time interpreted as long query (3 seconds). */
+    public static final long DFLT_LONG_QRY_EXEC_TIMEOUT = 3000;
+
+    /** Default value for {@link #setUseOptimizedSerializer(boolean)} flag. */
+    public static final boolean DFLT_USE_OPTIMIZED_SERIALIZER = true;
+
+    /** */
+    private Class<?>[] idxCustomFuncClss;
+
+    /** */
+    private String[] searchPath;
+
+    /** */
+    private String initScriptPath;
+
+    /** */
+    private long maxOffHeapMemory = -1;
+
+    /** */
+    private long longQryExecTimeout = DFLT_LONG_QRY_EXEC_TIMEOUT;
+
+    /** */
+    private boolean longQryExplain;
+
+    /** */
+    private boolean useOptimizedSerializer = DFLT_USE_OPTIMIZED_SERIALIZER;
+
+    /**
+     * Sets maximum amount of memory available to off-heap storage. Possible values are
+     * <ul>
+     * <li>{@code -1} - Means that off-heap storage is disabled.</li>
+     * <li>
+     *     {@code 0} - GridGain will not limit off-heap storage (it's up to user to properly
+     *     add and remove entries from cache to ensure that off-heap storage does not grow
+     *     indefinitely.
+     * </li>
+     * <li>Any positive value specifies the limit of off-heap storage in bytes.</li>
+     * </ul>
+     * Default value is {@code -1}, which means that off-heap storage is disabled by default.
+     * <p>
+     * Use off-heap storage to load gigabytes of data in memory without slowing down
+     * Garbage Collection. Essentially in this case you should allocate very small amount
+     * of memory to JVM and GridGain will cache most of the data in off-heap space
+     * without affecting JVM performance at all.
+     *
+     * @param maxOffHeapMemory Maximum memory in bytes available to off-heap memory space.
+     */
+    public void setMaxOffHeapMemory(long maxOffHeapMemory) {
+        this.maxOffHeapMemory = maxOffHeapMemory;
+    }
+
+    /** {@inheritDoc} */
+    public long getMaxOffHeapMemory() {
+        return maxOffHeapMemory;
+    }
+
+    /**
+     * Specifies max allowed size of cache for deserialized offheap rows to avoid deserialization costs for most
+     * frequently used ones. In general performance is better with greater cache size. Must be more than 128 items.
+     *
+     * @param size Cache size in items.
+     */
+    public void setMaxOffheapRowsCacheSize(int size) {
+        A.ensure(size >= 128, "Offheap rows cache size must be not less than 128.");
+
+//        rowCache = new CacheLongKeyLIRS<>(size, 1, 128, 256); TODO
+    }
+
+    /**
+     * Sets the optional search path consisting of space names to search SQL schema objects. Useful for cross cache
+     * queries to avoid writing fully qualified table names.
+     *
+     * @param searchPath Search path.
+     */
+    public void setSearchPath(String... searchPath) {
+        this.searchPath = searchPath;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public String[] getSearchPath() {
+        return searchPath;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public String getInitialScriptPath() {
+        return initScriptPath;
+    }
+
+    /**
+     * Sets script path to be ran against H2 database after opening.
+     * The script must be UTF-8 encoded file.
+     *
+     * @param initScriptPath Script path.
+     */
+    public void setInitialScriptPath(String initScriptPath) {
+        this.initScriptPath = initScriptPath;
+    }
+
+    /**
+     * Sets classes with methods annotated by {@link org.apache.ignite.cache.query.CacheQuerySqlFunction}
+     * to be used as user-defined functions from SQL queries.
+     *
+     * @param idxCustomFuncClss List of classes.
+     */
+    public void setIndexCustomFunctionClasses(Class<?>... idxCustomFuncClss) {
+        this.idxCustomFuncClss = idxCustomFuncClss;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public Class<?>[] getIndexCustomFunctionClasses() {
+        return idxCustomFuncClss;
+    }
+
+    /** {@inheritDoc} */
+    public long getLongQueryExecutionTimeout() {
+        return longQryExecTimeout;
+    }
+
+    /**
+     * Set query execution time threshold. If queries exceed this threshold,
+     * then a warning will be printed out. If {@link #setLongQueryExplain(boolean)} is
+     * set to {@code true}, then execution plan will be printed out as well.
+     * <p>
+     * If not provided, default value is defined by {@link #DFLT_LONG_QRY_EXEC_TIMEOUT}.
+     *
+     * @param longQryExecTimeout Long query execution timeout.
+     * @see #setLongQueryExplain(boolean)
+     */
+    public void setLongQueryExecutionTimeout(long longQryExecTimeout) {
+        this.longQryExecTimeout = longQryExecTimeout;
+    }
+
+    /** {@inheritDoc} */
+    public boolean isLongQueryExplain() {
+        return longQryExplain;
+    }
+
+    /**
+     * If {@code true}, SPI will print SQL execution plan for long queries (explain SQL query).
+     * The time threshold of long queries is controlled via {@link #setLongQueryExecutionTimeout(long)}
+     * parameter.
+     * <p>
+     * If not provided, default value is {@code false}.
+     *
+     * @param longQryExplain Flag marking SPI should print SQL execution plan for long queries (explain SQL query).
+     * @see #setLongQueryExecutionTimeout(long)
+     */
+    public void setLongQueryExplain(boolean longQryExplain) {
+        this.longQryExplain = longQryExplain;
+    }
+
+    /**
+     * The flag indicating that serializer for H2 database will be set to GridGain's marshaller.
+     * This setting usually makes sense for offheap indexing only.
+     * <p>
+     * Default is {@link #DFLT_USE_OPTIMIZED_SERIALIZER}.
+     *
+     * @param useOptimizedSerializer Flag value.
+     */
+    public void setUseOptimizedSerializer(boolean useOptimizedSerializer) {
+        this.useOptimizedSerializer = useOptimizedSerializer;
+    }
+
+    /**
+     * The flag indicating that serializer for H2 database will be set to GridGain's marshaller.
+     * This setting usually makes sense for offheap indexing only.
+     * <p>
+     * Default is {@link #DFLT_USE_OPTIMIZED_SERIALIZER}.
+     *
+     * @return Flag value.
+     */
+    public boolean isUseOptimizedSerializer() {
+        return useOptimizedSerializer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
index 094689c..27478e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
@@ -48,7 +48,7 @@ import org.jetbrains.annotations.*;
  * Gridgain provides the following {@code GridDeploymentSpi} implementations:
  * <ul>
  * <li>{@link org.apache.ignite.spi.deployment.local.LocalDeploymentSpi}</li>
- * <li>{@ignitelink org.apache.ignite.spi.deployment.uri.GridUriDeploymentSpi}</li>
+ * <li>{@ignitelink org.apache.ignite.spi.deployment.uri.IgniteUriDeploymentSpi}</li>
  * </ul>
  * <b>NOTE:</b> this SPI (i.e. methods in this interface) should never be used directly. SPIs provide
  * internal view on the subsystem and is used internally by GridGain kernal. In rare use cases when

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java
index 12b5105..9227ae9 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java
@@ -28,7 +28,7 @@ import java.util.*;
 /**
  * Grid cache transaction. Cache transactions have a default 2PC (two-phase-commit) behavior and
  * can be plugged into ongoing {@code JTA} transaction by properly implementing
- * {@ignitelink org.apache.ignite.cache.jta.GridCacheTmLookup}
+ * {@ignitelink org.apache.ignite.cache.jta.IgniteCacheTmLookup}
  * interface. Cache transactions can also be started explicitly directly from {@link org.apache.ignite.cache.CacheProjection} API
  * via any of the {@code 'CacheProjection.txStart(..)'} methods.
  * <p>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/core/src/test/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/webapp/WEB-INF/web.xml b/modules/core/src/test/webapp/WEB-INF/web.xml
index caff4bd..b572462 100644
--- a/modules/core/src/test/webapp/WEB-INF/web.xml
+++ b/modules/core/src/test/webapp/WEB-INF/web.xml
@@ -25,7 +25,7 @@
 
     <!-- Declare listener for web sessions caching. -->
     <listener>
-        <listener-class>org.apache.ignite.startup.servlet.GridServletContextListenerStartup</listener-class>
+        <listener-class>org.apache.ignite.startup.servlet.IgniteServletContextListenerStartup</listener-class>
     </listener>
 
     <!-- Declare filter for web sessions caching. -->

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStore.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStore.java
deleted file mode 100644
index 048ab0f..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStore.java
+++ /dev/null
@@ -1,593 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.store.hibernate;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.transactions.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.internal.util.tostring.*;
-import org.hibernate.*;
-import org.hibernate.cfg.*;
-import org.jetbrains.annotations.*;
-
-import javax.cache.integration.*;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * {@link CacheStore} implementation backed by Hibernate. This implementation
- * stores objects in underlying database in {@code BLOB} format.
- * <h2 class="header">Configuration</h2>
- * Either {@link #setSessionFactory(SessionFactory)} or
- * {@link #setHibernateConfigurationPath(String)} or
- * {@link #setHibernateProperties(Properties)} should be set.
- * <p>
- * If session factory is provided it should contain
- * {@link GridCacheHibernateBlobStoreEntry} persistent class (via provided
- * mapping file {@code GridCacheHibernateStoreEntry.hbm.xml} or by
- * adding {@link GridCacheHibernateBlobStoreEntry} to annotated classes
- * of session factory.
- * <p>
- * Path to hibernate configuration may be either an URL or a file path or
- * a classpath resource. This configuration file should include provided
- * mapping {@code GridCacheHibernateStoreEntry.hbm.xml} or include annotated
- * class {@link GridCacheHibernateBlobStoreEntry}.
- * <p>
- * If hibernate properties are provided, mapping
- * {@code GridCacheHibernateStoreEntry.hbm.xml} is included automatically.
- *
- * <h2 class="header">Java Example</h2>
- * In this example existing session factory is provided.
- * <pre name="code" class="java">
- *     ...
- *     GridCacheHibernateBlobStore&lt;String, String&gt; store = new GridCacheHibernateBlobStore&lt;String, String&gt;();
- *
- *     store.setSessionFactory(sesFactory);
- *     ...
- * </pre>
- *
- * <h2 class="header">Spring Example (using Spring ORM)</h2>
- * <pre name="code" class="xml">
- *   ...
- *   &lt;bean id=&quot;cache.hibernate.store&quot;
- *       class=&quot;org.apache.ignite.cache.store.hibernate.GridCacheHibernateBlobStore&quot;&gt;
- *       &lt;property name=&quot;sessionFactory&quot;&gt;
- *           &lt;bean class=&quot;org.springframework.orm.hibernate3.LocalSessionFactoryBean&quot;&gt;
- *               &lt;property name=&quot;hibernateProperties&quot;&gt;
- *                   &lt;value&gt;
- *                       connection.url=jdbc:h2:mem:
- *                       show_sql=true
- *                       hbm2ddl.auto=true
- *                       hibernate.dialect=org.hibernate.dialect.H2Dialect
- *                   &lt;/value&gt;
- *               &lt;/property&gt;
- *               &lt;property name=&quot;mappingResources&quot;&gt;
- *                   &lt;list&gt;
- *                       &lt;value&gt;
- *                           org/gridgain/grid/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.hbm.xml
- *                       &lt;/value&gt;
- *                   &lt;/list&gt;
- *               &lt;/property&gt;
- *           &lt;/bean&gt;
- *       &lt;/property&gt;
- *   &lt;/bean&gt;
- *   ...
- * </pre>
- *
- * <h2 class="header">Spring Example (using Spring ORM and persistent annotations)</h2>
- * <pre name="code" class="xml">
- *     ...
- *     &lt;bean id=&quot;cache.hibernate.store1&quot;
- *         class=&quot;org.apache.ignite.cache.store.hibernate.GridCacheHibernateBlobStore&quot;&gt;
- *         &lt;property name=&quot;sessionFactory&quot;&gt;
- *             &lt;bean class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
- *                 &lt;property name=&quot;hibernateProperties&quot;&gt;
- *                     &lt;value&gt;
- *                         connection.url=jdbc:h2:mem:
- *                         show_sql=true
- *                         hbm2ddl.auto=true
- *                         hibernate.dialect=org.hibernate.dialect.H2Dialect
- *                     &lt;/value&gt;
- *                 &lt;/property&gt;
- *                 &lt;property name=&quot;annotatedClasses&quot;&gt;
- *                     &lt;list&gt;
- *                         &lt;value&gt;
- *                             org.apache.ignite.cache.store.hibernate.GridCacheHibernateBlobStoreEntry
- *                         &lt;/value&gt;
- *                     &lt;/list&gt;
- *                 &lt;/property&gt;
- *             &lt;/bean&gt;
- *         &lt;/property&gt;
- *     &lt;/bean&gt;
- *     ...
- * </pre>
- *
- * <h2 class="header">Spring Example</h2>
- * <pre name="code" class="xml">
- *     ...
- *     &lt;bean id=&quot;cache.hibernate.store2&quot;
- *         class=&quot;org.apache.ignite.cache.store.hibernate.GridCacheHibernateBlobStore&quot;&gt;
- *         &lt;property name=&quot;hibernateProperties&quot;&gt;
- *             &lt;props&gt;
- *                 &lt;prop key=&quot;connection.url&quot;&gt;jdbc:h2:mem:&lt;/prop&gt;
- *                 &lt;prop key=&quot;hbm2ddl.auto&quot;&gt;update&lt;/prop&gt;
- *                 &lt;prop key=&quot;show_sql&quot;&gt;true&lt;/prop&gt;
- *             &lt;/props&gt;
- *         &lt;/property&gt;
- *     &lt;/bean&gt;
- *     ...
- * </pre>
- * <p>
- * <img src="http://www.gridgain.com/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- */
-public class GridCacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
-    /**
-     * Default connection URL
-     * (value is <tt>jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;DEFAULT_LOCK_TIMEOUT=5000</tt>).
-     */
-    public static final String DFLT_CONN_URL = "jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;" +
-        "DEFAULT_LOCK_TIMEOUT=5000";
-
-    /** Default show SQL property value (value is <tt>true</tt>). */
-    public static final String DFLT_SHOW_SQL = "true";
-
-    /** Default <tt>hibernate.hbm2ddl.auto</tt> property value (value is <tt>true</tt>). */
-    public static final String DFLT_HBM2DDL_AUTO = "update";
-
-    /** Session attribute name. */
-    private static final String ATTR_SES = "HIBERNATE_STORE_SESSION";
-
-    /** Name of Hibarname mapping resource. */
-    private static final String MAPPING_RESOURCE =
-        "org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.hbm.xml";
-
-    /** Init guard. */
-    @GridToStringExclude
-    private final AtomicBoolean initGuard = new AtomicBoolean();
-
-    /** Init latch. */
-    @GridToStringExclude
-    private final CountDownLatch initLatch = new CountDownLatch(1);
-
-    /** Hibernate properties. */
-    @GridToStringExclude
-    private Properties hibernateProps;
-
-    /** Session factory. */
-    @GridToStringExclude
-    private SessionFactory sesFactory;
-
-    /** Path to hibernate configuration file. */
-    private String hibernateCfgPath;
-
-    /** Log. */
-    @IgniteLoggerResource
-    private IgniteLogger log;
-
-    /** Ignite instance. */
-    @IgniteInstanceResource
-    private Ignite ignite;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked", "RedundantTypeArguments"})
-    @Override public V load(K key) {
-        init();
-
-        IgniteTx tx = transaction();
-
-        if (log.isDebugEnabled())
-            log.debug("Store load [key=" + key + ", tx=" + tx + ']');
-
-        Session ses = session(tx);
-
-        try {
-            GridCacheHibernateBlobStoreEntry entry = (GridCacheHibernateBlobStoreEntry)
-                ses.get(GridCacheHibernateBlobStoreEntry.class, toBytes(key));
-
-            if (entry == null)
-                return null;
-
-            return fromBytes(entry.getValue());
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheLoaderException("Failed to load value from cache store with key: " + key, e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void write(javax.cache.Cache.Entry<? extends K, ? extends V> entry) {
-        init();
-
-        IgniteTx tx = transaction();
-
-        K key = entry.getKey();
-        V val = entry.getValue();
-
-        if (log.isDebugEnabled())
-            log.debug("Store put [key=" + key + ", val=" + val + ", tx=" + tx + ']');
-
-        if (val == null) {
-            delete(key);
-
-            return;
-        }
-
-        Session ses = session(tx);
-
-        try {
-            GridCacheHibernateBlobStoreEntry entry0 = new GridCacheHibernateBlobStoreEntry(toBytes(key), toBytes(val));
-
-            ses.saveOrUpdate(entry0);
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"JpaQueryApiInspection", "JpaQlInspection"})
-    @Override public void delete(Object key) {
-        init();
-
-        IgniteTx tx = transaction();
-
-        if (log.isDebugEnabled())
-            log.debug("Store remove [key=" + key + ", tx=" + tx + ']');
-
-        Session ses = session(tx);
-
-        try {
-            Object obj = ses.get(GridCacheHibernateBlobStoreEntry.class, toBytes(key));
-
-            if (obj != null)
-                ses.delete(obj);
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheWriterException("Failed to remove value from cache store with key: " + key, e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /**
-     * Rolls back hibernate session.
-     *
-     * @param ses Hibernate session.
-     * @param tx Cache ongoing transaction.
-     */
-    private void rollback(SharedSessionContract ses, IgniteTx tx) {
-        // Rollback only if there is no cache transaction,
-        // otherwise txEnd() will do all required work.
-        if (tx == null) {
-            Transaction hTx = ses.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.rollback();
-        }
-    }
-
-    /**
-     * Ends hibernate session.
-     *
-     * @param ses Hibernate session.
-     * @param tx Cache ongoing transaction.
-     */
-    private void end(Session ses, IgniteTx tx) {
-        // Commit only if there is no cache transaction,
-        // otherwise txEnd() will do all required work.
-        if (tx == null) {
-            Transaction hTx = ses.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.commit();
-
-            ses.close();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void txEnd(boolean commit) {
-        init();
-
-        IgniteTx tx = transaction();
-
-        Map<String, Session> props = session().properties();
-
-        Session ses = props.remove(ATTR_SES);
-
-        if (ses != null) {
-            Transaction hTx = ses.getTransaction();
-
-            if (hTx != null) {
-                try {
-                    if (commit) {
-                        ses.flush();
-
-                        hTx.commit();
-                    }
-                    else
-                        hTx.rollback();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
-                }
-                catch (HibernateException e) {
-                    throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() +
-                        ", commit=" + commit + ']', e);
-                }
-                finally {
-                    ses.close();
-                }
-            }
-        }
-    }
-
-    /**
-     * Gets Hibernate session.
-     *
-     * @param tx Cache transaction.
-     * @return Session.
-     */
-    Session session(@Nullable IgniteTx tx) {
-        Session ses;
-
-        if (tx != null) {
-            Map<String, Session> props = session().properties();
-
-            ses = props.get(ATTR_SES);
-
-            if (ses == null) {
-                ses = sesFactory.openSession();
-
-                ses.beginTransaction();
-
-                // Store session in transaction metadata, so it can be accessed
-                // for other operations on the same transaction.
-                props.put(ATTR_SES, ses);
-
-                if (log.isDebugEnabled())
-                    log.debug("Hibernate session open [ses=" + ses + ", tx=" + tx.xid() + "]");
-            }
-        }
-        else {
-            ses = sesFactory.openSession();
-
-            ses.beginTransaction();
-        }
-
-        return ses;
-    }
-
-    /**
-     * Sets session factory.
-     *
-     * @param sesFactory Session factory.
-     */
-    public void setSessionFactory(SessionFactory sesFactory) {
-        this.sesFactory = sesFactory;
-    }
-
-    /**
-     * Sets hibernate configuration path.
-     * <p>
-     * This may be either URL or file path or classpath resource.
-     *
-     * @param hibernateCfgPath URL or file path or classpath resource
-     *      pointing to hibernate configuration XML file.
-     */
-    public void setHibernateConfigurationPath(String hibernateCfgPath) {
-        this.hibernateCfgPath = hibernateCfgPath;
-    }
-
-    /**
-     * Sets Hibernate properties.
-     *
-     * @param hibernateProps Hibernate properties.
-     */
-    public void setHibernateProperties(Properties hibernateProps) {
-        this.hibernateProps = hibernateProps;
-    }
-
-    /**
-     * Initializes store.
-     *
-     * @throws IgniteException If failed to initialize.
-     */
-    private void init() throws IgniteException {
-        if (initGuard.compareAndSet(false, true)) {
-            if (log.isDebugEnabled())
-                log.debug("Initializing cache store.");
-
-            try {
-                if (sesFactory != null)
-                    // Session factory has been provided - nothing to do.
-                    return;
-
-                if (!F.isEmpty(hibernateCfgPath)) {
-                    try {
-                        URL url = new URL(hibernateCfgPath);
-
-                        sesFactory = new Configuration().configure(url).buildSessionFactory();
-
-                        if (log.isDebugEnabled())
-                            log.debug("Configured session factory using URL: " + url);
-
-                        // Session factory has been successfully initialized.
-                        return;
-                    }
-                    catch (MalformedURLException e) {
-                        if (log.isDebugEnabled())
-                            log.debug("Caught malformed URL exception: " + e.getMessage());
-                    }
-
-                    // Provided path is not a valid URL. File?
-                    File cfgFile = new File(hibernateCfgPath);
-
-                    if (cfgFile.exists()) {
-                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
-
-                        if (log.isDebugEnabled())
-                            log.debug("Configured session factory using file: " + hibernateCfgPath);
-
-                        // Session factory has been successfully initialized.
-                        return;
-                    }
-
-                    // Provided path is not a file. Classpath resource?
-                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Configured session factory using classpath resource: " + hibernateCfgPath);
-                }
-                else {
-                    if (hibernateProps == null) {
-                        U.warn(log, "No Hibernate configuration has been provided for store (will use default).");
-
-                        hibernateProps = new Properties();
-
-                        hibernateProps.setProperty("hibernate.connection.url", DFLT_CONN_URL);
-                        hibernateProps.setProperty("hibernate.show_sql", DFLT_SHOW_SQL);
-                        hibernateProps.setProperty("hibernate.hbm2ddl.auto", DFLT_HBM2DDL_AUTO);
-                    }
-
-                    Configuration cfg = new Configuration();
-
-                    cfg.setProperties(hibernateProps);
-
-                    assert resourceAvailable(MAPPING_RESOURCE) : MAPPING_RESOURCE;
-
-                    cfg.addResource(MAPPING_RESOURCE);
-
-                    sesFactory = cfg.buildSessionFactory();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Configured session factory using properties: " + hibernateProps);
-                }
-            }
-            catch (HibernateException e) {
-                throw new IgniteException("Failed to initialize store.", e);
-            }
-            finally {
-                initLatch.countDown();
-            }
-        }
-        else if (initLatch.getCount() > 0) {
-            try {
-                U.await(initLatch);
-            }
-            catch (IgniteInterruptedException e) {
-                throw new IgniteException(e);
-            }
-        }
-
-        if (sesFactory == null)
-            throw new IgniteException("Cache store was not properly initialized.");
-    }
-
-    /**
-     * Checks availability of a classpath resource.
-     *
-     * @param name Resource name.
-     * @return {@code true} if resource is available and ready for read, {@code false} otherwise.
-     */
-    private boolean resourceAvailable(String name) {
-        InputStream cfgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
-
-        if (cfgStream == null) {
-            log.error("Classpath resource not found: " + name);
-
-            return false;
-        }
-
-        try {
-            // Read a single byte to force actual content access by JVM.
-            cfgStream.read();
-
-            return true;
-        }
-        catch (IOException e) {
-            log.error("Failed to read classpath resource: " + name, e);
-
-            return false;
-        }
-        finally {
-            U.close(cfgStream, log);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridCacheHibernateBlobStore.class, this);
-    }
-
-    /**
-     * Serialize object to byte array using marshaller.
-     *
-     * @param obj Object to convert to byte array.
-     * @return Byte array.
-     * @throws IgniteCheckedException If failed to convert.
-     */
-    protected byte[] toBytes(Object obj) throws IgniteCheckedException {
-        return ignite.configuration().getMarshaller().marshal(obj);
-    }
-
-    /**
-     * Deserialize object from byte array using marshaller.
-     *
-     * @param bytes Bytes to deserialize.
-     * @param <X> Result object type.
-     * @return Deserialized object.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException {
-        if (bytes == null || bytes.length == 0)
-            return null;
-
-        return ignite.configuration().getMarshaller().unmarshal(bytes, getClass().getClassLoader());
-    }
-
-    /**
-     * @return Current transaction.
-     */
-    @Nullable private IgniteTx transaction() {
-        CacheStoreSession ses = session();
-
-        return ses != null ? ses.transaction() : null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.hbm.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.hbm.xml b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.hbm.xml
deleted file mode 100644
index 04af9e3..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.hbm.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<!DOCTYPE hibernate-mapping PUBLIC
-        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.gridgain.examples.datagrid.store" default-access="field">
-    <class name="org.apache.ignite.cache.store.hibernate.GridCacheHibernateBlobStoreEntry" table="ENTRIES">
-        <id name="key"/>
-
-        <property name="val"/>
-    </class>
-</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.java
deleted file mode 100644
index 5d49770..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreEntry.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.store.hibernate;
-
-import javax.persistence.*;
-
-/**
- * Entry that is used by {@link GridCacheHibernateBlobStore} implementation.
- * <p>
- * Note that this is a reference implementation for tests only.
- * When running on production systems use concrete key-value types to
- * get better performance.
- */
-@Entity
-@Table(name = "ENTRIES")
-public class GridCacheHibernateBlobStoreEntry {
-    /** Key (use concrete key type in production). */
-    @Id
-    @Column(length = 65535)
-    private byte[] key;
-
-    /** Value (use concrete value type in production). */
-    @Column(length = 65535)
-    private byte[] val;
-
-    /**
-     * Constructor.
-     */
-    GridCacheHibernateBlobStoreEntry() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param key Key.
-     * @param val Value.
-     */
-    GridCacheHibernateBlobStoreEntry(byte[] key, byte[] val) {
-        this.key = key;
-        this.val = val;
-    }
-
-    /**
-     * @return Key.
-     */
-    public byte[] getKey() {
-        return key;
-    }
-
-    /**
-     * @param key Key.
-     */
-    public void setKey(byte[] key) {
-        this.key = key;
-    }
-
-    /**
-     * @return Value.
-     */
-    public byte[] getValue() {
-        return val;
-    }
-
-    /**
-     * @param val Value.
-     */
-    public void setValue(byte[] val) {
-        this.val = val;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStore.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStore.java
new file mode 100644
index 0000000..4a8f985
--- /dev/null
+++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStore.java
@@ -0,0 +1,593 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.store.hibernate;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.resources.*;
+import org.apache.ignite.transactions.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.hibernate.*;
+import org.hibernate.cfg.*;
+import org.jetbrains.annotations.*;
+
+import javax.cache.integration.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * {@link CacheStore} implementation backed by Hibernate. This implementation
+ * stores objects in underlying database in {@code BLOB} format.
+ * <h2 class="header">Configuration</h2>
+ * Either {@link #setSessionFactory(SessionFactory)} or
+ * {@link #setHibernateConfigurationPath(String)} or
+ * {@link #setHibernateProperties(Properties)} should be set.
+ * <p>
+ * If session factory is provided it should contain
+ * {@link IgniteCacheHibernateBlobStoreEntry} persistent class (via provided
+ * mapping file {@code GridCacheHibernateStoreEntry.hbm.xml} or by
+ * adding {@link IgniteCacheHibernateBlobStoreEntry} to annotated classes
+ * of session factory.
+ * <p>
+ * Path to hibernate configuration may be either an URL or a file path or
+ * a classpath resource. This configuration file should include provided
+ * mapping {@code GridCacheHibernateStoreEntry.hbm.xml} or include annotated
+ * class {@link IgniteCacheHibernateBlobStoreEntry}.
+ * <p>
+ * If hibernate properties are provided, mapping
+ * {@code GridCacheHibernateStoreEntry.hbm.xml} is included automatically.
+ *
+ * <h2 class="header">Java Example</h2>
+ * In this example existing session factory is provided.
+ * <pre name="code" class="java">
+ *     ...
+ *     IgniteCacheHibernateBlobStore&lt;String, String&gt; store = new IgniteCacheHibernateBlobStore&lt;String, String&gt;();
+ *
+ *     store.setSessionFactory(sesFactory);
+ *     ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example (using Spring ORM)</h2>
+ * <pre name="code" class="xml">
+ *   ...
+ *   &lt;bean id=&quot;cache.hibernate.store&quot;
+ *       class=&quot;org.apache.ignite.cache.store.hibernate.IgniteCacheHibernateBlobStore&quot;&gt;
+ *       &lt;property name=&quot;sessionFactory&quot;&gt;
+ *           &lt;bean class=&quot;org.springframework.orm.hibernate3.LocalSessionFactoryBean&quot;&gt;
+ *               &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *                   &lt;value&gt;
+ *                       connection.url=jdbc:h2:mem:
+ *                       show_sql=true
+ *                       hbm2ddl.auto=true
+ *                       hibernate.dialect=org.hibernate.dialect.H2Dialect
+ *                   &lt;/value&gt;
+ *               &lt;/property&gt;
+ *               &lt;property name=&quot;mappingResources&quot;&gt;
+ *                   &lt;list&gt;
+ *                       &lt;value&gt;
+ *                           org/gridgain/grid/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.hbm.xml
+ *                       &lt;/value&gt;
+ *                   &lt;/list&gt;
+ *               &lt;/property&gt;
+ *           &lt;/bean&gt;
+ *       &lt;/property&gt;
+ *   &lt;/bean&gt;
+ *   ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example (using Spring ORM and persistent annotations)</h2>
+ * <pre name="code" class="xml">
+ *     ...
+ *     &lt;bean id=&quot;cache.hibernate.store1&quot;
+ *         class=&quot;org.apache.ignite.cache.store.hibernate.IgniteCacheHibernateBlobStore&quot;&gt;
+ *         &lt;property name=&quot;sessionFactory&quot;&gt;
+ *             &lt;bean class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
+ *                 &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *                     &lt;value&gt;
+ *                         connection.url=jdbc:h2:mem:
+ *                         show_sql=true
+ *                         hbm2ddl.auto=true
+ *                         hibernate.dialect=org.hibernate.dialect.H2Dialect
+ *                     &lt;/value&gt;
+ *                 &lt;/property&gt;
+ *                 &lt;property name=&quot;annotatedClasses&quot;&gt;
+ *                     &lt;list&gt;
+ *                         &lt;value&gt;
+ *                             org.apache.ignite.cache.store.hibernate.IgniteCacheHibernateBlobStoreEntry
+ *                         &lt;/value&gt;
+ *                     &lt;/list&gt;
+ *                 &lt;/property&gt;
+ *             &lt;/bean&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ *     ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example</h2>
+ * <pre name="code" class="xml">
+ *     ...
+ *     &lt;bean id=&quot;cache.hibernate.store2&quot;
+ *         class=&quot;org.apache.ignite.cache.store.hibernate.IgniteCacheHibernateBlobStore&quot;&gt;
+ *         &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *             &lt;props&gt;
+ *                 &lt;prop key=&quot;connection.url&quot;&gt;jdbc:h2:mem:&lt;/prop&gt;
+ *                 &lt;prop key=&quot;hbm2ddl.auto&quot;&gt;update&lt;/prop&gt;
+ *                 &lt;prop key=&quot;show_sql&quot;&gt;true&lt;/prop&gt;
+ *             &lt;/props&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ *     ...
+ * </pre>
+ * <p>
+ * <img src="http://www.gridgain.com/images/spring-small.png">
+ * <br>
+ * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ */
+public class IgniteCacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
+    /**
+     * Default connection URL
+     * (value is <tt>jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;DEFAULT_LOCK_TIMEOUT=5000</tt>).
+     */
+    public static final String DFLT_CONN_URL = "jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;" +
+        "DEFAULT_LOCK_TIMEOUT=5000";
+
+    /** Default show SQL property value (value is <tt>true</tt>). */
+    public static final String DFLT_SHOW_SQL = "true";
+
+    /** Default <tt>hibernate.hbm2ddl.auto</tt> property value (value is <tt>true</tt>). */
+    public static final String DFLT_HBM2DDL_AUTO = "update";
+
+    /** Session attribute name. */
+    private static final String ATTR_SES = "HIBERNATE_STORE_SESSION";
+
+    /** Name of Hibarname mapping resource. */
+    private static final String MAPPING_RESOURCE =
+            "org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.hbm.xml";
+
+    /** Init guard. */
+    @GridToStringExclude
+    private final AtomicBoolean initGuard = new AtomicBoolean();
+
+    /** Init latch. */
+    @GridToStringExclude
+    private final CountDownLatch initLatch = new CountDownLatch(1);
+
+    /** Hibernate properties. */
+    @GridToStringExclude
+    private Properties hibernateProps;
+
+    /** Session factory. */
+    @GridToStringExclude
+    private SessionFactory sesFactory;
+
+    /** Path to hibernate configuration file. */
+    private String hibernateCfgPath;
+
+    /** Log. */
+    @IgniteLoggerResource
+    private IgniteLogger log;
+
+    /** Ignite instance. */
+    @IgniteInstanceResource
+    private Ignite ignite;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"unchecked", "RedundantTypeArguments"})
+    @Override public V load(K key) {
+        init();
+
+        IgniteTx tx = transaction();
+
+        if (log.isDebugEnabled())
+            log.debug("Store load [key=" + key + ", tx=" + tx + ']');
+
+        Session ses = session(tx);
+
+        try {
+            IgniteCacheHibernateBlobStoreEntry entry = (IgniteCacheHibernateBlobStoreEntry)
+                ses.get(IgniteCacheHibernateBlobStoreEntry.class, toBytes(key));
+
+            if (entry == null)
+                return null;
+
+            return fromBytes(entry.getValue());
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheLoaderException("Failed to load value from cache store with key: " + key, e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(javax.cache.Cache.Entry<? extends K, ? extends V> entry) {
+        init();
+
+        IgniteTx tx = transaction();
+
+        K key = entry.getKey();
+        V val = entry.getValue();
+
+        if (log.isDebugEnabled())
+            log.debug("Store put [key=" + key + ", val=" + val + ", tx=" + tx + ']');
+
+        if (val == null) {
+            delete(key);
+
+            return;
+        }
+
+        Session ses = session(tx);
+
+        try {
+            IgniteCacheHibernateBlobStoreEntry entry0 = new IgniteCacheHibernateBlobStoreEntry(toBytes(key), toBytes(val));
+
+            ses.saveOrUpdate(entry0);
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"JpaQueryApiInspection", "JpaQlInspection"})
+    @Override public void delete(Object key) {
+        init();
+
+        IgniteTx tx = transaction();
+
+        if (log.isDebugEnabled())
+            log.debug("Store remove [key=" + key + ", tx=" + tx + ']');
+
+        Session ses = session(tx);
+
+        try {
+            Object obj = ses.get(IgniteCacheHibernateBlobStoreEntry.class, toBytes(key));
+
+            if (obj != null)
+                ses.delete(obj);
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheWriterException("Failed to remove value from cache store with key: " + key, e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /**
+     * Rolls back hibernate session.
+     *
+     * @param ses Hibernate session.
+     * @param tx Cache ongoing transaction.
+     */
+    private void rollback(SharedSessionContract ses, IgniteTx tx) {
+        // Rollback only if there is no cache transaction,
+        // otherwise txEnd() will do all required work.
+        if (tx == null) {
+            Transaction hTx = ses.getTransaction();
+
+            if (hTx != null && hTx.isActive())
+                hTx.rollback();
+        }
+    }
+
+    /**
+     * Ends hibernate session.
+     *
+     * @param ses Hibernate session.
+     * @param tx Cache ongoing transaction.
+     */
+    private void end(Session ses, IgniteTx tx) {
+        // Commit only if there is no cache transaction,
+        // otherwise txEnd() will do all required work.
+        if (tx == null) {
+            Transaction hTx = ses.getTransaction();
+
+            if (hTx != null && hTx.isActive())
+                hTx.commit();
+
+            ses.close();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void txEnd(boolean commit) {
+        init();
+
+        IgniteTx tx = transaction();
+
+        Map<String, Session> props = session().properties();
+
+        Session ses = props.remove(ATTR_SES);
+
+        if (ses != null) {
+            Transaction hTx = ses.getTransaction();
+
+            if (hTx != null) {
+                try {
+                    if (commit) {
+                        ses.flush();
+
+                        hTx.commit();
+                    }
+                    else
+                        hTx.rollback();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
+                }
+                catch (HibernateException e) {
+                    throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() +
+                        ", commit=" + commit + ']', e);
+                }
+                finally {
+                    ses.close();
+                }
+            }
+        }
+    }
+
+    /**
+     * Gets Hibernate session.
+     *
+     * @param tx Cache transaction.
+     * @return Session.
+     */
+    Session session(@Nullable IgniteTx tx) {
+        Session ses;
+
+        if (tx != null) {
+            Map<String, Session> props = session().properties();
+
+            ses = props.get(ATTR_SES);
+
+            if (ses == null) {
+                ses = sesFactory.openSession();
+
+                ses.beginTransaction();
+
+                // Store session in transaction metadata, so it can be accessed
+                // for other operations on the same transaction.
+                props.put(ATTR_SES, ses);
+
+                if (log.isDebugEnabled())
+                    log.debug("Hibernate session open [ses=" + ses + ", tx=" + tx.xid() + "]");
+            }
+        }
+        else {
+            ses = sesFactory.openSession();
+
+            ses.beginTransaction();
+        }
+
+        return ses;
+    }
+
+    /**
+     * Sets session factory.
+     *
+     * @param sesFactory Session factory.
+     */
+    public void setSessionFactory(SessionFactory sesFactory) {
+        this.sesFactory = sesFactory;
+    }
+
+    /**
+     * Sets hibernate configuration path.
+     * <p>
+     * This may be either URL or file path or classpath resource.
+     *
+     * @param hibernateCfgPath URL or file path or classpath resource
+     *      pointing to hibernate configuration XML file.
+     */
+    public void setHibernateConfigurationPath(String hibernateCfgPath) {
+        this.hibernateCfgPath = hibernateCfgPath;
+    }
+
+    /**
+     * Sets Hibernate properties.
+     *
+     * @param hibernateProps Hibernate properties.
+     */
+    public void setHibernateProperties(Properties hibernateProps) {
+        this.hibernateProps = hibernateProps;
+    }
+
+    /**
+     * Initializes store.
+     *
+     * @throws IgniteException If failed to initialize.
+     */
+    private void init() throws IgniteException {
+        if (initGuard.compareAndSet(false, true)) {
+            if (log.isDebugEnabled())
+                log.debug("Initializing cache store.");
+
+            try {
+                if (sesFactory != null)
+                    // Session factory has been provided - nothing to do.
+                    return;
+
+                if (!F.isEmpty(hibernateCfgPath)) {
+                    try {
+                        URL url = new URL(hibernateCfgPath);
+
+                        sesFactory = new Configuration().configure(url).buildSessionFactory();
+
+                        if (log.isDebugEnabled())
+                            log.debug("Configured session factory using URL: " + url);
+
+                        // Session factory has been successfully initialized.
+                        return;
+                    }
+                    catch (MalformedURLException e) {
+                        if (log.isDebugEnabled())
+                            log.debug("Caught malformed URL exception: " + e.getMessage());
+                    }
+
+                    // Provided path is not a valid URL. File?
+                    File cfgFile = new File(hibernateCfgPath);
+
+                    if (cfgFile.exists()) {
+                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
+
+                        if (log.isDebugEnabled())
+                            log.debug("Configured session factory using file: " + hibernateCfgPath);
+
+                        // Session factory has been successfully initialized.
+                        return;
+                    }
+
+                    // Provided path is not a file. Classpath resource?
+                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Configured session factory using classpath resource: " + hibernateCfgPath);
+                }
+                else {
+                    if (hibernateProps == null) {
+                        U.warn(log, "No Hibernate configuration has been provided for store (will use default).");
+
+                        hibernateProps = new Properties();
+
+                        hibernateProps.setProperty("hibernate.connection.url", DFLT_CONN_URL);
+                        hibernateProps.setProperty("hibernate.show_sql", DFLT_SHOW_SQL);
+                        hibernateProps.setProperty("hibernate.hbm2ddl.auto", DFLT_HBM2DDL_AUTO);
+                    }
+
+                    Configuration cfg = new Configuration();
+
+                    cfg.setProperties(hibernateProps);
+
+                    assert resourceAvailable(MAPPING_RESOURCE) : MAPPING_RESOURCE;
+
+                    cfg.addResource(MAPPING_RESOURCE);
+
+                    sesFactory = cfg.buildSessionFactory();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Configured session factory using properties: " + hibernateProps);
+                }
+            }
+            catch (HibernateException e) {
+                throw new IgniteException("Failed to initialize store.", e);
+            }
+            finally {
+                initLatch.countDown();
+            }
+        }
+        else if (initLatch.getCount() > 0) {
+            try {
+                U.await(initLatch);
+            }
+            catch (IgniteInterruptedException e) {
+                throw new IgniteException(e);
+            }
+        }
+
+        if (sesFactory == null)
+            throw new IgniteException("Cache store was not properly initialized.");
+    }
+
+    /**
+     * Checks availability of a classpath resource.
+     *
+     * @param name Resource name.
+     * @return {@code true} if resource is available and ready for read, {@code false} otherwise.
+     */
+    private boolean resourceAvailable(String name) {
+        InputStream cfgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
+
+        if (cfgStream == null) {
+            log.error("Classpath resource not found: " + name);
+
+            return false;
+        }
+
+        try {
+            // Read a single byte to force actual content access by JVM.
+            cfgStream.read();
+
+            return true;
+        }
+        catch (IOException e) {
+            log.error("Failed to read classpath resource: " + name, e);
+
+            return false;
+        }
+        finally {
+            U.close(cfgStream, log);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IgniteCacheHibernateBlobStore.class, this);
+    }
+
+    /**
+     * Serialize object to byte array using marshaller.
+     *
+     * @param obj Object to convert to byte array.
+     * @return Byte array.
+     * @throws IgniteCheckedException If failed to convert.
+     */
+    protected byte[] toBytes(Object obj) throws IgniteCheckedException {
+        return ignite.configuration().getMarshaller().marshal(obj);
+    }
+
+    /**
+     * Deserialize object from byte array using marshaller.
+     *
+     * @param bytes Bytes to deserialize.
+     * @param <X> Result object type.
+     * @return Deserialized object.
+     * @throws IgniteCheckedException If failed.
+     */
+    protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException {
+        if (bytes == null || bytes.length == 0)
+            return null;
+
+        return ignite.configuration().getMarshaller().unmarshal(bytes, getClass().getClassLoader());
+    }
+
+    /**
+     * @return Current transaction.
+     */
+    @Nullable private IgniteTx transaction() {
+        CacheStoreSession ses = session();
+
+        return ses != null ? ses.transaction() : null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.hbm.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.hbm.xml b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.hbm.xml
new file mode 100644
index 0000000..8c247e0
--- /dev/null
+++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.hbm.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.gridgain.examples.datagrid.store" default-access="field">
+    <class name="org.apache.ignite.cache.store.hibernate.IgniteCacheHibernateBlobStoreEntry" table="ENTRIES">
+        <id name="key"/>
+
+        <property name="val"/>
+    </class>
+</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.java
new file mode 100644
index 0000000..7f563c1
--- /dev/null
+++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/IgniteCacheHibernateBlobStoreEntry.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.store.hibernate;
+
+import javax.persistence.*;
+
+/**
+ * Entry that is used by {@link IgniteCacheHibernateBlobStore} implementation.
+ * <p>
+ * Note that this is a reference implementation for tests only.
+ * When running on production systems use concrete key-value types to
+ * get better performance.
+ */
+@Entity
+@Table(name = "ENTRIES")
+public class IgniteCacheHibernateBlobStoreEntry {
+    /** Key (use concrete key type in production). */
+    @Id
+    @Column(length = 65535)
+    private byte[] key;
+
+    /** Value (use concrete value type in production). */
+    @Column(length = 65535)
+    private byte[] val;
+
+    /**
+     * Constructor.
+     */
+    IgniteCacheHibernateBlobStoreEntry() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param key Key.
+     * @param val Value.
+     */
+    IgniteCacheHibernateBlobStoreEntry(byte[] key, byte[] val) {
+        this.key = key;
+        this.val = val;
+    }
+
+    /**
+     * @return Key.
+     */
+    public byte[] getKey() {
+        return key;
+    }
+
+    /**
+     * @param key Key.
+     */
+    public void setKey(byte[] key) {
+        this.key = key;
+    }
+
+    /**
+     * @return Value.
+     */
+    public byte[] getValue() {
+        return val;
+    }
+
+    /**
+     * @param val Value.
+     */
+    public void setValue(byte[] val) {
+        this.val = val;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/GridHibernateL2CacheTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/GridHibernateL2CacheTransactionalSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/GridHibernateL2CacheTransactionalSelfTest.java
index 83606e9..c149315 100644
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/GridHibernateL2CacheTransactionalSelfTest.java
+++ b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/GridHibernateL2CacheTransactionalSelfTest.java
@@ -62,7 +62,7 @@ public class GridHibernateL2CacheTransactionalSelfTest extends GridHibernateL2Ca
     /**
      */
     @SuppressWarnings("PublicInnerClass")
-    public static class TestTmLookup implements GridCacheTmLookup {
+    public static class TestTmLookup implements IgniteCacheTmLookup {
         /** {@inheritDoc} */
         @Override public TransactionManager getTm() throws IgniteCheckedException {
             return jotm.getTransactionManager();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c0fcf3c/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreSelfTest.java
deleted file mode 100644
index f4aa804..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/GridCacheHibernateBlobStoreSelfTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.store.hibernate;
-
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.testframework.junits.cache.*;
-import org.hibernate.*;
-
-import java.io.*;
-import java.net.*;
-
-/**
- * Cache store test.
- */
-public class GridCacheHibernateBlobStoreSelfTest extends
-    GridAbstractCacheStoreSelfTest<GridCacheHibernateBlobStore<Object, Object>> {
-    /**
-     * @throws Exception If failed.
-     */
-    public GridCacheHibernateBlobStoreSelfTest() throws Exception {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        Session s = store.session(null);
-
-        if (s == null)
-            return;
-
-        try {
-            s.createQuery("delete from " + GridCacheHibernateBlobStoreEntry.class.getSimpleName())
-                    .setFlushMode(FlushMode.ALWAYS).executeUpdate();
-
-            Transaction hTx = s.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.commit();
-        }
-        finally {
-            s.close();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridCacheHibernateBlobStore<Object, Object> store() {
-        return new GridCacheHibernateBlobStore<>();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByUrl() throws Exception {
-        URL url = U.resolveGridGainUrl(
-            "modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        assert url != null;
-
-        store.setHibernateConfigurationPath(url.toString());
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByFile() throws Exception {
-        URL url = U.resolveGridGainUrl(
-            "modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        assert url != null;
-
-        File file = new File(url.toURI());
-
-        store.setHibernateConfigurationPath(file.getAbsolutePath());
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByResource() throws Exception {
-        store.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-}


Mime
View raw message