ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [1/2] ignite git commit: IGNITE-950 - Implement Binarylizable.
Date Tue, 03 Nov 2015 14:48:47 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-950-new e0a1a6602 -> ab32d0af7


IGNITE-950 - Implement Binarylizable.


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

Branch: refs/heads/ignite-950-new
Commit: a101bdfdf2bead718dfa06c26e0ac2456732d604
Parents: e0a1a66
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Tue Nov 3 17:44:29 2015 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Tue Nov 3 17:44:29 2015 +0300

----------------------------------------------------------------------
 .../yardstick/cache/model/Organization.java     | 19 ++++++++++++++--
 .../ignite/yardstick/cache/model/Person.java    | 24 +++++++++++++++++++-
 .../ignite/yardstick/cache/model/SampleKey.java | 16 ++++++++++++-
 .../yardstick/cache/model/SampleValue.java      | 16 ++++++++++++-
 4 files changed, 70 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a101bdfd/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java
index 10d09ce..f457e7e 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java
@@ -21,12 +21,16 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 
 /**
  * Organization record used for query test.
  */
-public class Organization implements Externalizable {
+public class Organization implements Externalizable, Binarylizable {
     /** Organization ID. */
     @QuerySqlField(index = true)
     private int id;
@@ -94,9 +98,20 @@ public class Organization implements Externalizable {
     }
 
     /** {@inheritDoc} */
+    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+        writer.writeInt("id", id);
+        writer.writeString("name", name);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+        id = reader.readInt("id");
+        name = reader.readString("name");
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean equals(Object o) {
         return this == o || (o instanceof Organization) && id == ((Organization)o).id;
-
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/a101bdfd/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java
index 84360f6..e59ba19 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java
@@ -21,12 +21,16 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 
 /**
  * Person record used for query test.
  */
-public class Person implements Externalizable {
+public class Person implements Externalizable, Binarylizable {
     /** Person ID. */
     @QuerySqlField(index = true)
     private int id;
@@ -172,6 +176,24 @@ public class Person implements Externalizable {
     }
 
     /** {@inheritDoc} */
+    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+        writer.writeInt("id", id);
+        writer.writeInt("orgId", orgId);
+        writer.writeString("firstName", firstName);
+        writer.writeString("lastName", lastName);
+        writer.writeDouble("salary", salary);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+        id = reader.readInt("id");
+        orgId = reader.readInt("orgId");
+        firstName = reader.readString("firstName");
+        lastName = reader.readString("lastName");
+        salary = reader.readDouble("salary");
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean equals(Object o) {
         return this == o || (o instanceof Person) && id == ((Person)o).id;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a101bdfd/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
index 9b65985..e089696 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
@@ -21,11 +21,15 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
 
 /**
  * Key class for benchmark.
  */
-public class SampleKey implements Externalizable {
+public class SampleKey implements Externalizable, Binarylizable {
     /** */
     private int id;
 
@@ -66,6 +70,16 @@ public class SampleKey implements Externalizable {
     }
 
     /** {@inheritDoc} */
+    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+        writer.writeInt("id", id);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+        id = reader.readInt("id");
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean equals(Object o) {
         if (this == o)
             return true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/a101bdfd/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
index 81b0225..b28862c 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
@@ -21,11 +21,15 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
 
 /**
  * Entity class for benchmark.
  */
-public class SampleValue implements Externalizable {
+public class SampleValue implements Externalizable, Binarylizable {
     /** */
     private int id;
 
@@ -66,6 +70,16 @@ public class SampleValue implements Externalizable {
     }
 
     /** {@inheritDoc} */
+    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+        writer.writeInt("id", id);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+        id = reader.readInt("id");
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return "Value [id=" + id + ']';
     }


Mime
View raw message