ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/42] incubator-ignite git commit: ignite-757 - Cache object value message
Date Wed, 29 Apr 2015 14:28:21 GMT
ignite-757 - Cache object value message


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

Branch: refs/heads/ignite-286
Commit: 8a295e3b06545b13b0a651de26d86da21bd8a71b
Parents: 5d0e620
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Mon Apr 27 17:08:23 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Mon Apr 27 17:08:23 2015 +0300

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |   1 +
 .../communication/GridIoMessageFactory.java     |   2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  17 ++-
 .../query/h2/opt/GridH2ValueCacheObject.java    |  28 +++--
 .../query/h2/twostep/GridMergeIndex.java        |   4 +-
 .../h2/twostep/GridReduceQueryExecutor.java     |   2 +-
 .../query/h2/twostep/GridResultPage.java        |   6 +-
 .../query/h2/twostep/msg/GridH2Array.java       |   5 +-
 .../query/h2/twostep/msg/GridH2Boolean.java     |   3 +-
 .../query/h2/twostep/msg/GridH2Byte.java        |   3 +-
 .../query/h2/twostep/msg/GridH2Bytes.java       |   3 +-
 .../query/h2/twostep/msg/GridH2CacheObject.java | 115 +++++++++++++++++++
 .../query/h2/twostep/msg/GridH2Date.java        |   3 +-
 .../query/h2/twostep/msg/GridH2Decimal.java     |   3 +-
 .../query/h2/twostep/msg/GridH2Double.java      |   3 +-
 .../query/h2/twostep/msg/GridH2Float.java       |   3 +-
 .../query/h2/twostep/msg/GridH2Geometry.java    |   3 +-
 .../query/h2/twostep/msg/GridH2Integer.java     |   3 +-
 .../query/h2/twostep/msg/GridH2JavaObject.java  |   3 +-
 .../query/h2/twostep/msg/GridH2Long.java        |   3 +-
 .../query/h2/twostep/msg/GridH2Null.java        |  11 +-
 .../query/h2/twostep/msg/GridH2Short.java       |   3 +-
 .../query/h2/twostep/msg/GridH2String.java      |   3 +-
 .../query/h2/twostep/msg/GridH2Time.java        |   3 +-
 .../query/h2/twostep/msg/GridH2Timestamp.java   |   3 +-
 .../query/h2/twostep/msg/GridH2Uuid.java        |   3 +-
 .../h2/twostep/msg/GridH2ValueMessage.java      |   4 +-
 .../twostep/msg/GridH2ValueMessageFactory.java  |  22 ++--
 28 files changed, 210 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
