You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by db...@apache.org on 2018/08/08 17:57:23 UTC
[geode-native] branch develop updated: GEODE-4336: Return 0 for
object size, remove unnecessary objectSize and classId properties,
rename customserializer pdxserializer
This is an automated email from the ASF dual-hosted git repository.
dbarnes pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new ed05fb9 GEODE-4336: Return 0 for object size, remove unnecessary objectSize and classId properties, rename customserializer pdxserializer
ed05fb9 is described below
commit ed05fb9591a18d66db259ef82c954698e0ac7f2b
Author: Blake Bender <ek...@hotmail.com>
AuthorDate: Wed Aug 8 10:57:21 2018 -0700
GEODE-4336: Return 0 for object size, remove unnecessary objectSize and classId properties, rename customserializer pdxserializer
Co-authored-by: Ivan Godwin <ig...@pivotal.io>
---
examples/cpp/CMakeLists.txt | 2 +-
examples/cpp/CMakeLists.txt.in | 2 +-
examples/cpp/pdxserializable/Order.cpp | 6 --
examples/cpp/pdxserializable/Order.hpp | 2 -
.../{customserializer => pdxserializer}/Order.cpp | 0
.../{customserializer => pdxserializer}/Order.hpp | 0
.../OrderSerializer.cpp | 0
.../OrderSerializer.hpp | 0
.../{customserializer => pdxserializer}/main.cpp | 0
.../startserver.sh | 0
.../stopserver.sh | 0
examples/cpp/remotequery/Order.cpp | 6 --
examples/cpp/remotequery/Order.hpp | 2 -
examples/dotnet/DataSerializableCs/Order.cs | 2 +-
examples/dotnet/PdxSerializableCs/Order.cs | 10 ---
examples/dotnet/RemoteQueryCs/Order.cs | 10 ---
examples/dotnet/RemoteQueryCs/Program.cs | 77 ++++++++++++++++++++++
17 files changed, 80 insertions(+), 39 deletions(-)
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 950519d..0efd36c 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -52,7 +52,7 @@ add_example(NAME dataserializable
add_example(NAME pdxserializable
SOURCE main.cpp Order.cpp Order.hpp)
-add_example(NAME customserializer
+add_example(NAME pdxserializer
SOURCE main.cpp Order.cpp Order.hpp OrderSerializer.cpp OrderSerializer.hpp)
add_example(NAME put-get-remove
diff --git a/examples/cpp/CMakeLists.txt.in b/examples/cpp/CMakeLists.txt.in
index fed540f..5bde343 100644
--- a/examples/cpp/CMakeLists.txt.in
+++ b/examples/cpp/CMakeLists.txt.in
@@ -19,6 +19,6 @@ project(@PRODUCT_DLL_NAME@.Cpp.Examples LANGUAGES NONE)
add_subdirectory(dataserializable)
add_subdirectory(pdxserializable)
-add_subdirectory(customserializer)
+add_subdirectory(pdxserializer)
add_subdirectory(put-get-remove)
add_subdirectory(remotequery)
diff --git a/examples/cpp/pdxserializable/Order.cpp b/examples/cpp/pdxserializable/Order.cpp
index 7a1bd04..af4e22d 100644
--- a/examples/cpp/pdxserializable/Order.cpp
+++ b/examples/cpp/pdxserializable/Order.cpp
@@ -47,12 +47,6 @@ std::string Order::toString() const {
return strm.str();
}
-size_t Order::objectSize() const {
- auto objectSize = sizeof(Order);
- objectSize += name_.capacity();
- return objectSize;
-}
-
const std::string& Order::getClassName() const {
static const std::string CLASS_NAME = "com.example.Order";
return CLASS_NAME;
diff --git a/examples/cpp/pdxserializable/Order.hpp b/examples/cpp/pdxserializable/Order.hpp
index eaced74..fc17689 100644
--- a/examples/cpp/pdxserializable/Order.hpp
+++ b/examples/cpp/pdxserializable/Order.hpp
@@ -53,8 +53,6 @@ class Order : public PdxSerializable {
std::string toString() const override;
- size_t objectSize() const override;
-
const std::string& getClassName() const override;
static std::shared_ptr<PdxSerializable> create();
diff --git a/examples/cpp/customserializer/Order.cpp b/examples/cpp/pdxserializer/Order.cpp
similarity index 100%
rename from examples/cpp/customserializer/Order.cpp
rename to examples/cpp/pdxserializer/Order.cpp
diff --git a/examples/cpp/customserializer/Order.hpp b/examples/cpp/pdxserializer/Order.hpp
similarity index 100%
rename from examples/cpp/customserializer/Order.hpp
rename to examples/cpp/pdxserializer/Order.hpp
diff --git a/examples/cpp/customserializer/OrderSerializer.cpp b/examples/cpp/pdxserializer/OrderSerializer.cpp
similarity index 100%
rename from examples/cpp/customserializer/OrderSerializer.cpp
rename to examples/cpp/pdxserializer/OrderSerializer.cpp
diff --git a/examples/cpp/customserializer/OrderSerializer.hpp b/examples/cpp/pdxserializer/OrderSerializer.hpp
similarity index 100%
rename from examples/cpp/customserializer/OrderSerializer.hpp
rename to examples/cpp/pdxserializer/OrderSerializer.hpp
diff --git a/examples/cpp/customserializer/main.cpp b/examples/cpp/pdxserializer/main.cpp
similarity index 100%
rename from examples/cpp/customserializer/main.cpp
rename to examples/cpp/pdxserializer/main.cpp
diff --git a/examples/cpp/customserializer/startserver.sh b/examples/cpp/pdxserializer/startserver.sh
similarity index 100%
rename from examples/cpp/customserializer/startserver.sh
rename to examples/cpp/pdxserializer/startserver.sh
diff --git a/examples/cpp/customserializer/stopserver.sh b/examples/cpp/pdxserializer/stopserver.sh
similarity index 100%
rename from examples/cpp/customserializer/stopserver.sh
rename to examples/cpp/pdxserializer/stopserver.sh
diff --git a/examples/cpp/remotequery/Order.cpp b/examples/cpp/remotequery/Order.cpp
index 9f4b35a..08a9c59 100644
--- a/examples/cpp/remotequery/Order.cpp
+++ b/examples/cpp/remotequery/Order.cpp
@@ -44,12 +44,6 @@ std::string Order::toString() const {
" Quantity: " + std::to_string(quantity_);
}
-size_t Order::objectSize() const {
- auto objectSize = sizeof(Order);
- objectSize += name_.capacity();
- return objectSize;
-}
-
const std::string& Order::getClassName() const {
static const std::string CLASS_NAME = "com.example.Order";
return CLASS_NAME;
diff --git a/examples/cpp/remotequery/Order.hpp b/examples/cpp/remotequery/Order.hpp
index 953fd9d..4a28762 100644
--- a/examples/cpp/remotequery/Order.hpp
+++ b/examples/cpp/remotequery/Order.hpp
@@ -53,8 +53,6 @@ class Order : public PdxSerializable {
std::string toString() const override;
- size_t objectSize() const override;
-
const std::string& getClassName() const override;
static std::shared_ptr<PdxSerializable> createDeserializable();
diff --git a/examples/dotnet/DataSerializableCs/Order.cs b/examples/dotnet/DataSerializableCs/Order.cs
index 5359391..41f3c65 100644
--- a/examples/dotnet/DataSerializableCs/Order.cs
+++ b/examples/dotnet/DataSerializableCs/Order.cs
@@ -61,7 +61,7 @@ namespace Apache.Geode.Examples.Serializer
public ulong ObjectSize
{
- get { return 0x04; }
+ get { return 0; }
}
public static ISerializable CreateDeserializable()
diff --git a/examples/dotnet/PdxSerializableCs/Order.cs b/examples/dotnet/PdxSerializableCs/Order.cs
index 332316d..85511fa 100644
--- a/examples/dotnet/PdxSerializableCs/Order.cs
+++ b/examples/dotnet/PdxSerializableCs/Order.cs
@@ -63,16 +63,6 @@ namespace Apache.Geode.Examples.Serializer
Quantity = (short)input.ReadInt(QUANTITY_KEY_);
}
- public Int32 ClassId
- {
- get { return 0x42; }
- }
-
- public ulong ObjectSize
- {
- get { return 0x04; }
- }
-
public static IPdxSerializable CreateDeserializable()
{
return new Order();
diff --git a/examples/dotnet/RemoteQueryCs/Order.cs b/examples/dotnet/RemoteQueryCs/Order.cs
index 332316d..85511fa 100644
--- a/examples/dotnet/RemoteQueryCs/Order.cs
+++ b/examples/dotnet/RemoteQueryCs/Order.cs
@@ -63,16 +63,6 @@ namespace Apache.Geode.Examples.Serializer
Quantity = (short)input.ReadInt(QUANTITY_KEY_);
}
- public Int32 ClassId
- {
- get { return 0x42; }
- }
-
- public ulong ObjectSize
- {
- get { return 0x04; }
- }
-
public static IPdxSerializable CreateDeserializable()
{
return new Order();
diff --git a/examples/dotnet/RemoteQueryCs/Program.cs b/examples/dotnet/RemoteQueryCs/Program.cs
new file mode 100644
index 0000000..71f2651
--- /dev/null
+++ b/examples/dotnet/RemoteQueryCs/Program.cs
@@ -0,0 +1,77 @@
+/*
+* 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.
+*/
+
+using System;
+using Apache.Geode.Client;
+
+namespace Apache.Geode.Examples.Serializer
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
+
+ Console.WriteLine("Registering for data serialization");
+
+ cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
+
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ var pool = poolFactory.Create("pool");
+
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var orderRegion = regionFactory.Create<string, Order>("custom_orders");
+
+ Console.WriteLine("Create orders");
+ var order1 = new Order(1, "product x", 23);
+ var order2 = new Order(2, "product y", 37);
+ var order3 = new Order(3, "product z", 1);
+ var order4 = new Order(4, "product z", 102);
+ var order5 = new Order(5, "product x", 17);
+ var order6 = new Order(6, "product z", 42);
+
+ Console.WriteLine("Storing orders in the region");
+ orderRegion.Put("Order1", order1);
+ orderRegion.Put("Order2", order2);
+ orderRegion.Put("Order3", order3);
+ orderRegion.Put("Order4", order4);
+ orderRegion.Put("Order5", order5);
+ orderRegion.Put("Order6", order6);
+
+ var queryService = pool.GetQueryService();
+
+ Console.WriteLine("Getting the orders from the region");
+ var query = queryService.NewQuery<Order>("SELECT * FROM /custom_orders WHERE quantity > 30");
+ var queryResults = query.Execute();
+
+ Console.WriteLine("The following orders have a quantity greater than 30:");
+
+ foreach (Order value in queryResults)
+ {
+ Console.WriteLine(value.ToString());
+ }
+
+ cache.Close();
+ }
+ }
+}
+
+