The userobjects example demonstrates the native client C++ API for distributing and retrieving custom-defined user types. The example uses gemfire::CacheableKey to define a key type suitable for storage as a value in the cache. See the C++ online API documentation for a description of gemfire::CacheableKey. You can also review the example source code in the userobjects directory.
The userobjects example is located in NativeClient_xxxx/examples/userobjects.
The following is a list of the environment configuration commands for the userobjects example. Choose the set of commands that are appropriate for your operating system. The text that you type is shown in bold.
Bourne and Korn shells (sh, ksh, bash)
% GFCPP=<path to NativeClient_xxxx directory>; export GFCPP
% PATH=$GFCPP/bin:$PATH; export PATH
% LD_LIBRARY_PATH=$GFCPP/lib; export LD_LIBRARY_PATH
Windows
The Windows native client installer sets the required environment configurations for you, so they are listed for reference only.
> GFCPP=<path to NativeClient_xxxx directory>
> PATH=%GFCPP%\bin;%PATH%
Follow these steps to run the userobjects example. The steps reflect Windows operations, so alter them as needed for your operating system.
When you're prompted to enter the name of the native client directory, replace the xxxx in NativeClient_xxxx with the actual four-digit product version number.
Create a session, then configure the session environment according to the steps listed in Configuring the Environment.
userobjects example directory.
cd \NativeClient_xxxx\examples\userobjects
userobjects
The process registers custom serializable types, then connects to the distributed system. It creates a cache and region, then creates a new AccountHistory and puts it in the cache. Next, it gets AccountHistory from the cache and updates it.
This is the example output:
Put an AccountHistory in cache keyed with BankAccount.
BankAccount( customer: 2309, account: 123091 )
AccountHistory:
Created account
Found AccountHistory in the cache.
AccountHistory:
Created account
Updated AccountHistory in the cache.
Found AccountHistory in the cache.
AccountHistory:
Created account
debit $1,000,000.
exit.
By default, this product ships configured for multicast membership resolution. If your network environment does not allow multicast, you can configure GemFire for unicast. See the GemFire Enterprise System Administrator's Guide for instructions on configuring TCP transport for membership and discovery.
Copyright © 2005-2008 by GemStone Systems, Inc. All rights reserved. GemStone®, GemFire®, and the GemStone logo are trademarks or registered trademarks of GemStone Systems, Inc. All other trade names or trademarks are the property of their respective owners. Information in this document is subject to change without notice.