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/16 22:04:48 UTC
[geode-native] branch develop updated: GEODE-5554: Standardize
naming of Geode Native example *.md files (#332)
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 6f9f6f5 GEODE-5554: Standardize naming of Geode Native example *.md files (#332)
6f9f6f5 is described below
commit 6f9f6f5b52dbfa5f7bef7e91dc14d0134e5d57cc
Author: Dave Barnes <db...@pivotal.io>
AuthorDate: Thu Aug 16 15:04:46 2018 -0700
GEODE-5554: Standardize naming of Geode Native example *.md files (#332)
* GEODE-5554: Standardize naming of Geode Native example *.md files
---
CMakeLists.txt | 4 +-
examples/cpp/BUILD-CPP-EXAMPLES.md | 42 +++++++++++++++
examples/cpp/BUILDING.md | 43 ----------------
examples/cpp/CMakeLists.txt | 5 +-
.../{remotequery => dataserializable}/README.md | 32 +++++++-----
examples/cpp/dataserializable/main.cpp | 7 ++-
.../cpp/{remotequery => pdxserializable}/README.md | 26 +++++-----
.../cpp/{remotequery => pdxserializer}/README.md | 24 ++++-----
examples/cpp/put-get-remove/README.md | 60 ++++++++++++++++++++++
examples/cpp/remotequery/README.md | 8 +--
.../dotnet/{README.md => BUILD-DOTNET-EXAMPLES.md} | 2 +-
examples/dotnet/CMakeLists.txt | 2 +-
12 files changed, 163 insertions(+), 92 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4d526f..f967134 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,11 +31,11 @@ if(CMAKE_GENERATOR MATCHES Win64*)
message(FATAL_ERROR "GEODE expects that a user must provide -Thost=x64 if you are using a"
" 64-bit toolset, otherwise you may get a linker error when DLLs are larger"
" than 2GB saying \"Unable to open file apache-geode-static.dll.\" This is due"
- " to the 32bit toolset being used by default.")
+ " to Visual Studio using the 32-bit toolset by default.")
endif()
endif()
-set(BUILD_BITS 64 CACHE STRING "Build for 64 (default) or 32 bit.")
+set(BUILD_BITS 64 CACHE STRING "Build for 64 (Geode default) or 32 bit.")
set(PRODUCT_VENDOR "Apache" CACHE STRING "Product vendor")
set(PRODUCT_VENDOR_NAME "The Apache Software Foundation" CACHE STRING "Product vendor full legal name")
diff --git a/examples/cpp/BUILD-CPP-EXAMPLES.md b/examples/cpp/BUILD-CPP-EXAMPLES.md
new file mode 100644
index 0000000..f70f578
--- /dev/null
+++ b/examples/cpp/BUILD-CPP-EXAMPLES.md
@@ -0,0 +1,42 @@
+# Geode Native C++ Examples
+
+## Prerequisites
+* Install [Apache Geode](https://geode.apache.org)
+* Install [CMake](https://cmake.org/download/)
+* Build and install [Apache Geode Native](https://github.com/apache/geode-native)
+* **For Windows:** Visual Studio 2015
+
+## Building the Examples
+
+1. Copy the `examples` directory from the native client installation folder to a folder in your workspace.
+
+ **For Windows:** For reliable behavior of the example scripts, do not choose a workspace with directory names or filenames that contain spaces.
+
+1. Navigate to the directory for a specific example and use `cmake` to build it. For non-Windows systems, the commands are:
+
+ ```
+ $ cd workspace/examples/cpp/<example>
+ $ mkdir build
+ $ cd build
+ $ cmake ..
+ $ cmake --build . -- <optional parallelism parameter>
+ ```
+ where the optional parallelism parameter is of the form `-j n`.
+
+ **For Windows:** Include options that specify the generator, the architecture toolset, and the path to the Geode Native installation:
+
+ ```
+ $ cd workspace/examples/cpp/<example>
+ $ mkdir build
+ $ cd build
+ $ cmake .. -G"Visual Studio 14 2015 Win64" -Thost=x64 -DGeodeNative_ROOT="<NC-install-root-dir>"
+ $ cmake --build . -- <optional parallelism parameter>
+ ```
+ where the optional parallelism parameter is `/m`.
+
+## Running the Examples
+To run an example,
+
+1. Navigate to the directory for a specific example.
+2. Follow the directions in the `README.md` file in that directory.
+
diff --git a/examples/cpp/BUILDING.md b/examples/cpp/BUILDING.md
deleted file mode 100644
index cf1c549..0000000
--- a/examples/cpp/BUILDING.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Building
-
-## Prerequisites (All Platforms)
-* [CMake 3.5](https://cmake.org/) or newer
-* C++11 compiler *(see platform specific requirements)*
-* [Apache Geode](http://geode.apache.org/releases/) binaries installed or available to link against
-
- Running requires access to an installation of Geode. By default the value of `GEODE_HOME` is used as the path for the startserver.sh script, if gfsh is not in the path.
-
-## Prequisites (Windows)
-
-* Visual Studio 2015
-
-## Steps to build
-
-**Mac OS X / \*nix / Windows**
-
- $ cd <example>
- $ mkdir build
- $ cd build
- $ cmake ..
- $ cmake --build . -- <optional parallelism parameters>
-
-## Steps to run
-
-**Mac OS X / \*nix**
-
- $ cd <example>
- $ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:<install path>/geode-native/lib
- $ sh ./startserver.sh
- $ build/<example name>
- $ sh ./stopserver.sh
-
-## Generator
-CMake uses a "generator" to produce configuration files for use by a variety of build tools, e.g., UNIX makefiles, Visual Studio projects. By default a system-specific generator is used by CMake during configuration. (Please see [the CMake documentation](https://cmake.org/documentation/) for further information.) However, in many cases there is a better choice.
-
-### Mac OS X / *nix Generator
-The default generator:
-
- $ cmake ..
-
-### Building requirements
-Please see the documentation for building Geode Native.
\ No newline at end of file
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 8d7d17d..fa54531 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -21,7 +21,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BIN
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
- BUILDING.md
+ BUILD-CPP-EXAMPLES.md
DESTINATION examples/cpp)
function(add_example)
@@ -41,6 +41,7 @@ function(add_example)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${ADD_EXAMPLE_NAME}/CMakeLists.txt
${EXAMPLE_SOURCES_PATHS}
+ ${ADD_EXAMPLE_NAME}/README.md
${ADD_EXAMPLE_NAME}/startserver.sh
${ADD_EXAMPLE_NAME}/stopserver.sh
DESTINATION examples/cpp/${ADD_EXAMPLE_NAME})
@@ -59,4 +60,4 @@ add_example(NAME put-get-remove
SOURCE main.cpp)
add_example(NAME remotequery
- SOURCE main.cpp Order.cpp Order.hpp README.md)
+ SOURCE main.cpp Order.cpp Order.hpp)
diff --git a/examples/cpp/remotequery/README.md b/examples/cpp/dataserializable/README.md
similarity index 60%
copy from examples/cpp/remotequery/README.md
copy to examples/cpp/dataserializable/README.md
index 581b1ee..9bad0d8 100644
--- a/examples/cpp/remotequery/README.md
+++ b/examples/cpp/dataserializable/README.md
@@ -1,5 +1,5 @@
-# Remote Query Example
-This is a simple example showing how to create and execute a remote query.
+# DataSerializable example
+This is a simple example showing how to register for serialization of custom objects using the DataSerializable class.
## Prerequisites
* An installation of Apache Geode.
@@ -9,17 +9,17 @@ This is a simple example showing how to create and execute a remote query.
* `GEODE_HOME/bin` in the execution path.
## Running
-1. Set the current directory to the `remotequery` directory in the installed directory tree.
+1. Set the current directory to the `dataserializable` directory in your example workspace.
```
- $ cd <install-dir>/examples/cpp/remotequery
+ $ cd workspace/examples/cpp/dataserializable
```
1. Run the `startserver.sh` script to start the Geode server, create a region, and populate the region with sample data.
```
$ sh ./startserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - start locator --name=locator
...
@@ -32,26 +32,34 @@ This is a simple example showing how to create and execute a remote query.
server | Region "/custom_orders" created on "server"
```
-1. Execute `remotequery`:
+1. Execute `dataserializable`:
```
- $ build/remotequery
+ $ build/dataserializable
Create orders
Storing orders in the region
Getting the orders from the region
- The following orders have a quantity greater than 30:
- OrderID: 2 Product Name: product y Quantity: 37
- OrderID: 4 Product Name: product z Quantity: 102
- OrderID: 6 Product Name: product z Quantity: 42
+ OrderID: 1
+ Product Name: product x
+ Quantity: 23
+ OrderID: 2
+ Product Name: product y
+ Quantity: 37
```
1. Stop the server
```
$ sh ./stopserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - connect
...
+ (2) Executing - destroy region --name=custom_orders
+
+ Member | Status
+ ------ | ----------------------------------------------
+ server | Region '/custom_orders' destroyed successfully
+ ...
(2) Executing - stop server --name=server
...
(3) Executing - stop locator --name=locator
diff --git a/examples/cpp/dataserializable/main.cpp b/examples/cpp/dataserializable/main.cpp
index 5105cda..876d738 100644
--- a/examples/cpp/dataserializable/main.cpp
+++ b/examples/cpp/dataserializable/main.cpp
@@ -62,8 +62,11 @@ int main(int argc, char** argv) {
std::cout << "Order 1 not found." << std::endl;
}
- if (auto order2retrieved = region->get("Customer2")) {
- std::cout << order2retrieved->toString() << std::endl;
+ if (auto order2retrieved =
+ std::dynamic_pointer_cast<Order>(region->get("Customer2"))) {
+ std::cout << "OrderID: " << order2retrieved->getOrderId() << std::endl;
+ std::cout << "Product Name: " << order2retrieved->getName() << std::endl;
+ std::cout << "Quantity: " << order2retrieved->getQuantity() << std::endl;
} else {
std::cout << "Order 2 not found." << std::endl;
}
diff --git a/examples/cpp/remotequery/README.md b/examples/cpp/pdxserializable/README.md
similarity index 65%
copy from examples/cpp/remotequery/README.md
copy to examples/cpp/pdxserializable/README.md
index 581b1ee..785e0b2 100644
--- a/examples/cpp/remotequery/README.md
+++ b/examples/cpp/pdxserializable/README.md
@@ -1,5 +1,5 @@
-# Remote Query Example
-This is a simple example showing how to create and execute a remote query.
+# PdxSerializable example
+This is a simple example showing how to register for serialization of custom objects using the PdxSerializable class.
## Prerequisites
* An installation of Apache Geode.
@@ -9,17 +9,17 @@ This is a simple example showing how to create and execute a remote query.
* `GEODE_HOME/bin` in the execution path.
## Running
-1. Set the current directory to the `remotequery` directory in the installed directory tree.
+1. Set the current directory to the `pdxserializable` directory in your example workspace.
```
- $ cd <install-dir>/examples/cpp/remotequery
+ $ cd workspace/examples/cpp/pdxserializable
```
1. Run the `startserver.sh` script to start the Geode server, create a region, and populate the region with sample data.
```
$ sh ./startserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - start locator --name=locator
...
@@ -32,24 +32,26 @@ This is a simple example showing how to create and execute a remote query.
server | Region "/custom_orders" created on "server"
```
-1. Execute `remotequery`:
+1. Execute `pdxserializable`:
```
- $ build/remotequery
+ $ build/pdxserializable
Create orders
Storing orders in the region
Getting the orders from the region
- The following orders have a quantity greater than 30:
- OrderID: 2 Product Name: product y Quantity: 37
- OrderID: 4 Product Name: product z Quantity: 102
- OrderID: 6 Product Name: product z Quantity: 42
+ OrderID: 1
+ Product Name: product x
+ Quantity: 23
+ OrderID: 2
+ Product Name: product y
+ Quantity: 37
```
1. Stop the server
```
$ sh ./stopserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - connect
...
(2) Executing - stop server --name=server
diff --git a/examples/cpp/remotequery/README.md b/examples/cpp/pdxserializer/README.md
similarity index 64%
copy from examples/cpp/remotequery/README.md
copy to examples/cpp/pdxserializer/README.md
index 581b1ee..e913d26 100644
--- a/examples/cpp/remotequery/README.md
+++ b/examples/cpp/pdxserializer/README.md
@@ -1,5 +1,5 @@
-# Remote Query Example
-This is a simple example showing how to create and execute a remote query.
+# PdxSerializer example
+This is a simple example showing how to register for serialization of custom objects using the PdxSerializer class.
## Prerequisites
* An installation of Apache Geode.
@@ -9,17 +9,17 @@ This is a simple example showing how to create and execute a remote query.
* `GEODE_HOME/bin` in the execution path.
## Running
-1. Set the current directory to the `remotequery` directory in the installed directory tree.
+1. Set the current directory to the `pdxserializer` directory in your example workspace.
```
- $ cd <install-dir>/examples/cpp/remotequery
+ $ cd workspace/examples/cpp/pdxserializer
```
1. Run the `startserver.sh` script to start the Geode server, create a region, and populate the region with sample data.
```
$ sh ./startserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - start locator --name=locator
...
@@ -32,24 +32,22 @@ This is a simple example showing how to create and execute a remote query.
server | Region "/custom_orders" created on "server"
```
-1. Execute `remotequery`:
+1. Execute `pdxserializer`:
```
- $ build/remotequery
- Create orders
+ $ build/pdxserializer
Storing orders in the region
Getting the orders from the region
- The following orders have a quantity greater than 30:
- OrderID: 2 Product Name: product y Quantity: 37
- OrderID: 4 Product Name: product z Quantity: 102
- OrderID: 6 Product Name: product z Quantity: 42
+ OrderID: 1
+ Product Name: product x
+ Quantity: 42
```
1. Stop the server
```
$ sh ./stopserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - connect
...
(2) Executing - stop server --name=server
diff --git a/examples/cpp/put-get-remove/README.md b/examples/cpp/put-get-remove/README.md
new file mode 100644
index 0000000..9de0a6c
--- /dev/null
+++ b/examples/cpp/put-get-remove/README.md
@@ -0,0 +1,60 @@
+# Put-get-remove example
+This is a very simple example showing how to create a `Cache` using the `CacheFactory`,
+configure a `Pool` with a `PoolFactory`, and configure a `Region` with a `RegionFactory`.
+We then put, get, and remove some primitive data in the region.
+
+## Prerequisites
+* An installation of Apache Geode.
+* Apache Geode Native, built and installed.
+* Apache Geode Native examples, built and installed.
+* A `GEODE_HOME` environment variable set to the location of the Apache Geode installation.
+* `GEODE_HOME/bin` in the execution path.
+
+## Running
+1. Set the current directory to the `put-get-remove` directory in your example workspace.
+
+ ```
+ $ cd workspace/examples/cpp/put-get-remove
+ ```
+
+1. Run the `startserver.sh` script to start the Geode server, create a region, and populate the region with sample data.
+
+ ```
+ $ sh ./startserver.sh
+ /Users/user/geode/bin/gfsh
+
+ (1) Executing - start locator --name=locator
+ ...
+ (2) Executing - start server --name=server
+ ...
+(3) Executing - create region --name=example_userinfo --type=PARTITION
+
+ Member | Status
+ ------ | ----------------------------------------------
+ server | Region "/example_userinfo" created on "server"
+ ```
+
+1. Execute `put-get-remove`:
+
+ ```
+ $ build/put-get-remove
+ Storing id and username in the region
+ Getting the user info from the region
+ rtimmons = Robert Timmons
+ scharles = Sylvia Charles
+ Removing rtimmons info from the region
+ rtimmons's info successfully deleted
+ ```
+
+1. Stop the server
+
+ ```
+ $ sh ./stopserver.sh
+ /Users/user/geode/bin/gfsh
+ (1) Executing - connect
+ ...
+ (2) Executing - stop server --name=server
+ ...
+ (3) Executing - stop locator --name=locator
+ ....
+ ```
diff --git a/examples/cpp/remotequery/README.md b/examples/cpp/remotequery/README.md
index 581b1ee..61bdda0 100644
--- a/examples/cpp/remotequery/README.md
+++ b/examples/cpp/remotequery/README.md
@@ -9,17 +9,17 @@ This is a simple example showing how to create and execute a remote query.
* `GEODE_HOME/bin` in the execution path.
## Running
-1. Set the current directory to the `remotequery` directory in the installed directory tree.
+1. Set the current directory to the `remotequery` directory in your example workspace.
```
- $ cd <install-dir>/examples/cpp/remotequery
+ $ cd workspace/examples/cpp/remotequery
```
1. Run the `startserver.sh` script to start the Geode server, create a region, and populate the region with sample data.
```
$ sh ./startserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - start locator --name=locator
...
@@ -49,7 +49,7 @@ This is a simple example showing how to create and execute a remote query.
```
$ sh ./stopserver.sh
- /Users/user/geode16/bin/gfsh
+ /Users/user/geode/bin/gfsh
(1) Executing - connect
...
(2) Executing - stop server --name=server
diff --git a/examples/dotnet/README.md b/examples/dotnet/BUILD-DOTNET-EXAMPLES.md
similarity index 97%
rename from examples/dotnet/README.md
rename to examples/dotnet/BUILD-DOTNET-EXAMPLES.md
index 23daabd..abc2cea 100644
--- a/examples/dotnet/README.md
+++ b/examples/dotnet/BUILD-DOTNET-EXAMPLES.md
@@ -19,7 +19,7 @@
cd workspace\examples\dotnet
mkdir build
cd build
- cmake .. -G"Visual Studio 14 2015 Win64" -DGeodeNative_ROOT="c:\Program Files\nativeclient"
+ cmake .. -G"Visual Studio 14 2015 Win64" -DGeodeNative_ROOT="<NC-install-root-dir>"
```
The result is a Visual Studio solution for the .NET examples.
1. Open the solution file, `examples.sln`, in [Visual Studio 2015](https://www.visualstudio.com/) or newer and build all projects.
diff --git a/examples/dotnet/CMakeLists.txt b/examples/dotnet/CMakeLists.txt
index 6427179..e727310 100644
--- a/examples/dotnet/CMakeLists.txt
+++ b/examples/dotnet/CMakeLists.txt
@@ -21,7 +21,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BIN
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
- README.md
+ BUILD-DOTNET-EXAMPLES.md
DESTINATION examples/dotnet)
function(add_example)