index eef4dd6..e37b4f3 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
@@ -193,6 +193,7 @@ public class MessageCodeGenerator {
 //        gen.generateAndWrite(GridH2JavaObject.class);
 //        gen.generateAndWrite(GridH2Uuid.class);
 //        gen.generateAndWrite(GridH2Geometry.class);
+//        gen.generateAndWrite(GridH2CacheObject.class);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 5b7d84d..a395747 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -602,7 +602,7 @@ public class GridIoMessageFactory implements MessageFactory {
 
             // [-3..112] - this
             // [120..123] - DR
-            // [-4..-21] - SQL
+            // [-4..-22] - SQL
             default:
                 if (ext != null) {
                     for (MessageFactory factory : ext) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 01eb855..9579de3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -406,6 +406,17 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         return ctx.cache().internalCache(space).context().cacheObjectContext();
     }
 
+    /**
+     * @param space Space.
+     * @return Cache object context.
+     */
+    private GridCacheContext cacheContext(String space) {
+        if (ctx == null)
+            return null;
+
+        return ctx.cache().internalCache(space).context();
+    }
+
     /** {@inheritDoc} */
     @Override public void remove(@Nullable String spaceName, CacheObject key, CacheObject
val) throws IgniteCheckedException {
         if (log.isDebugEnabled())
@@ -1969,12 +1980,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             if (obj instanceof CacheObject) { // Handle cache object.
                 CacheObject co = (CacheObject)obj;
 
-                CacheObjectContext coctx = objectContext(schema.spaceName);
-
                 if (type == Value.JAVA_OBJECT)
-                    return new GridH2ValueCacheObject(coctx, co);
+                    return new GridH2ValueCacheObject(cacheContext(schema.spaceName), co);
 
-                obj = co.value(coctx, false);
+                obj = co.value(objectContext(schema.spaceName), false);
             }
 
             switch (type) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
index c2bed03..0a37674 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
@@ -34,17 +34,17 @@ public class GridH2ValueCacheObject extends Value {
     private CacheObject obj;
 
     /** */
-    private CacheObjectContext coctx;
+    private GridCacheContext<?,?> cctx;
 
     /**
-     * @param coctx Cache object context.
+     * @param cctx Cache context.
      * @param obj Object.
      */
-    public GridH2ValueCacheObject(CacheObjectContext coctx, CacheObject obj) {
+    public GridH2ValueCacheObject(GridCacheContext<?,?> cctx, CacheObject obj) {
         assert obj != null;
 
         this.obj = obj;
-        this.coctx = coctx; // Allowed to be null in tests.
+        this.cctx = cctx; // Allowed to be null in tests.
     }
 
     /**
@@ -54,6 +54,13 @@ public class GridH2ValueCacheObject extends Value {
         return obj;
     }
 
+    /**
+     * @return Cache context.
+     */
+    public GridCacheContext<?,?> getCacheContext() {
+        return cctx;
+    }
+
     /** {@inheritDoc} */
     @Override public String getSQL() {
         throw new UnsupportedOperationException();
@@ -84,12 +91,19 @@ public class GridH2ValueCacheObject extends Value {
         return Utils.cloneByteArray(getBytesNoCopy());
     }
 
+    /**
+     * @return Cache object context.
+     */
+    private CacheObjectContext objectContext() {
+        return cctx == null ? null : cctx.cacheObjectContext();
+    }
+
     /** {@inheritDoc} */
     @Override public byte[] getBytesNoCopy() {
         if (obj.type() == CacheObject.TYPE_REGULAR) {
             // Result must be the same as `marshaller.marshall(obj.value(coctx, false));`
             try {
-                return obj.valueBytes(coctx);
+                return obj.valueBytes(objectContext());
             }
             catch (IgniteCheckedException e) {
                 throw DbException.convert(e);
@@ -97,12 +111,12 @@ public class GridH2ValueCacheObject extends Value {
         }
 
         // For portables and byte array cache object types.
-        return Utils.serialize(obj.value(coctx, false), null);
+        return Utils.serialize(obj.value(objectContext(), false), null);
     }
 
     /** {@inheritDoc} */
     @Override public Object getObject() {
-        return obj.value(coctx, false);
+        return obj.value(objectContext(), false);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
index 2b5c895..9136821 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
@@ -96,7 +96,7 @@ public abstract class GridMergeIndex extends BaseIndex {
      * @param nodeId Node ID.
      */
     public void fail(UUID nodeId) {
-        addPage0(new GridResultPage(nodeId, null, false));
+        addPage0(new GridResultPage(null, nodeId, null, false));
     }
 
     /**
@@ -137,7 +137,7 @@ public abstract class GridMergeIndex extends BaseIndex {
             if (last)
                 last = lastSubmitted.compareAndSet(false, true);
 
-            addPage0(new GridResultPage(page.source(), null, last));
+            addPage0(new GridResultPage(null, page.source(), null, last));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index d7832f0..e175a43 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -231,7 +231,7 @@ public class GridReduceQueryExecutor {
         GridResultPage page;
 
         try {
-            page = new GridResultPage(node.id(), msg, false) {
+            page = new GridResultPage(ctx, node.id(), msg, false) {
                 @Override public void fetchNextPage() {
                     if (r.rmtErr != null)
                         throw new CacheException("Next page fetch failed.", r.rmtErr);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
index af1bb4f..0a4b746 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridResultPage.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.query.h2.twostep.messages.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
@@ -46,12 +47,13 @@ public class GridResultPage {
     private Iterator<Value[]> rows;
 
     /**
+     * @param ctx Kernal context.
      * @param src Source.
      * @param res Response.
      * @param last If this is the globally last page.
      */
     @SuppressWarnings("unchecked")
-    public GridResultPage(UUID src, GridQueryNextPageResponse res, boolean last) {
+    public GridResultPage(final GridKernalContext ctx, UUID src, GridQueryNextPageResponse
res, boolean last) {
         assert src != null;
 
         this.src = src;
@@ -91,7 +93,7 @@ public class GridResultPage {
 
                         rowIdx++;
 
-                        return fillArray(valsIter, new Value[cols], null); // TODO coctx
+                        return fillArray(valsIter, new Value[cols], ctx);
                     }
 
                     @Override public void remove() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
index 727428e..ec427b9 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Array.java
@@ -56,9 +56,8 @@ public class GridH2Array extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
-        // TODO we need cache object context
-        return ValueArray.get(fillArray(x.iterator(), new Value[x.size()], null));
+    @Override public Value value(GridKernalContext ctx) {
+        return ValueArray.get(fillArray(x.iterator(), new Value[x.size()], ctx));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
index 7125a5e..ec4e455 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Boolean extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueBoolean.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
index 085870e..e7c8f33 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Byte extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueByte.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
index 4053ae2..31eaaca 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Bytes.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Bytes extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueBytes.getNoCopy(b);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
new file mode 100644
index 0000000..c594274
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2CacheObject.java
@@ -0,0 +1,115 @@
+package org.apache.ignite.internal.processors.query.h2.twostep.msg;
+
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.query.h2.opt.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.h2.value.*;
+
+import java.nio.*;
+
+/**
+ * H2 Cache object message.
+ */
+public class GridH2CacheObject extends GridH2ValueMessage {
+    /** */
+    private int cacheId;
+
+    /** */
+    private CacheObject obj;
+
+    /**
+     *
+     */
+    public GridH2CacheObject() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @param obj Object.
+     */
+    public GridH2CacheObject(int cacheId, CacheObject obj) {
+        this.cacheId = cacheId;
+        this.obj = obj;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Value value(GridKernalContext ctx) {
+        return new GridH2ValueCacheObject(ctx.cache().context().cacheContext(cacheId), obj);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        if (!super.readFrom(buf, reader))
+            return false;
+
+        switch (reader.state()) {
+            case 0:
+                cacheId = reader.readInt("cacheId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 1:
+                obj = reader.readMessage("obj");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!super.writeTo(buf, writer))
+            return false;
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 0:
+                if (!writer.writeInt("cacheId", cacheId))
+                    return false;
+
+                writer.incrementState();
+
+            case 1:
+                if (!writer.writeMessage("obj", obj))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return -22;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 2;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
index 72dea77..e5a8372 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -48,7 +49,7 @@ public class GridH2Date extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueDate.fromDateValue(date);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
index c52e7a9..70700a8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -53,7 +54,7 @@ public class GridH2Decimal extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueDecimal.get(new BigDecimal(new BigInteger(b), scale));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
index 414be92..bdb796f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Double extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueDouble.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
index 6afa1eb..676b79a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Float extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueFloat.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
index 2b7a410..c825a47 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Geometry.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -62,7 +63,7 @@ public class GridH2Geometry extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         try {
             return (Value)GEOMETRY_FROM_BYTES.invoke(null, new Object[]{b});
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
index 6975bfb..fef4956 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Integer.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Integer extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueInt.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
index 3ba6ed8..17f6c9c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2JavaObject.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2JavaObject extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueJavaObject.getNoCopy(null, b, null);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
index 1906757..c798922 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Long extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueLong.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
index 5cea7ad..a2e20d3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Null.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -37,7 +38,7 @@ public class GridH2Null extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueNull.INSTANCE;
     }
 
@@ -62,13 +63,7 @@ public class GridH2Null extends GridH2ValueMessage {
     @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
-        if (!reader.beforeMessageRead())
-            return false;
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        return true;
+        return reader.beforeMessageRead() && super.readFrom(buf, reader);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
index e52efc1..9064559 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -46,7 +47,7 @@ public class GridH2Short extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueShort.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
index 3d72227..3ea3248 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -48,7 +49,7 @@ public class GridH2String extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueString.get(x);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
index aa36a73..ec34248 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -49,7 +50,7 @@ public class GridH2Time extends GridH2ValueMessage {
 
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueTime.fromNanos(nanos);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
index ca8c6d2..973782b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -52,7 +53,7 @@ public class GridH2Timestamp extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueTimestamp.fromDateValueAndNanos(date, nanos);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
index 92e8d91..f23b827 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -52,7 +53,7 @@ public class GridH2Uuid extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
-    @Override public Value value() {
+    @Override public Value value(GridKernalContext ctx) {
         return ValueUuid.get(high, low);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
index f601207..3d4fe7c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
@@ -29,9 +30,10 @@ public abstract class GridH2ValueMessage implements Message {
     /**
      * Gets H2 value.
      *
+     * @param ctx Kernal context.
      * @return Value.
      */
-    public abstract Value value();
+    public abstract Value value(GridKernalContext ctx);
 
     /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a295e3b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
index b996a77..e5a8208 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
-import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.query.h2.opt.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
@@ -85,6 +85,9 @@ public class GridH2ValueMessageFactory implements MessageFactory {
 
             case -21:
                 return new GridH2Geometry();
+
+            case -22:
+                return new GridH2CacheObject();
         }
 
         return null;
@@ -107,17 +110,14 @@ public class GridH2ValueMessageFactory implements MessageFactory {
     /**
      * @param src Source iterator.
      * @param dst Array to fill with values.
-     * @param coctx Cache object context.
+     * @param ctx Kernal context.
      * @return Filled array.
      */
-    public static Value[] fillArray(Iterator<Message> src, Value[] dst, CacheObjectContext
coctx) {
+    public static Value[] fillArray(Iterator<Message> src, Value[] dst, GridKernalContext
ctx) {
         for (int i = 0; i < dst.length; i++) {
             Message msg = src.next();
 
-            if (msg instanceof GridH2ValueMessage)
-                dst[i] = ((GridH2ValueMessage)msg).value();
-            else
-                dst[i] = new GridH2ValueCacheObject(coctx, (CacheObject)msg);
+            dst[i] = ((GridH2ValueMessage)msg).value(ctx);
         }
 
         return dst;
@@ -177,9 +177,11 @@ public class GridH2ValueMessageFactory implements MessageFactory {
                 return new GridH2Array(v);
 
             case Value.JAVA_OBJECT:
-                // TODO
-//                if (v instanceof GridH2ValueCacheObject)
-//                    return ((GridH2ValueCacheObject)v).getCacheObject();
+                if (v instanceof GridH2ValueCacheObject) {
+                    GridH2ValueCacheObject v0 = (GridH2ValueCacheObject)v;
+
+                    return new GridH2CacheObject(v0.getCacheContext().cacheId(), v0.getCacheObject());
+                }
 
                 return new GridH2JavaObject(v);
 


Mime
View raw message