geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [44/51] [partial] incubator-geode git commit: Add source for geode c++ and .net clients
Date Thu, 19 May 2016 15:14:51 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/CacheRunner/README.html
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/CacheRunner/README.html b/geode-client-native/examples/clicache/CacheRunner/README.html
new file mode 100644
index 0000000..dff87ea
--- /dev/null
+++ b/geode-client-native/examples/clicache/CacheRunner/README.html
@@ -0,0 +1,653 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+        <IMG SRC="../../../docs/PIVOTAL_GemFire_220x100.png" BORDER="0">
+	<HEAD>
+		<TITLE>CacheRunner: GemFire Native Client C# Example</TITLE>
+		<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+		<META http-equiv="Content-Style-Type" content="text/css">
+		<META content="Adobe FrameMaker 7.0/HTML Export Filter" name="GENERATOR">
+		<LINK href="DocIndex.css" type="text/css" charset="ISO-8859-1" rel="STYLESHEET">
+	</HEAD>
+	<BODY>
+        <IMG SRC="../../../docs/PIVOTAL_GemFire_190x81.png" BORDER="0">
+	<DIV>
+              <h1 align="center"><a name="Top" id="Top"></a>CacheRunner</h1>
+			  <h2 align="center"> Pivotal GemFire&#174; Native Client </h2>
+			  <h2 align="center">C# Programming Example</h2>
+    </DIV>
+            <DIV>
+              <P>The <code>CacheRunner</code> C# example is an interactive program for modifying and viewing GemFire cache contents as a C# client interacts with a Java cache server. The <code>CacheRunner</code> program joins the distributed system, creates a cache, and then accepts command-line input for inspecting, modifying, and remotely querying the cache while working with a cache server. XML files are provided to configure <code>CacheRunner</code> for different functional operations or behavior.</P>
+              <blockquote>
+                <p><em>You can review the C# source code for this example by opening the files in the <code>cli_CacheRunner</code> directory that have a <code>.cs</code> file extension. </em></p>
+              </blockquote>
+              <P>This example is divided into three parts, with each part requiring a different XML configuration file for the Java cache server. <code>CacheRunner</code> is also configured using a local <code>gfcpp.properties</code> file.</P>
+              <ul>
+                        <li><em><a href="#part1">Part 1: Inspecting and Modifying the Cache</a></em> demonstrates cache operations using two C# native clients with a GemFire Java cache server. It shows how to <code>put</code> and <code>get</code> data between clients, and how to derive a complex number as a user-defined class for use as a key or value. You start two C# client instances and see how a <code>put</code> value in one can be gotten in another as the cache server is updated with the new values. This part uses server configuration file <code><a href="./cacherunner.xml" target="_blank">cacherunner.xml</a></code>. The procedures describing non-cacheable and cacheable values use client configuration files <code><a href="./tcr_cacheless.xml" target="_blank">tcr_cacheless.xml</a></code> and <code><a href="./tcr_cache.xml" target="_blank">tcr_cache.xml</a></code>. </li>
+                        <br>                      
+ 				    <li><em><a href="#part2">Part 2: Remote Querying</a></em> demonstrates how to initiate a query from a C# client that is executed on data stored on a Java cache server. The query results are returned to the C# client. This part uses server configuration file <code><a href="./csQueryPortfolios.xml" target="_blank">csQueryPortfolios.xml</a></code>. If no XML file is specified when <code>CacheRunner</code> is started, it's configured using <a href="./tcr_cache.xml" target="_blank"><code>tcr_cache.xml</code></a> by default. </li>
+ 					<br>
+ 				    <li><em><a href="#part3">Part 3: High Availability</a> </em> shows how you can set up redundant cache servers in case the primary server fails.</li>
+  </ul>
+ 				  <P>In the procedures, the lines you type are shown in a <code> <strong>boldface fixed</strong></code> font. System output is shown in a <code>regular fixed</code> font.
+                      </P><br>
+</DIV>
+
+<DIV>
+<H2>
+<a name="configuring_environment" id="configuring_environment"></a>Configuring the Environment</H2>
+<P>
+Examples that interact with a Java cache server require specific environment configurations so the cache server will run properly. Follow the configuration steps listed below that apply to your operating system: </P>
+</DIV>
+ <DIV>
+<ol>
+  <li>From the GemFire product installation directory, configure your environment settings by following the steps in <code>examples/EnvSetup.html</code>. Refer to the system configuration information in the <em>GemFire User's Guide</em> if you need help with   this step.<br>
+      <br>
+  <li>Set the <code>JAVA_HOME</code> and <code>GF_JAVA_HOME</code>  environment variables to your installed Java JRE or JDK. See the installation information in the <em>GemFire User's Guide</em> for the   versions of Java that are compatible with GemFire. The <code>JAVA_HOME</code> setting is for your applications, and  <code>GF_JAVA_HOME</code> is for the GemFire scripts.  You must have a compatible Java JRE or JDK installed  and you must set <code>JAVA_HOME</code> and <code>GF_JAVA_HOME</code> to point to it.<br>
+      <br>
+  <li>Add <code>$JAVA_HOME/bin</code> to the start of your <code>PATH</code>. <br>
+</ol>
+<p>The following is a list of the environment configuration commands for the <code>CacheRunner</code> example. Choose the set of commands that are appropriate for your operating system. The text that you type is shown in bold.
+  These configurations only need to be performed for the sessions that invoke the Java cache server.</p>
+<p><strong>Bourne and Korn shells (sh, ksh, bash)</strong></p>
+<blockquote>
+  <p>    <code>% <strong>cd GemFireInstallDirectory</strong><br>
+    % <strong>JAVA_HOME=&lt;installed JRE PATH&gt;; export JAVA_HOME</strong><br>
+    % <strong>GF_JAVA_HOME=$JAVA_HOME; export GF_JAVA_HOME</strong><br>
+    % <strong>PATH=$JAVA_HOME/bin:$PATH; export PATH</strong></code></p>
+</blockquote>
+<p><strong>Windows</strong></p>
+<blockquote>
+  <p><code>&gt; <strong>cd GemFireInstallDirectory</strong><br>
+&gt; <strong>set JAVA_HOME=&lt;installed JRE PATH&gt;</strong><br>
+&gt; <strong>set GF_JAVA_HOME=%JAVA_HOME%</strong><br>
+&gt; <strong>set PATH=%JAVA_HOME%\bin;%PATH%</strong> </code></p>
+</blockquote>
+<a name="part1"></a><br>
+<br>
+</DIV>
+
+<DIV>
+<hr size="3" noshade>
+<h1>Part 1: Inspecting and Modifying the Cache</h1>
+<hr size="3" noshade>
+</DIV>
+
+ <DIV>
+   <h2>CacheRunner Configuration Files </h2>
+   <P>
+The <code>CacheRunner</code> C# example uses a GemFire cache server configuration file called <code><a href="./cacherunner.xml" target="_blank">cacherunner.xml</a></code>. When the Java cache server starts, <code>cacherunner.xml</code> creates two regions <code>root</code> and <code>listenerWriterLoader</code>. This is a description of each cache server region and how they are configured:</P>
+   <UL>
+  <LI CLASS="Bulleted">root &#151; The root region for the cache server. The region's scope is <code>distributed-no-ack</code>, and <code>notify-by-subscription</code> is set to <code>true</code>.</LI>
+  <LI CLASS="Bulleted"><code> listenerWriterLoader</code> &#151; A region with <code>distributed-ack</code> scope and  <code>mirror-type</code> set to <code>keys-values</code>.</LI>
+  </UL>
+<p>The <code>CacheRunner</code> application comes with XML configuration files that configure the cache server and the local client cache to demonstrate various operations with the cache server. This example does not use <code>tcr_hacacheless.xml</code>.</p>
+<UL><LI CLASS="Bulleted"><code><a href="./tcr_cache.xml" target="_blank">tcr_cache.xml</a></code> &#151; The <code>listenerWriterLoader</code> region establishes an endpoint connection with the server and performs distributed caching operations by receiving updates from the cache server. If <code>CacheRunner.exe</code> is run without specifying an XML file, it is automatically configured using <code>tcr_cache.xml</code>.</LI>
+  <LI CLASS="Bulleted"><code><a href="./tcr_hacache.xml" target="_blank">tcr_hacache.xml</a></code> &#151; Configures the client for high availability by specifying multiple servers for storing data and setting a server redundancy level.</LI>
+  <LI CLASS="Bulleted"><code><a href="./tcr_cacheless.xml" target="_blank">tcr_cacheless.xml</a></code> &#151; The <code>listenerWriterLoader</code> region establishes an endpoint connection with the server and receives data from the cache server. Entries retrieved from the cache server are not retained in the client's local cache because the <code>caching-enabled</code> region attribute is set to <code>false</code>. The <code>Portfolios</code> region is used for remote querying. </LI>
+</UL>
+<P>
+These procedures introduce a few of the <code> CacheRunner</code>
+ commands. For information on the others, enter <strong>
+ <code>help</code></strong>
+ or <strong>
+ <code>?</code></strong>
+ at the session prompt.</P>
+<P>In the procedures, the lines you type are shown in a <code> <strong>boldface fixed</strong></code> font. System output is shown in a <code>regular fixed</code> font.</P>
+<br>
+ </DIV>
+ <DIV>
+                      <H2> <a name="starting_application_processes" id="starting_application_processes"></a>Starting the Cache Server </H2>
+ 				  <P> To start the cache server, create a session from the GemFire product installation directory and complete the following steps. </P>
+    </DIV>
+ 				<DIV>
+                      <OL>
+                        <LI CLASS="Numbered-1st">
+                          <p>Configure the session environment according to the steps listed in <a href="#configuring_environment">Configuring the Environment</a><a href="..\EnvSetup.html" target="_blank"></a>.</p>
+                        </LI>
+                        <LI CLASS="Numbered">Go to the <code>cli_CacheRunner</code> directory, then start the cache server with the local <code>cacherunner.xml</code> file:
+                          <blockquote>
+                              <p><strong> <code>cd examples\cli_CacheRunner</code></strong></p>
+                              <p><strong><code>cacheserver start cache-xml-file=cacherunner.xml</code></strong></p>
+                          </blockquote>
+                          <P>The cache server is initialized using the configurations in <code>cacherunner.xml</code>. A message similar to the following appears, indicating that the cache server is running:</P>
+                        </LI>
+                        <blockquote>
+                          <p> <code>Cacheserver pid: 2120 status: running</code><br>
+                      </p>
+                        </blockquote>
+                      </OL>
+    </DIV>
+ 				<DIV>
+                      <H2> <a name="starting_application_processes" id="starting_application_processes"></a>Starting Two CacheRunner Clients Using tcr_cache.xml </H2>
+ 				  <P> Start two <code>CacheRunner</code> clients and configure their caches using <code>tcr_cache.xml</code> by following these steps:</P>
+ 	  </DIV>
+ 				<DIV>
+                      <OL>
+                        <LI CLASS="Numbered-1st">
+                          <p>Create two sessions for two <code>CacheRunner</code> clients.</p>
+                        </LI>
+                        <LI CLASS="Numbered-1st">
+                        <p><span class="Numbered">In each session, go to the <code>cli_CacheRunner</code> directory</span>:                                                </LI>
+                        <blockquote>
+                          <p><strong> <code>cd examples\cli_CacheRunner</code></strong></p>
+                        </blockquote>
+                        <LI CLASS="Numbered"> In each session, start the <code>CacheRunner</code> client with <code>tcr_cache.xml</code>:
+                          <blockquote>
+                              <p><strong><code>CacheRunner.exe tcr_cache.xml </code></strong> </p>
+                          </blockquote>
+                          <P><code>CacheRunner</code> is configured using the settings in <code><a href="./tcr_cache.xml" target="_blank">tcr_cache.xml</a></code>. The following command prompt appears for both C# clients:</P>
+                        </LI>
+                          <blockquote>
+                              <p><code>/root: chrgn, lsrgn, get, put, exec, query, existsvalue, selectvalue, quit:</code></p>
+                          </blockquote>
+                          <p>This is a brief description of the prompts and commands you can uses with <code>CacheRunner</code>. See the GemFire product documentation for more information about these commands:</p>
+                          <ul>
+                            <li><code>/root:</code> &#151; A prompt that indicates the current region.</li>
+                            <li><code> chrgn</code> &#151; Navigate to a different region.</li>
+                            <li><code>lsrgn</code> &#151; List all regions in cache.</li>
+                            <li><code>get</code> &#151; Get a value from the cache server and add it to the local cache.</li>
+                            <li><code>put</code> &#151; Put a value into the local cache and propagate the value to the cache server.</li>
+                            <li><code>exec</code> &#151; Execute a query.</li>
+                            <li><code>query</code> &#151; Run a query shortcut method.</li>
+                            <li><code>existsvalue</code> &#151;Run a query shortcut method.</li>
+                            <li><code>selectvalue</code> &#151;Run a query shortcut method.</li>
+                            <li><code>quit</code> &#151; Quit the <code>CacheRunner</code> application.</li>
+ 						<br>
+                          </ul>
+ 					 
+                      </OL>
+                      
+    </DIV>
+
+                    <DIV>
+                      <H2> Entering and Receiving Data in the Clients </H2>
+ 				  <P> In this exercise, you <code>put</code> data in one client and the client updates the cache server region with the new data. Next, the second client does a <code>get</code> to retrieve the updated values from the cache server and update its local cache. The cache listeners for the clients report the cache events that occur for each <code>put</code> and <code>get</code>. </P>
+ 	  </DIV>
+ <DIV>
+                      <P><strong> In both CacheRunner clients </strong></P>
+ 				  <p>In both clients, go to the <code> listenerWriterLoader</code> region:</p>
+ 				  <OL>
+ 				    <blockquote>
+ 				      <p><code><strong>
+ 		            chrgn listenerWriterLoader</strong></code><br>
+      </blockquote>
+   </OL>
+ 				  <p><strong> In the first CacheRunner client:</strong></p>
+ 				    <OL>
+ 				      <LI CLASS="Numbered">Add an entry:
+ 				        <blockquote>
+ 				          <p><strong> <code>put key1 first</code></strong></p>
+ 				        </blockquote>
+ 			            <P> The cache listener reports the events related to the <code>put</code> command. The entry is identified as a string, and the cache server is updated with the new entry.</P>
+ 			            <blockquote>
+ 			              <p> <code>--- Received afterCreate event of: key1<br>
+ 		                  Put string -- key: key1 value: first </code></p>
+ 				        </blockquote>
+ 			            <P> The second <code>CacheRunner</code> client also receives an <code>afterCreate</code> event message from the server for the <code>put</code>:</P>
+ 			            <blockquote>
+ 			              <p> <code>--- Received afterCreate event of: key1</code></p>
+ 				        </blockquote>
+ 				      </LI>
+ 				      <LI CLASS="Numbered"> Add another entry in the first client:
+ 				        <blockquote>
+ 				          <p><strong><code>put key2 7.2+3i</code></strong></p>
+ 			            </blockquote>
+ 				        <P> The cache listener reports the events related to the <code>put</code> command. The entry is identified as a complex number, and the cache server is updated with the new entry.</P>
+ 				        <blockquote>
+ 				          <p> <code>--- Received afterCreate event of: key2<br>
+ 			              Put complex -- key: key2 value: 7.2+3i</code></p>
+ 			            </blockquote>
+ 			          <P> The second <code>CacheRunner</code> client also receives an <code>afterCreate</code> event message from the server for the <code>put</code>:</P>
+ 			          <blockquote>
+ 			            <p> <code>--- Received afterCreate event of: key2</code></p>
+ 				      </blockquote>
+ 			          </LI>
+      </OL>
+ 				    <br>
+ 				      <P><strong>In the second CacheRunner client </strong></P>
+ 				      <OL>
+ 				        <LI CLASS="Numbered">Get the <code>key1</code> entry from the cache server that was added by the first client:
+                              <blockquote>
+                                <p><strong> <code>get key1</code></strong></p>
+                            </blockquote>
+                            <P> The key name and value are retrieved from the cache server and displayed:                              </P>
+                            <blockquote>
+                              </code></strong><code>Get [CacheableString] -- key: key1 value: first </code>
+                              </p>
+                            </blockquote>
+                            </LI>
+ 				        <LI CLASS="Numbered"> Enter a new value for <code>key1</code>:
+ 				          <blockquote>
+                                  <p><strong><code>put key1 second </code></strong></p>
+ 			              </blockquote>
+ 						  <P> The cache listener reports the events related to the <code>put</code> command, identifying the entry as a string. The cache server is updated with the new value for <code>key1</code>.</P>
+ 			              <blockquote>
+                                <p> <code>--- Received afterUpdate event of: key1<br>
+                                Put string -- key: key1 value: second </code></p>
+ 		                  </blockquote>
+ 				        </LI>
+ 			          </OL>
+ 				      
+ 				    <br>
+ 				      <P><strong>In the first CacheRunner client</strong></P>
+       Get the new <code>key1</code> entry<span class="Numbered"> from the cache server that was added by </span>the second client:
+            <blockquote>
+                <p><strong> <code>get key1</code></strong></p>
+            </blockquote>
+            <P> The key name and new value are retrieved from the cache server: </P>
+            <blockquote> </code></strong><code>Get [CacheableString] -- key: key1 value: second</code></blockquote><br><br>
+            
+    </DIV>
+
+
+    <DIV>
+ 				<H2> Stopping the Cache Server and Clients </H2>
+ 		        <P>To complete the procedures in Part 1 and prepare for Part 2, the Java cache server and the two C# clients must be stopped. However, their sessions need to remain open so the cache server and clients can be started again from those sessions using a different XML configuration file. </P>
+                    <ol>
+                      <li>Stop the cache server, but leave its session open:      
+                          <blockquote>
+                            <strong><code>cacheserver stop</code></strong>
+                          </blockquote>
+ 				  </li>
+                      <li>Stop both C# clients:
+
+                                                <blockquote>
+                                                  <p><strong><code>quit</code></strong></p>
+                                                </blockquote>
+ 				  </li>
+ 				  <li>Close one of the C# client sessions. Only one client is needed for <em>Part 2: Remote Querying</em> and <em>Part 3: High Availability</em>.
+                                                <blockquote>
+                                                  <p><strong><code>exit</code></strong></p>
+                                                </blockquote>
+ 				  </li>
+                    </ol>
+                    <p><a name="part2" id="part2"></a><br> 				  
+                    </p>
+    </DIV>
+
+<DIV>
+<hr size="3" noshade>
+<h1>Part 2: Remote Querying</h1>
+<hr size="3" noshade>
+</DIV>
+
+          <DIV>
+            <P>These procedures introduce some of the querying commands available for the native client. The <code>CacheRunner</code> C# client accepts query strings in input, runs them against the cached data stored on the cache server, then returns the query results to the C# client.</P>
+            <P><br>
+</P>
+   </DIV>
+
+ <DIV>
+                      <H2> <a name="starting_application_processes" id="starting_application_processes"></a>Starting the Cache Server and Client </H2>
+ 				  <P> To start the cache server, complete the following steps using the open cache server and client sessions: </P>
+    </DIV>
+
+ 				<DIV>
+ 				  <OL><LI CLASS="Numbered-1st">
+                        <p>In the cache server session, add the classes for <code>javaobject.jar</code> to your <code>CLASSPATH</code> by entering the following in a single line: </p>
+                        </LI>
+                        <blockquote>
+                          <p><strong> <code>set CLASSPATH=examples\cli_CacheRunner\javaobject.jar;%CLASSPATH%</code></strong></p>
+                        </blockquote>
+                        <p> The file <code>javaobject.jar</code> is required for registering the <code>Portfolio</code> and <code>Position</code> objects on the cache server for remote querying.</p>
+                        <LI CLASS="Numbered">Make sure the <code>cli_CacheRunner</code> directory is still the current working directory. If it isn't, then set it.
+                          <blockquote>
+                              <p><strong> <code>cd examples\cli_CacheRunner</code></strong></p>
+                          </blockquote>
+                        <LI CLASS="Numbered">Start the cache server with  <code>csQueryPortfolios.xml</code>: 					  
+ 					  <blockquote>
+                              <p><strong><code>cacheserver start cache-xml-file=csQueryPortfolios.xml</code></strong></p>
+                          </blockquote>
+                          <P>The cache server is initialized using the configurations in <code><a href="./csQueryPortfolios.xml" target="_blank">csQueryPortfolios.xml</a></code>. The XML file sets up a <code>root</code> region  on the server named <code>DistRegionAck</code> with scope set to <code>distributed-ack</code>. It also creates a <code>Portfolio</code> data object on the server for querying, along with five stock portfolio objects whose keys are the portfolio ID. A message similar to the following appears, indicating that the cache server is running:</P>
+                        </LI>
+                        <blockquote>
+                          <p> <code>Cacheserver pid: 2120 status: running</code></p>
+                        </blockquote>
+                        <LI CLASS="Numbered">In the client session,  start the <code>CacheRunner</code> client with <code><a href="./tcr_cacheless.xml" target="_blank">tcr_cacheless.xml</a></code> to create a <code>Portfolios</code> client region for the querying exercises.
+                          <blockquote>
+                              <p><strong><code>cacherunner.exe tcr_cacheless.xml</code></strong></p>
+                          </blockquote>
+                      </OL>
+    </DIV>
+
+<DIV>
+  <h2>Executing Queries</h2>
+  <P>
+You invoke the <code>execute</code> method on the client to submit several queries that are run on the cache server, then the results are returned to the local client cache. You only need to use one of the <code>CacheRunner</code> clients for querying; the other client can be set aside for now. </P>
+</DIV>
+
+<DIV>
+<P CLASS="Head-D"><strong>
+In the CacheRunner client</strong>:</P>
+
+<ol>
+  <li>Go to the client's <code>Portfolios</code> region:</li>
+  <blockquote>
+    <p><code><strong>chrgn Portfolios</strong></code>  </p>
+  </blockquote>
+  <li>This query returns the status of the cache entries for the <code>/Portfolios</code> region on the cache server. Enter the following command:  </li>
+  <blockquote>
+    <p><code><strong>exec select distinct ID, status from  /Portfolios</strong></code></p>
+  </blockquote>
+      <P>
+      Query output:</P>
+         <blockquote>
+      <p> <code>Columns:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;status<br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 4 || inactive || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 5 || active || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 2 || inactive || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 3 || active || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 1 || active || 
+      </code></p>
+    </blockquote>
+      <li>Run a second query. 
+        This query returns the row IDs on the cache server:
+        <blockquote>
+      <p><strong> <code><strong>exec select distinct ID from /Portfolios</strong></code></strong></p>
+   </blockquote>
+      <P>
+      Query output:</P>
+   <blockquote>
+      <p><code>        Result 1: 1 <br>
+        Result 2: 2 <br>
+        Result 3: 3 <br>
+        Result 4: 4 <br>
+        Result 5: 5
+      </code></p>
+        </blockquote>
+    </li>
+      <li>Run a third query. This query returns the object types for the <code>root/Portfolios</code> region on the cache server:
+        <blockquote>
+          <p><strong>
+          <code><strong>exec select distinct ID, pkid, getType from /Portfolios where 1=1</strong></code></strong></p>
+     </blockquote>
+      <P>
+      Query output:</P>
+         <blockquote>
+      <p> <code>Columns:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pkid&nbsp;&nbsp;&nbsp;&nbsp;getType<br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 2 || 2 || type2 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 1 || 1 || type1 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 3 || 3 || type3 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 5 || 5 || type2 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 4 || 4 || type1 ||</code></p>
+    </blockquote>
+    </li>
+  </ol>
+</DIV>
+<br>
+<DIV>
+  <h2>Executing Region Query Shortcuts </h2>
+  <P>
+In these exercises you use region query shortcut  methods to submit queries to the cache server, then the results are returned to the local client cache. Query shortcuts take the query &quot;predicate&quot; as a parameter (the part after the <code>WHERE</code> clause), or they can take a normal full query. The three query shortcut methods are described below: </P>
+  <UL>
+    <LI CLASS="Bulleted"><code>query</code> &#151; Executes a query and returns the results. <code></code></LI>
+    <LI CLASS="Bulleted"><code> existsValue</code> &#151;Executes a query and returns <code>TRUE</code> or <code>FALSE</code> based on whether any results (rows) are obtained. </LI>
+    <LI CLASS="Bulleted"><code>selectValue</code> &#151;Executes a query and returns only a single result (row). If no results are obtained then it returns <code>NULL</code>. If more than one result (row) is obtained then a <code>QueryException</code> occurs.</LI>
+
+  </UL>
+
+</DIV>
+
+<DIV>
+<P CLASS="Head-D"><strong>
+In the CacheRunner client</strong>:</P>
+
+<ol>
+  <li>
+    Run this <code>query</code> shortcut, which returns the <code>Portfolios</code> objects with an <code>ID</code> of <code>1</code>:  </li>
+  <blockquote>
+    <p><code><strong>
+    query ID=1</strong></code></p>
+  </blockquote>
+      <P>
+      Query result:</P>
+         <blockquote>
+      <p> <code>Result 1: Portfolio [ID=1 status=active type=type1 pkid=1]<br>
+   P1:<br>
+   P2:</code></p>
+    </blockquote>
+      <P>
+      The <code>query</code> shortcut takes the predicate string <code>ID=1</code>, constructs the full query statement, then executes the query.  </P>
+      <li>Run this <code>existsValue</code> shortcut. 
+        The query returns either <code>True</code> or <code>False</code>, depending on whether the result is obtained.
+        <blockquote>
+      <p><strong> <code><strong>existsvalue ID=1</strong></code></strong></p>
+   </blockquote>
+      <P>
+      Query result:        </P>
+         <blockquote>
+           <p><code>      Result is True 
+      </code></p>
+    </blockquote>
+    </li>
+      <li>Run this <code>selectValue</code> shortcut. The query returns the object types  on the cache server for the specified ID:
+        <blockquote>
+          <p><strong>
+          <code><strong>selectValue ID=2</strong></code></strong></p>
+        </blockquote>
+      <P>
+      Query result:</P>
+         <blockquote>
+      <p> <code>Result : Portfolio [ID=2 status=inactive type=type2 pkid=2]<br>
+      P1:<br>
+   P2:
+      </code></p>
+    </blockquote><br>
+    </li>
+  </ol>
+
+</DIV>
+
+    <DIV>
+ 				<H2> Stopping the Cache Server and Client </H2>
+ 		        <P>To complete the procedures in Part 2 and prepare for <em>Part 3: High Availability </em>, the Java cache server and the C# client must be stopped. However, their sessions need to remain open so the cache server and client can be started again using a different XML configuration file. </P>
+                    <ol>
+                      <li>Stop the cache server, but leave its session open:      
+                        <blockquote>
+                          <blockquote>
+                            <p><strong> <code>cacheserver stop</code></strong></p>
+                          </blockquote>
+                      <li>Stop the <code>CacheRunner</code> client and leave its session open:
+
+                                                <blockquote>
+                                                  <p><strong><code>quit</code></strong></p>
+                                                </blockquote>
+ 			    </ol>
+                    <a name="part3" id="part3"></a></DIV>
+
+<DIV>
+<hr size="3" noshade>
+<h1>Part 3: High Availability</h1>
+<hr size="3" noshade>
+</DIV>
+
+ <DIV>
+   <h2>Running CacheRunner for Failover and High Availability </h2>
+   <P>The CacheRunner C# example demonstrates server failover to highly available client queue backups by failing over to a secondary cache server when the primary server becomes unavailable. </P>
+   <P>In the procedures, the lines you type are shown in a <code> <strong>boldface fixed</strong></code> font. System output is shown in a <code>regular fixed</code> font.</P>
+<br>
+ </DIV>
+
+ <DIV>
+   <h2>
+     Starting the Primary and Secondary Cache Servers</h2>
+   <P>
+To start the primary and secondary cache server, complete the following steps in the open cache server session:</P>
+</DIV>
+
+<DIV>
+  <OL><LI CLASS="Numbered">Make sure the <code>cli_CacheRunner</code> directory is still the current working directory. If it isn't, then set it.
+  <blockquote>
+   <p><strong>
+     <code>cd examples\cli_CacheRunner</code></strong></p>
+     </blockquote>
+ </LI>
+<LI CLASS="Numbered">Start the first cache server by running this command:
+   <blockquote>
+     <p><strong>
+       <code>cacheserver start cache-xml-file=cacherunner.xml -dir=gfecs1</code></strong></p>
+      </blockquote>
+   <P>The <code>gfecs1</code> directory contains a copy of <code><a href="./cacherunner.xml" target="_blank">cacherunner.xml</a></code>, which specifies 50505 for the BridgeServer port for the primary cache server.</P>
+ </LI>
+ <LI CLASS="Numbered">Start the second cache server by running this command:
+   <blockquote>
+     <p><strong>
+       <code>cacheserver start cache-xml-file=cacherunner2.xml -dir=gfecs2</code></strong></p>
+      </blockquote>
+   <P>The <code>gfecs2</code> directory contains a copy of <code><a href="./cacherunner2.xml" target="_blank">cacherunner2.xml</a></code>, which specifies 50506 for the BridgeServer port for the secondary cache server.</P>
+ </LI>
+ </OL>
+</DIV>
+
+ <DIV>
+   <h2>
+     Starting the  CacheRunner Client</h2>
+   <P>
+To start the <code>CacheRunner</code> client, complete the following steps in the open client session:</P>
+</DIV>
+
+ <DIV>
+   <OL><LI CLASS="Numbered-1st">
+   <p><span class="Numbered">Make sure the <code>cli_CacheRunner</code> directory is still the current working directory. If it isn't, then set it.</span></p>
+ </LI>
+ <blockquote>
+   <p><strong>
+     <code>cd examples\cli_CacheRunner</code></strong></p>
+   </blockquote>
+
+<LI CLASS="Numbered">
+Start the <code> CacheRunner</code>
+ client, specifying <code>tcr_hacache.xml</code>:
+ <blockquote>
+       <p><strong><code>cacherunner.exe tcr_hacache.xml</code></strong></p>
+   </blockquote>
+ <P>The <code>CacheRunner</code> client is initialized using the settings in <code><a href="./tcr_hacache.xml" target="_blank">tcr_hacache.xml</a></code> in the <code>cli_CacheRunner</code> directory. The XML specifies two cache-level server endpoints that the client connects to (50505 for the primary, and 50506 for the secondary). The <code>redundancy-level=1</code> attribute specifies the number of redundant servers to use in addition to the primary server.<br>
+</P>
+  </LI>
+</OL>
+</DIV>
+
+<DIV>
+  <h2>Performing Cache Operations to Update the Server </h2>
+  <P>
+In these steps you produce data in the <code>CacheRunner</code> local client cache. The cache servers receive the updated values.</P>
+</DIV>
+<DIV>
+  <OL>
+  <LI CLASS="Numbered">In the <code>CacheRunner</code> client, change it to the <code>listenerWriterLoader</code> region:
+    <blockquote>
+        <p><strong><code> chrgn listenerWriterLoader</code></strong>    </p>
+    </blockquote>
+  <LI CLASS="Numbered">Add an entry to the region:
+    <blockquote>
+      <p><strong>
+        <code>put entry1 ball str</code></strong></p>
+      </blockquote>
+    <P>
+      This creates an entry whose key is <code> entry1</code>
+      and whose value is the string <code>ball</code>. The cache servers are updated with the new entry. <br>
+</P>
+  </LI>
+  </OL>
+
+</DIV>
+
+<DIV>
+  <h2>Stopping the Primary Cache Server to Initiate Failover </h2>
+  <P>
+In this procedure you stop the primary cache server to initiate a server failover condition.</P>
+</DIV>
+<DIV>
+  <OL><LI CLASS="Numbered">Stop the primary cache server by running this command in the server session:
+    <blockquote>
+      <p><strong>
+        <code>cacheserver stop -dir=gfecs1</code></strong></p>
+      </blockquote>
+    <P>
+      Failover sets the secondary server as the new primary server:</P>
+  </LI>
+  <LI CLASS="Numbered">
+    In the client session, add an entry to the region:
+      <blockquote>
+        <p><strong>
+        <code>put entry2 bat str </code></strong></p>
+      </blockquote>
+     <P>
+      This creates an entry whose key is <code> entry2</code> and whose value is the string <code>bat</code>. The cache server is updated with the new entry.</P>
+  </LI>
+    <br>
+</OL>
+
+</DIV>
+
+<DIV>
+  <h2>Restarting the Stopped Cache Server and Initiating Another Failover </h2>
+  <P>
+Now restart the cache server that was previously stopped so both servers are running, then stop the other server to produce another failover condition.</P>
+</DIV>
+<DIV>
+  <OL>
+    <LI CLASS="Numbered">Restart the stopped cache server by running this command in the server session:
+      <blockquote>
+      <p><strong><code>cacheserver start cache-xml-file=cacherunner.xml -dir=gfecs1</code></strong></p>
+      </blockquote>
+    <P>
+      Now both cache servers are running.</P>
+  </LI>
+  <LI CLASS="Numbered">Stop the other cache server by running this command in the server session:
+    <blockquote>
+        <p><strong><code>cacheserver stop -dir=gfecs2</code></strong></p>
+      </blockquote>
+     <P>
+      Failover occurs, and the restarted server is now the only server running.</P>
+  </LI>
+  <LI CLASS="Numbered">In the client session, get the new entry from the server:
+    <blockquote>
+        <p><strong><code>get entry2</code></strong></p>
+      </blockquote>
+                            <P> The key name and value are retrieved from the cache server and displayed:                              </P>
+                            <blockquote>
+                              </code></strong><code>Get [CacheableString] -- key: entry2 value: bat </code>
+                              </p>
+                            </blockquote>
+  </LI>
+    <br>
+</OL>
+
+</DIV>
+
+ 	  <DIV>
+ 				<H2> Closing the Client and the Cache Server </H2>
+ 				  <OL>
+ 				    <LI CLASS="Numbered">In the client session, quit the  <code>CacheRunner</code> application and then exit the session:
+                          <blockquote>
+          <p><strong> <code>quit</code></strong><br>
+ 	  <strong> <code>exit</code></strong></p>
+      </blockquote>
+      </LI>
+
+                            <LI CLASS="Numbered">In the server session, stop the remaining cache server and then exit the session:
+                              <blockquote>
+                                <p><strong><code>cacheserver stop -dir=gfecs1</code></strong><br>
+                                <strong><code>exit</code></strong></p>
+                              </blockquote>
+                        </LI>
+            </OL>
+    </DIV>
+
+<br>
+       <DIV>
+            <H2> Changing System Parameters</H2>
+         <P>This product ships configured to run with default system properties. If you need to run in a non-default configuration, GemFire also takes a system-level configuration file. Copy the <code>gfcpp.properties</code> file into your <code>cli_CacheRunner</code> directory from the native client <code>defaultSystem</code> directory and edit it as needed. For example, to change the name of the <code>cache.xml</code> file, uncomment this line and change the file name:</P>
+         <P> <code>#cache-xml-file=cache.xml</code></P>
+         <P>When you are finished with the example, delete the copied <code>gfcpp.properties</code> file from the <code>cli_CacheRunner</code> directory so it can run with the default configuration.<br>
+           <br>
+            </P>
+       </DIV>
+       <a href="#Top">Top</a>
+          <P>&nbsp;</P>
+<p><span class=GramE>Copyright &#169; 2006-2014 Pivotal Software, Inc. All rights reserved.
+This product is protected by U.S. and international copyright and intellectual
+property laws. Pivotal products are covered by one or more patents listed at http://www.pivotal.io/patents. </p>
+	</BODY>
+</HTML>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/CqQuery/CqQuery.cs
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/CqQuery/CqQuery.cs b/geode-client-native/examples/clicache/CqQuery/CqQuery.cs
new file mode 100644
index 0000000..5b516ac
--- /dev/null
+++ b/geode-client-native/examples/clicache/CqQuery/CqQuery.cs
@@ -0,0 +1,325 @@
+/*
+ * The CqQuery Example.
+ *
+ * This example takes the following steps:
+ *
+ */
+
+// Use standard namespaces
+using System;
+
+// Use the GemFire namespace
+using GemStone.GemFire.Cache;
+
+// Use the "Tests" namespace for the query objects.
+using GemStone.GemFire.Cache.Tests;
+
+namespace GemStone.GemFire.Cache.Examples
+{
+  // The CqQuery example.
+
+  //User Listener
+  public class MyCqListener : ICqListener
+  {
+    private int m_updateCnt;
+    private int m_createCnt;
+    private int m_destroyCnt;
+    private int m_errorCnt;
+    private int m_eventCnt;
+    private int m_id;
+    bool m_verbose;
+    public MyCqListener(int id, bool verbose)
+    {
+      m_updateCnt = 0;
+      m_createCnt = 0;
+      m_destroyCnt = 0;
+      m_errorCnt = 0;
+      m_eventCnt = 0;
+      m_id = id;
+      m_verbose = verbose;
+    }
+    public virtual void OnEvent(CqEvent ev)
+    {
+      m_eventCnt++;
+      Portfolio val = ev.getNewValue() as Portfolio;
+      CacheableString key = ev.getKey() as CacheableString;
+      CqOperationType opType = ev.getQueryOperation();
+      CqQuery cq = ev.getCq();
+      string opStr = "DESTROY";
+      if (opType == CqOperationType.OP_TYPE_CREATE) {
+        m_createCnt++;
+        opStr = "CREATE";
+      }
+      else if (opType == CqOperationType.OP_TYPE_UPDATE) {
+        m_updateCnt++;
+        opStr = "UPDATE";
+      }
+      else if (opType == CqOperationType.OP_TYPE_DESTROY) {
+        m_destroyCnt++;
+        opStr = "DESTROY";
+      }
+      if (m_eventCnt % 5000 == 0) {
+        if (m_verbose == true) {
+          Console.WriteLine("MyCqListener{0}::OnEvent called with key {1}, value ({2},{3}), op {4}.", m_id, key.Value, val.ID, val.Pkid, opStr);
+        }
+        else {
+          Console.WriteLine("cq{0}, listener{1}::OnEvent update count={2}, create Count={3}, destroy Count={4}, total count={5}", cq.Name, m_id, m_updateCnt, m_createCnt, m_destroyCnt, m_eventCnt);
+        }
+        Console.WriteLine("*******Type \'q\' to quit !!!! ******");
+      }
+    }
+    public virtual void OnError(CqEvent ev)
+    {
+      m_errorCnt++;
+      m_eventCnt++;
+      Console.WriteLine("MyCqListener{0}::OnError called", m_id);
+    }
+    public virtual void Close()
+    {
+      m_eventCnt++;
+      Console.WriteLine("MyCqListener{0}::close called", m_id);
+    }
+  }
+
+  class MyCacheListener : CacheListenerAdapter
+  {
+    private int m_eventCount;
+    private bool m_verbose;
+    private void check(EntryEvent ev, string opStr)
+    {
+      m_eventCount++;
+      Portfolio val = ev.NewValue as Portfolio;
+      CacheableString key = ev.Key as CacheableString;
+      if (m_eventCount % 3000 == 0) {
+        if (m_verbose == true) {
+          Console.WriteLine("MyCacheListener called with key {0}, value ({1},{2}), op {3}.", key.Value, val.ID, val.Pkid, opStr);
+        }
+        else {
+          Console.WriteLine("MyCacheListener::event count={0}", m_eventCount);
+        }
+        Console.WriteLine("*******Type \'q\' to quit !!!! ******");
+      }
+    }
+    public MyCacheListener(bool verbose)
+    {
+      m_eventCount = 0;
+      m_verbose = verbose;
+    }
+
+    public override void AfterCreate(EntryEvent ev)
+    {
+      check(ev, "AfterCreate");
+    }
+    public override void AfterUpdate(EntryEvent ev)
+    {
+      check(ev, "AfterUpdate");
+    }
+    public override void AfterDestroy(EntryEvent ev)
+    {
+      check(ev, "AfterDestroy");
+    }
+    public override void AfterInvalidate(EntryEvent ev)
+    {
+      check(ev, "AfterInvalidate");
+    }
+  }
+  class ContinuousQuery
+  {
+    private static string[] cqNames = new string[8]{
+  "MyCq_0",
+  "MyCq_1",
+  "MyCq_2",
+  "MyCq_3",
+  "MyCq_4",
+  "MyCq_5",
+  "MyCq_6",
+  "MyCq_7"
+};
+
+    private static string[] queryStrings = new string[8]{
+  "select * from /Portfolios p where p.ID < 4",
+  "select * from /Portfolios p where p.ID < 9",
+  "select * from /Portfolios p where p.ID < 12",
+  "select * from /Portfolios p where p.ID < 3",
+  "select * from /Portfolios p where p.ID < 14",
+  "select * from /Portfolios p where p.ID < 5",
+  "select * from /Portfolios p where p.ID < 6",
+  "select * from /Portfolios p where p.ID < 7"
+};
+    static void Main(string[] args)
+    {
+      bool verbose = false;
+      if (args.Length == 1 && args[0] == "-v")
+        verbose = true;
+      try {
+        // Connect to the GemFire Distributed System using the settings from the gfcpp.properties file by default.
+        Properties prop = Properties.Create();
+        prop.Insert("cache-xml-file", "clientCqQuery.xml");
+        CacheFactory cacheFactory = CacheFactory.CreateCacheFactory(prop);
+        Cache cache = cacheFactory.SetSubscriptionEnabled(true)
+                                  .Create();
+
+        Console.WriteLine("Created the GemFire Cache");
+
+        // Get the Portfolios Region from the Cache which is declared in the Cache XML file.
+        Region region = cache.GetRegion("Portfolios");
+
+        Console.WriteLine("Obtained the Region from the Cache");
+
+        region.GetAttributesMutator().SetCacheListener(new MyCacheListener(verbose));
+
+        // Register our Serializable/Cacheable Query objects, viz. Portfolio and Position.
+        Serializable.RegisterType(Portfolio.CreateDeserializable);
+        Serializable.RegisterType(Position.CreateDeserializable);
+
+        //Register all keys
+        region.RegisterAllKeys();
+
+        Console.WriteLine("Registered Serializable Query Objects");
+
+        // Populate the Region with some Portfolio objects.
+        Portfolio port1 = new Portfolio(1 /*ID*/, 10 /*size*/);
+        Portfolio port2 = new Portfolio(2 /*ID*/, 20 /*size*/);
+        Portfolio port3 = new Portfolio(3 /*ID*/, 30 /*size*/);
+        region.Put("Key1", port1);
+        region.Put("Key2", port2);
+        region.Put("Key3", port3);
+
+        Console.WriteLine("Populated some Portfolio Objects");
+
+        // Get the QueryService from the Cache.
+        QueryService qrySvc = cache.GetQueryService();
+
+        Console.WriteLine("Got the QueryService from the Cache");
+
+        //create CqAttributes with listener
+        CqAttributesFactory cqFac = new CqAttributesFactory();
+        ICqListener cqLstner = new MyCqListener(0, verbose);
+        cqFac.AddCqListener(cqLstner);
+        CqAttributes cqAttr = cqFac.Create();
+
+        //create a new cqQuery
+        CqQuery qry = qrySvc.NewCq(cqNames[0], queryStrings[0], cqAttr, true);
+
+        // Execute a CqQuery with Initial Results
+        ICqResults results = qry.ExecuteWithInitialResults();
+
+        Console.WriteLine("ResultSet Query returned {0} rows", results.Size);
+
+        SelectResultsIterator iter = results.GetIterator();
+
+        while (iter.HasNext) {
+          IGFSerializable item = iter.Next();
+
+          if (item != null) {
+            Struct st = item as Struct;
+
+            CacheableString key = st["key"] as CacheableString;
+
+            Console.WriteLine("Got key " + key.Value);
+
+            Portfolio port = st["value"] as Portfolio;
+
+            if (port == null) {
+              Position pos = st["value"] as Position;
+              if (pos == null) {
+                CacheableString cs = st["value"] as CacheableString;
+                if (cs == null) {
+                  Console.WriteLine("Query got other/unknown object.");
+                }
+                else {
+                  Console.WriteLine("Query got string : {0}.", cs.Value);
+                }
+              }
+              else {
+                Console.WriteLine("Query got Position object with secId {0}, shares {1}.", pos.SecId, pos.SharesOutstanding);
+              }
+            }
+            else {
+              Console.WriteLine("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+            }
+          }
+        }        
+        //Stop the cq
+        qry.Stop();
+        //Restart the cq
+        qry.Execute();
+
+        for (int i = 1; i < cqNames.Length; i++) {
+          ICqListener cqLstner1 = new MyCqListener(i, verbose);
+          cqFac.AddCqListener(cqLstner1);
+          cqAttr = cqFac.Create();
+          qry = qrySvc.NewCq(cqNames[i], queryStrings[i], cqAttr, true);
+        }
+
+        qry = qrySvc.GetCq(cqNames[6]);
+        cqAttr = qry.GetCqAttributes();
+        ICqListener[] vl = cqAttr.getCqListeners();
+        Console.WriteLine("number of listeners for cq[{0}] is {1}", cqNames[6], vl.Length);
+        qry = qrySvc.GetCq(cqNames[0]);
+        CqAttributesMutator cqam = qry.GetCqAttributesMutator();
+        for (int i = 0; i < vl.Length; i++) {
+          cqam.AddCqListener(vl[i]);
+        }
+
+        //Stop the cq
+        qry.Stop();
+
+        //Start all Cq Query
+        qrySvc.ExecuteCqs();
+
+        for (int i = 0; i < cqNames.Length; i++) {
+          Console.WriteLine("get info for cq[{0}]:", cqNames[i]);
+          CqQuery cqy = qrySvc.GetCq(cqNames[i]);
+          CqStatistics cqStats = cqy.GetStatistics();
+          Console.WriteLine("Cq[{0}]: CqStatistics: numInserts[{1}], numDeletes[{2}], numUpdates[{3}], numEvents[{4}]", 
+                              cqNames[i], cqStats.numInserts(), cqStats.numDeletes(), cqStats.numUpdates(), cqStats.numEvents());
+        }
+
+        CqServiceStatistics serviceStats = qrySvc.GetCqStatistics();
+        Console.WriteLine("numCqsActive={0}, numCqsCreated={1}, numCqsClosed={2}, numCqsStopped={3}, numCqsOnClient={4}", 
+                              serviceStats.numCqsActive(), serviceStats.numCqsCreated(), serviceStats.numCqsClosed(), 
+                              serviceStats.numCqsStopped(), serviceStats.numCqsOnClient());
+
+        while (true) {
+          Console.WriteLine("*******Type \'q\' to quit !!!! ******");
+          ConsoleKeyInfo ckey;
+          ckey = Console.ReadKey(true);
+          if (ckey.Key == ConsoleKey.Q)
+            break;
+        }
+
+        //Stop all cqs
+        qrySvc.StopCqs();
+
+        for (int i = 0; i < cqNames.Length; i++) {
+          Console.WriteLine("get info for cq[{0}]:", cqNames[i]);
+          CqQuery cqy = qrySvc.GetCq(cqNames[i]);
+          cqAttr = qry.GetCqAttributes();
+          vl = cqAttr.getCqListeners();
+          Console.WriteLine("number of listeners for cq[{0}] is {1}", cqNames[i], vl.Length);
+          CqStatistics cqStats = cqy.GetStatistics();
+          Console.WriteLine("Cq[{0}]: CqStatistics: numInserts[{1}], numDeletes[{2}], numUpdates[{3}], numEvents[{4}]", 
+                         cqNames[i], cqStats.numInserts(), cqStats.numDeletes(), cqStats.numUpdates(), cqStats.numEvents());
+        }
+
+        //Close all cqs
+        qrySvc.CloseCqs();
+
+        Console.WriteLine("numCqsActive={0}, numCqsCreated={1}, numCqsClosed={2}, numCqsStopped={3}, numCqsOnClient={4}", 
+                         serviceStats.numCqsActive(), serviceStats.numCqsCreated(), serviceStats.numCqsClosed(), serviceStats.numCqsStopped(),
+                         serviceStats.numCqsOnClient());
+
+        // Close the GemFire Cache.
+        cache.Close();
+
+        Console.WriteLine("Closed the GemFire Cache");
+
+      }
+      // An exception should not occur
+      catch (GemFireException gfex) {
+        Console.WriteLine("CqQuery GemFire Exception: {0}", gfex.Message);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj b/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj
new file mode 100644
index 0000000..cd255fd
--- /dev/null
+++ b/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj
@@ -0,0 +1,97 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{D8F67104-CDDE-433F-A8EE-470A92180AA9}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>GemStone.GemFire.Cache.Examples</RootNamespace>
+    <AssemblyName>CqQuery</AssemblyName>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CqQuery\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CqQuery\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\CqQuery\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\CqQuery\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CqQuery\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CqQuery\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\CqQuery\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\CqQuery\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\..\..\tests\clicache\TestObject\Portfolio.cs">
+      <Link>Portfolio.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\tests\clicache\TestObject\Position.cs">
+      <Link>Position.cs</Link>
+    </Compile>
+    <Compile Include="CqQuery.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\vs_projects\gfclicache\gfclicache.vcproj">
+      <Project>{B274E3B1-6A09-4322-952B-8BDA712892CE}</Project>
+      <Name>gfclicache</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="..\..\dist\cqQuery\XMLs\clientCqQuery.xml">
+      <Link>clientCqQuery.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj.user
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj.user b/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj.user
new file mode 100644
index 0000000..99f5303
--- /dev/null
+++ b/geode-client-native/examples/clicache/CqQuery/CqQuery.csproj.user
@@ -0,0 +1,6 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ReferencePath>$(OSBUILDDIR)\hidden\lib\</ReferencePath>
+    <ProjectView>ProjectFiles</ProjectView>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/CqQuery/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/CqQuery/Properties/AssemblyInfo.cs b/geode-client-native/examples/clicache/CqQuery/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1721ef5
--- /dev/null
+++ b/geode-client-native/examples/clicache/CqQuery/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("GemFireCqQuery")]
+[assembly: AssemblyDescription("GemFire Simple Bank Example")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("GemStone Systems Inc.")]
+[assembly: AssemblyProduct("GemFireCqQuery")]
+[assembly: AssemblyCopyright("Copyright © GemStone Systems Inc. 2008")]
+[assembly: AssemblyTrademark("All Rights Reserved")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("446a6d15-e898-4fd5-8493-2076da55bd84")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("9.0.0.0")]
+[assembly: AssemblyFileVersion("9.0.0.0")]

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/CqQuery/README.html
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/CqQuery/README.html b/geode-client-native/examples/clicache/CqQuery/README.html
new file mode 100755
index 0000000..f85c9b3
--- /dev/null
+++ b/geode-client-native/examples/clicache/CqQuery/README.html
@@ -0,0 +1,420 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 11">
+<meta name=Originator content="Microsoft Word 11">
+<link rel=File-List href="README_files/filelist.xml">
+<title>cqQuery: Pivotal GemFire&#174; Native Client Example</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+  <o:Author>qhe</o:Author>
+  <o:Template>Normal</o:Template>
+  <o:LastAuthor>qhe</o:LastAuthor>
+  <o:Revision>4</o:Revision>
+  <o:TotalTime>13</o:TotalTime>
+  <o:Created>2008-10-29T17:56:00Z</o:Created>
+  <o:LastSaved>2008-10-29T18:10:00Z</o:LastSaved>
+  <o:Pages>1</o:Pages>
+  <o:Words>632</o:Words>
+  <o:Characters>3608</o:Characters>
+  <o:Company>GemStone Systems, Inc.</o:Company>
+  <o:Lines>30</o:Lines>
+  <o:Paragraphs>8</o:Paragraphs>
+  <o:CharactersWithSpaces>4232</o:CharactersWithSpaces>
+  <o:Version>11.6360</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+  <w:SpellingState>Clean</w:SpellingState>
+  <w:GrammarState>Clean</w:GrammarState>
+  <w:ValidateAgainstSchemas/>
+  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
+ </w:LatentStyles>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ @font-face
+	{font-family:Wingdings;
+	panose-1:5 0 0 0 0 0 0 0 0 0;
+	mso-font-charset:2;
+	mso-generic-font-family:auto;
+	mso-font-pitch:variable;
+	mso-font-signature:0 268435456 0 0 -2147483648 0;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+	{mso-style-parent:"";
+	margin:0in;
+	margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:12.0pt;
+	font-family:"Times New Roman";
+	mso-fareast-font-family:"Times New Roman";}
+h1
+	{mso-margin-top-alt:auto;
+	margin-right:0in;
+	mso-margin-bottom-alt:auto;
+	margin-left:0in;
+	mso-pagination:widow-orphan;
+	mso-outline-level:1;
+	font-size:24.0pt;
+	font-family:"Times New Roman";
+	font-weight:bold;}
+h2
+	{mso-margin-top-alt:auto;
+	margin-right:0in;
+	mso-margin-bottom-alt:auto;
+	margin-left:0in;
+	mso-pagination:widow-orphan;
+	mso-outline-level:2;
+	font-size:18.0pt;
+	font-family:"Times New Roman";
+	font-weight:bold;}
+h4
+	{mso-margin-top-alt:auto;
+	margin-right:0in;
+	mso-margin-bottom-alt:auto;
+	margin-left:0in;
+	mso-pagination:widow-orphan;
+	mso-outline-level:4;
+	font-size:12.0pt;
+	font-family:"Times New Roman";
+	font-weight:bold;}
+a:link, span.MsoHyperlink
+	{color:blue;
+	text-decoration:underline;
+	text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+	{color:blue;
+	text-decoration:underline;
+	text-underline:single;}
+p
+	{mso-margin-top-alt:auto;
+	margin-right:0in;
+	mso-margin-bottom-alt:auto;
+	margin-left:0in;
+	mso-pagination:widow-orphan;
+	font-size:12.0pt;
+	font-family:"Times New Roman";
+	mso-fareast-font-family:"Times New Roman";}
+code
+	{font-family:"Courier New";
+	mso-ascii-font-family:"Courier New";
+	mso-fareast-font-family:"Times New Roman";
+	mso-hansi-font-family:"Courier New";
+	mso-bidi-font-family:"Courier New";}
+span.SpellE
+	{mso-style-name:"";
+	mso-spl-e:yes;}
+span.GramE
+	{mso-style-name:"";
+	mso-gram-e:yes;}
+@page Section1
+	{size:8.5in 11.0in;
+	margin:1.0in 1.25in 1.0in 1.25in;
+	mso-header-margin:.5in;
+	mso-footer-margin:.5in;
+	mso-paper-source:0;}
+div.Section1
+	{page:Section1;}
+ /* List Definitions */
+ @list l0
+	{mso-list-id:162935388;
+	mso-list-template-ids:1394253234;}
+@list l0:level1
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0B7;
+	mso-level-tab-stop:.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;
+	mso-ansi-font-size:10.0pt;
+	font-family:Symbol;}
+@list l1
+	{mso-list-id:226569577;
+	mso-list-template-ids:-1947287032;}
+@list l1:level2
+	{mso-level-text:"%2\)";
+	mso-level-tab-stop:1.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l2
+	{mso-list-id:1273512360;
+	mso-list-template-ids:699437352;}
+@list l3
+	{mso-list-id:1483305081;
+	mso-list-template-ids:1760043970;}
+ol
+	{margin-bottom:0in;}
+ul
+	{margin-bottom:0in;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+	{mso-style-name:"Table Normal";
+	mso-tstyle-rowband-size:0;
+	mso-tstyle-colband-size:0;
+	mso-style-noshow:yes;
+	mso-style-parent:"";
+	mso-padding-alt:0in 5.4pt 0in 5.4pt;
+	mso-para-margin:0in;
+	mso-para-margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:10.0pt;
+	font-family:"Times New Roman";
+	mso-ansi-language:#0400;
+	mso-fareast-language:#0400;
+	mso-bidi-language:#0400;}
+</style>
+<![endif]-->
+<meta http-equiv=Content-Style-Type content="text/css">
+</head>
+
+<IMG SRC="../../../docs/PIVOTAL_GemFire_190x81.png" BORDER="0">
+<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<div>
+
+<h1 align=center style='text-align:center'><span class=SpellE>CqQuery</span></h1>
+
+<h2 align=center style='text-align:center'>Pivotal GemFire Native Client </h2>
+
+<h2 align=center style='text-align:center'>C# Programming Example</h2>
+
+</div>
+
+
+<div>
+
+<h2>About the <span class=SpellE>CqQuery</span> Example </h2>
+
+<p>The <span class=SpellE><code><span style='font-size:10.0pt'>CqQuery</span></code></span>
+example is a C# program that uses Microsoft .NET Framework 4.0 to access the
+GemFire C++ API for continuous query.</p>
+
+<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>
+
+<p><em>Microsoft .NET Framework 4.0 must be installed before running this
+example. For information about installing the .NET Framework, see the </em>GemFire
+Native Client User's Guide<em>.</em> </p>
+
+</blockquote>
+
+<p>The client application comes with a cache configuration file, <code><span
+style='font-size:10.0pt'><a href="clientCqQuery.xml" target="_blank"><span
+class=SpellE>clientCqQuery.xml</span></a></span></code>, which is configured to
+create a root region and establish the native client endpoints to the
+locally-run server by specifying <code><span style='font-size:10.0pt'>localhost<span
+class=GramE>:50505</span></span></code>. <span class=GramE>If java server is
+located on another host, change <span class=SpellE>localhost</span> to that
+host accordingly.</span></p>
+
+<p>The <span class=SpellE><code><span style='font-size:10.0pt'>CqQuery</span></code></span>
+cache listens for client requests at a specific port (see <code><span
+style='font-size:10.0pt'><a
+href="serverCqQuery.xml" target="_blank"><span
+class=SpellE>serverCqQuery.xml</span></a></span></code>). The client connects
+to the cache server's port.</p>
+
+</div>
+
+<div>
+
+<h2><a name="configuring_environment"></a>Configuring the Environment </h2>
+
+<p>Examples that interact with a Java cache server require specific environment
+configurations so the Java cache server will run properly. Follow the
+configuration steps listed below that apply to your operating system: </p>
+
+</div>
+
+<div>
+
+<ol start=1 type=1>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
+     mso-list:l3 level1 lfo2;tab-stops:list .5in'>From the GemFire
+     product installation directory, configure your environment settings by
+     following the steps in <code><span style='font-size:10.0pt'>examples/EnvSetup.html</span></code>.
+     Refer to the developer's guide if you need help with this step.</li>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
+     mso-list:l3 level1 lfo2;tab-stops:list .5in'>Set the <code><span
+     style='font-size:10.0pt'>JAVA_HOME</span></code> and <code><span
+     style='font-size:10.0pt'>GF_JAVA_HOME</span></code> environment variables
+     to your installed Java JRE or JDK. See the Installation chapter of the <em>GemFire
+     Users's Guide</em> for the versions of Java that
+     are compatible with GemFire. The <code><span style='font-size:
+     10.0pt'>JAVA_HOME</span></code> setting is for your applications, and <code><span
+     style='font-size:10.0pt'>GF_JAVA_HOME</span></code> is for the GemFire
+     scripts. You must have a compatible Java JRE or JDK installed and you must
+     set <code><span style='font-size:10.0pt'>JAVA_HOME</span></code> and <code><span
+     style='font-size:10.0pt'>GF_JAVA_HOME</span></code> to point to it.</li>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
+     mso-list:l3 level1 lfo2;tab-stops:list .5in'>Add <code><span
+     style='font-size:10.0pt'>$JAVA_HOME/bin</span></code> to the start of your
+     <code><span style='font-size:10.0pt'>PATH</span></code>. </li>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+     mso-list:l3 level1 lfo2;tab-stops:list .5in'>Add the GemFire <span
+     class=SpellE>quickstart</span> classes to your <code><span
+     style='font-size:10.0pt'>CLASSPATH</span></code>. </li>
+</ol>
+
+<p style='margin-left:.5in'><span class=GramE><strong><span style='font-size:
+10.0pt;font-family:"Courier New"'>set</span></strong></span><strong><span
+style='font-size:10.0pt;font-family:"Courier New"'> CLASSPATH=%GEMFIRE%\<span
+class=SpellE>quickstart\classes;%CLASSPATH</span>%</span></strong></p>
+
+<p>The following is a list of the environment configuration commands for the <span
+class=SpellE><code><span style='font-size:10.0pt'>CqQuery</span></code></span>
+example. Choose the set of commands that are appropriate for your operating
+system. The text that you type is shown in bold. These configurations only need
+to be performed for the sessions that invoke the Java cache server.</p>
+
+<p><strong>Bourne and <span class=SpellE>Korn</span> shells (<span
+class=SpellE>sh</span>, <span class=SpellE>ksh</span>, bash)</strong></p>
+
+<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>
+
+<p><code><span style='font-size:10.0pt'>% </span></code><span class=SpellE><strong><span
+style='font-size:10.0pt;font-family:"Courier New"'>cd</span></strong></span><strong><span
+style='font-size:10.0pt;font-family:"Courier New"'> <span class=SpellE>GemFireInstallDirectory</span></span></strong><span
+style='font-size:10.0pt;font-family:"Courier New"'><br>
+<code>% </code><strong><span style='font-family:"Courier New"'>CLASSPATH=$CLASSPATH<span
+class=GramE>:$</span>GEMFIRE/<span class=SpellE>quickstart</span>/classes;
+export CLASSPATH</span></strong><br>
+<code>% </code><span class=SpellE><strong><span style='font-family:"Courier New"'>cd</span></strong></span><strong><span
+style='font-family:"Courier New"'> $GEMFIRE/<span class=SpellE>quickstart</span></span></strong><br>
+<code>% </code><strong><span style='font-family:"Courier New"'>JAVA_HOME=&lt;Installed
+JRE PATH&gt;; export JAVA_HOME</span></strong><br>
+<code>% </code><strong><span style='font-family:"Courier New"'>GF_JAVA_HOME=$JAVA_HOME;
+export GF_JAVA_HOME</span></strong><br>
+<code>% </code><strong><span style='font-family:"Courier New"'>PATH=$JAVA_HOME/<span
+class=SpellE>bin:$PATH</span>; export PATH</span></strong></span></p>
+
+</blockquote>
+
+<p><strong>Windows</strong></p>
+
+<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>
+
+<p><code><span style='font-size:10.0pt'>&gt; </span></code><span class=SpellE><span
+class=GramE><strong><span style='font-size:10.0pt;font-family:"Courier New"'>cd</span></strong></span></span><strong><span
+style='font-size:10.0pt;font-family:"Courier New"'> <span class=SpellE>GemFireInstallDirectory</span></span></strong><span
+style='font-size:10.0pt;font-family:"Courier New"'><br>
+<code>&gt; </code><strong><span style='font-family:"Courier New"'>set
+CLASSPATH=%GEMFIRE%\<span class=SpellE>quickstart\classes;%CLASSPATH</span>%</span></strong><br>
+<code>&gt; </code><span class=SpellE><strong><span style='font-family:"Courier New"'>cd</span></strong></span><strong><span
+style='font-family:"Courier New"'> %GEMFIRE%\<span class=SpellE>quickstart</span></span></strong><br>
+<code>&gt; </code><strong><span style='font-family:"Courier New"'>set
+JAVA_HOME=&lt;Installed JRE PATH&gt;</span></strong><br>
+<code>&gt; </code><strong><span style='font-family:"Courier New"'>set
+GF_JAVA_HOME=%JAVA_HOME%</span></strong><br>
+<code>&gt; </code><strong><span style='font-family:"Courier New"'>set
+PATH=%JAVA_HOME%\<span class=SpellE>bin;%PATH</span>%</span></strong><code> </code></span></p>
+
+</blockquote>
+
+</div>
+
+<div>
+
+<h2>Starting <span class=SpellE>CqQuery</span> </h2>
+
+<p>To run the <span class=SpellE><code><span style='font-size:10.0pt'>CqQuery</span></code></span>
+example, create a session from the GemFire product directory and
+complete the following steps. Throughout this example, when you're prompted to enter the NativeClient_InstallDir\SampleCode directory, replace the NativeClient_InstallDir\SampleCode with the actual path to unzipped location of the Distribution SampleCode.  Note that in the following steps, except CqQuery.exe, all other programs can be run on other operating system machines.</p>
+
+<p>This first session starts the Java cache server. <code><span
+style='mso-ansi-font-size:12.0pt;mso-bidi-font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></code></p>
+
+</div>
+
+<div>
+
+<p style='margin-left:.5in'><span class=SpellE><code><b><span
+style='font-size:10.0pt'>cd NativeClient_InstallDir\SampleCode\examples\cqQuery</span></b></code></span><b><span
+style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></b></p>
+
+
+<ol start=1 type=1>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+     mso-list:l2 level1 lfo3;tab-stops:list .5in'>Start Java server: </li>
+</ol>
+
+<p style='margin-left:.5in'><span class=SpellE><code><b><span
+style='font-size:10.0pt'>startServer.bat</span></b></code></span><b><span
+style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></b></p>
+
+<ol start=2 type=1>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+     mso-list:l2 level1 lfo3;tab-stops:list .5in'>Create another session and go
+     to the <span class=SpellE><code><span style='font-size:10.0pt'>cli_CqQuery</span></code></span>
+     example directory: </li>
+</ol>
+
+<p style='margin-left:.5in'><span class=SpellE><span class=GramE><code><b><span
+style='font-size:10.0pt'>cd</span></b></code></span></span><code><b><span
+style='font-size:10.0pt'> <span class=SpellE>NativeClient_InstallDir\SampleCode\examples\cli_CqQuery</span></span></b></code></p>
+
+<ol start=3 type=1>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+     mso-list:l2 level1 lfo3;tab-stops:list .5in'>Start the <span class=SpellE><code><span
+     style='font-size:10.0pt'>CqQuery</span></code></span> application:</li>
+</ol>
+
+<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>
+
+<p><code><b><span style='margin-left:.1in;font-size:10.0pt'>CqQuery.exe</span></b></code><b><span
+style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></b></p>
+
+</blockquote>
+
+<ol start=4 type=1>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+     mso-list:l2 level1 lfo3;tab-stops:list .5in'>Start the <code><span
+     style='font-size:10.0pt'>updater</span></code> application. In another window:</li>
+</ol>
+<br>
+<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+margin-left:.5in'><span class=SpellE><span class=GramE><code><b><span
+style='font-size:10.0pt'>cd</span></b></code></span></span><code><b><span
+style='font-size:10.0pt'> <span class=SpellE>NativeClient_InstallDir\SampleCode\examples\cqQuery</span><o:p></o:p></span></b></code></p>
+
+<p style="margin-left:.25in"><code><b><span style='font-size:10.0pt'><span style='mso-spacerun:yes'>��
+</span><span class=SpellE>runUpdater.bat</span> &lt;<span class=SpellE>itr</span>
+number&gt;, where <span class=SpellE>itr</span> number is the number of
+iterations you want this program to run, <span class=SpellE>e.g</span>, 500.</span></b></code><code><span
+style='mso-ansi-font-size:12.0pt;mso-bidi-font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></code></p>
+
+<ol start=5 type=1>
+ <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+     mso-list:l2 level1 lfo3;tab-stops:list .5in'>Stop Java server. In the window where java server was started:</li>
+</ol>
+<br>
+<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
+margin-left:.5in'><span class=SpellE><code><b><span style='font-size:10.0pt'>stopServer.bat</span></b></code></span></p>
+<br>
+</div>
+
+<p class=MsoNormal><a href="#Top">Top</a> </p>
+
+<p>
+<p><span class=GramE>Copyright &#169; 2005-2014 Pivotal Software, Inc. All rights reserved.  This product is protected by U.S. and international copyright and intellectual property laws. Pivotal products are covered by one or more patents listed at http://www.pivotal.io/patents. </p>
+</div>
+
+</body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.cs
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.cs b/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.cs
new file mode 100644
index 0000000..a391949
--- /dev/null
+++ b/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.cs
@@ -0,0 +1,217 @@
+/*
+ * The ExecuteFunction Example.
+ */
+
+// Use standard namespaces
+using System;
+using System.Threading;
+
+// Use the GemFire namespace
+using GemStone.GemFire.Cache;
+using System.Collections.Generic;
+
+namespace GemStone.GemFire.Cache.Examples
+{
+  // The Function Execution example.
+  //customer result collector
+  public class MyResultCollector : IResultCollector
+  {
+    private bool m_resultReady = false;
+    private CacheableVector m_results = null;
+    private int m_addResultCount = 0;
+    private int m_getResultCount = 0;
+    private int m_endResultCount = 0;
+
+    public int GetAddResultCount()
+    {
+      return m_addResultCount ;
+    }
+    public int GetGetResultCount()
+    {
+      return m_getResultCount ;
+    }
+    public int GetEndResultCount()
+    {
+      return m_endResultCount ;
+    }
+    public MyResultCollector()
+    {
+      m_results = new CacheableVector();
+    }
+    public void AddResult(IGFSerializable result)
+    {
+      m_addResultCount++;
+      CacheableArrayList rs = result as CacheableArrayList;
+      for(int i = 0; i < rs.Count; i++)
+      {
+	m_results.Add(rs[i]);
+      }
+    }
+    public IGFSerializable[] GetResult()
+    {
+      return GetResult(50);
+    }
+    public IGFSerializable[] GetResult(UInt32 timeout)
+    {
+      m_getResultCount++;
+      if(m_resultReady == true)
+      {
+	return m_results.ToArray();
+      }
+      else 
+      {
+	for(int i=0; i < timeout; i++)
+	{
+	  Thread.Sleep(1000);
+          if(m_resultReady == true)
+          {
+	    return m_results.ToArray();
+          }
+	}
+	throw new FunctionExecutionException(
+	           "Result is not ready, endResults callback is called before invoking getResult() method");
+	
+      }
+    }
+    public void EndResults()
+    {
+       m_endResultCount++;
+       m_resultReady = true;
+    }
+    public void ClearResults()
+    {
+      m_results.Clear();
+    }
+  }
+
+  class ExecuteFunctions
+  {        
+    private static string getFuncName = "MultiGetFunction";
+    private static string getFuncIName = "MultiGetFunctionI";
+
+    static void Main(string[] args)
+    {
+      try
+      {
+        // Create CacheFactory using the settings from the gfcpp.properties file by default.
+        CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
+
+        Cache cache = cacheFactory.SetSubscriptionEnabled(true)
+                                  .AddServer("localhost", 40404)
+                                  .AddServer("localhost", 50505)          
+                                  .Create();
+
+        Console.WriteLine("Created the GemFire Cache");
+
+        Region region = cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY)          
+                             .Create("partition_region");
+
+        Console.WriteLine("Created the partition_region.");
+
+        for(int i=0; i < 34; i++)
+        {
+          region.Put("KEY--"+i, "VALUE--"+i);
+        }
+      
+        IGFSerializable[] routingObj = new IGFSerializable[17];
+        int j=0;
+        for(int i=0; i < 34; i++)
+        {
+          if(i%2==0) continue;
+          routingObj[j] = new CacheableString("KEY--"+i);
+	  j++;
+        }
+        Console.WriteLine("routingObj count= {0}.", routingObj.Length);
+
+        //test data dependant function execution
+        //     test get function with result
+        Boolean getResult = true;
+        IGFSerializable args0 = new CacheableBoolean(true);
+        Execution exc = FunctionService.OnRegion(region);
+        IResultCollector rc =  exc.WithArgs(args0).WithFilter(routingObj).Execute(
+	  getFuncName, getResult);
+        IGFSerializable[] executeFunctionResult = rc.GetResult();
+        Console.WriteLine("on region: result count= {0}.", executeFunctionResult.Length);
+
+        List<IGFSerializable> resultList = new List<IGFSerializable>();
+
+        for (int pos = 0; pos < executeFunctionResult.Length; pos++) {
+          CacheableArrayList resultItem = executeFunctionResult[pos] as CacheableArrayList;
+          foreach (IGFSerializable item in resultItem) {
+            resultList.Add(item);
+          }
+        }
+        Console.WriteLine("on region: result count= {0}.", resultList.Count);
+        for (int i = 0; i < resultList.Count; i++) {
+          Console.WriteLine("on region:get:result[{0}]={1}.", i, (resultList[i] as CacheableString).Value);
+        }        
+            
+        getResult = true;
+        //test date independant fucntion execution on one server
+        //     test get function with result
+        exc = FunctionService.OnServer(cache);
+        CacheableVector args1 = new  CacheableVector();
+        for(int i=0; i < routingObj.Length; i++)
+        {
+          Console.WriteLine("routingObj[{0}]={1}.", i, (routingObj[i] as CacheableString).Value);
+          args1.Add(routingObj[i]);
+        }
+        rc =  exc.WithArgs(args1).Execute(
+	  getFuncIName, getResult);
+        executeFunctionResult = rc.GetResult();
+        Console.WriteLine("on one server: result count= {0}.", executeFunctionResult.Length);
+
+        List<IGFSerializable> resultList1 = new List<IGFSerializable>();
+        for (int pos = 0; pos < executeFunctionResult.Length; pos++) {
+          CacheableArrayList resultItem = executeFunctionResult[pos] as CacheableArrayList;
+          foreach (IGFSerializable item in resultItem) {
+            resultList1.Add(item);
+          }
+        }
+        
+        for (int i = 0; i < resultList1.Count; i++) {
+          Console.WriteLine("on one server:get:result[{0}]={1}.", i, (resultList1[i] as CacheableString).Value);
+        }        
+
+        //test date independant fucntion execution on all servers
+        //     test get function with result
+        exc = FunctionService.OnServers(cache);
+        rc =  exc.WithArgs(args1).Execute(getFuncIName, getResult);
+        executeFunctionResult = rc.GetResult();
+        Console.WriteLine("on all servers: result count= {0}.", executeFunctionResult.Length);
+
+        List<IGFSerializable> resultList2 = new List<IGFSerializable>();
+        for (int pos = 0; pos < executeFunctionResult.Length; pos++) {
+          CacheableArrayList resultItem = executeFunctionResult[pos] as CacheableArrayList;
+          foreach (IGFSerializable item in resultItem) {
+            resultList2.Add(item);
+          }
+        }
+        if (resultList2.Count != 34)
+          Console.WriteLine("result count check failed on all servers");
+        for (int i = 0; i < resultList2.Count; i++) {
+          Console.WriteLine("on all servers:result[{0}]={1}.", i, (resultList2[i] as CacheableString).Value);
+        }       
+
+        //test withCollector
+        MyResultCollector myRC = new MyResultCollector();
+        rc =  exc.WithArgs(args1).WithCollector(myRC).Execute(getFuncIName, getResult);
+        executeFunctionResult = rc.GetResult();
+        Console.WriteLine("add result count= {0}.", myRC.GetAddResultCount());
+        Console.WriteLine("get result count= {0}.", myRC.GetGetResultCount());
+        Console.WriteLine("end result count= {0}.", myRC.GetEndResultCount());
+        Console.WriteLine("on all servers with collector: result count= {0}.", executeFunctionResult.Length);
+
+        // Close the GemFire Cache.
+        cache.Close();
+
+        Console.WriteLine("Closed the GemFire Cache");        
+      }
+      // An exception should not occur
+      catch (GemFireException gfex)
+      {
+        Console.WriteLine("ExecuteFunctions GemFire Exception: {0}", gfex.Message);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj b/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj
new file mode 100644
index 0000000..c3fa3e9
--- /dev/null
+++ b/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj
@@ -0,0 +1,85 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{D8F67104-CDDE-433F-A8EE-470A92180BA9}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>GemStone.GemFire.Cache.Examples</RootNamespace>
+    <AssemblyName>ExecuteFunctions</AssemblyName>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\Debug\ExecuteFunctions\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\Debug\ExecuteFunctions\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\ExecuteFunctions\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\ExecuteFunctions\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\Debug\ExecuteFunctions\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\Debug\ExecuteFunctions\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <Optimize>false</Optimize>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\ExecuteFunctions\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\ExecuteFunctions\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ExecuteFunctions.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\vs_projects\gfclicache\gfclicache.vcproj">
+      <Project>{B274E3B1-6A09-4322-952B-8BDA712892CE}</Project>
+      <Name>gfclicache</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj.user
----------------------------------------------------------------------
diff --git a/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj.user b/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj.user
new file mode 100644
index 0000000..99f5303
--- /dev/null
+++ b/geode-client-native/examples/clicache/ExecuteFunctions/ExecuteFunctions.csproj.user
@@ -0,0 +1,6 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ReferencePath>$(OSBUILDDIR)\hidden\lib\</ReferencePath>
+    <ProjectView>ProjectFiles</ProjectView>
+  </PropertyGroup>
+</Project>
\ No newline at end of file



Mime
View raw message