From f209660e37b3b6cce8feb1e6ee52bcb63be1fbc2 Mon Sep 17 00:00:00 2001 From: costin Date: Mon, 19 Jul 2010 14:12:56 +0300 Subject: [PATCH] + add sample docs SGF-5 --- docs/src/docbkx/index.xml | 1 + docs/src/docbkx/introduction/introduction.xml | 2 +- docs/src/docbkx/preface.xml | 5 +- docs/src/docbkx/reference/introduction.xml | 7 +- docs/src/docbkx/reference/samples.xml | 101 ++++++++++++++++++ 5 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 docs/src/docbkx/reference/samples.xml diff --git a/docs/src/docbkx/index.xml b/docs/src/docbkx/index.xml index f63d8587..89fd57e1 100644 --- a/docs/src/docbkx/index.xml +++ b/docs/src/docbkx/index.xml @@ -40,6 +40,7 @@ + diff --git a/docs/src/docbkx/introduction/introduction.xml b/docs/src/docbkx/introduction/introduction.xml index 0b1131fb..73662e59 100644 --- a/docs/src/docbkx/introduction/introduction.xml +++ b/docs/src/docbkx/introduction/introduction.xml @@ -4,7 +4,7 @@ - This document is the reference guide for Spring GemFire Integration (SGI). It explains the relationship + This document is the reference guide for Spring GemFire project (SGF). It explains the relationship between Spring framework and GemFire Enterprise Fabric (GEF) 6.0.x, defines the basic concepts and semantics of the integration and how these can be used effectively. diff --git a/docs/src/docbkx/preface.xml b/docs/src/docbkx/preface.xml index b1ad6dd5..5ab52d41 100644 --- a/docs/src/docbkx/preface.xml +++ b/docs/src/docbkx/preface.xml @@ -5,8 +5,9 @@ Preface Spring GemFire Integration focuses on integrating Spring Framework powerful, non-invasive programming model - and concepts with GemFire Enterprise Fabric, providing easier configuration and use. This document assumes the - reader is already familiar with the Spring Framework and GemFire concepts (at least at basic level) and APIs. + and concepts with GemFire Enterprise Fabric, providing easier configuration, use and high-level abstractions. + This document assumes the reader is already familiar with the Spring Framework and GemFire concepts + (at least at basic level) and APIs. diff --git a/docs/src/docbkx/reference/introduction.xml b/docs/src/docbkx/reference/introduction.xml index 6c2eb6a0..3cd56873 100644 --- a/docs/src/docbkx/reference/introduction.xml +++ b/docs/src/docbkx/reference/introduction.xml @@ -16,7 +16,12 @@ and exception translation. + describes the samples provided with the distribution + for showcasing the various features available in Spring GemFire. + + + \ No newline at end of file diff --git a/docs/src/docbkx/reference/samples.xml b/docs/src/docbkx/reference/samples.xml new file mode 100644 index 00000000..95d05b0a --- /dev/null +++ b/docs/src/docbkx/reference/samples.xml @@ -0,0 +1,101 @@ + + + + Sample Applications + + + The Spring GemFire project includes one sample application. Named "Hello World", the sample demonstrates how to configure and use GemFire inside a + Spring application. At runtime, the sample offers a shell to the user allowing him to run various commands against the grid. + It provides an excellent starting point for users unfamiliar with the essential components or the Spring and GemFire concepts. + + THe samples are available with the distribution and are both Maven-based. One can easily import them into any Maven-aware IDE (such as SpringSource + Tool Suite) or run them from the command-line. + +
+ Hello World + + The Hello World sample demonstrates the core functionality of the Spring GemFire project. It bootstraps GemFire, configures it, executes arbitrary + commands against it and shuts it down with the application. Multiple instances can be started at the same time - they will seemingly work with each other + sharing data without any user intervention. + + +
+ Starting and stopping the sample + + Hello World is designed as a stand-alone java application. It features a Main class which can be started either from your + IDE of choice (in Eclipse/STS through Run As/Java Application) or from the command line through Maven using mvn exec:java. + One can also use java directly on the resulting artifact if the classpath is properly set. + + + To stop the sample, simply type exit at the command line or press Ctrl+C to stop the VM and shutdown the Spring container. +
+ +
+ Using the sample + + Once started, the sample will create a shared data grid and allow the user to issue commands against it. The output will likely look as follows: + + - retrieves an entry (by key) from the grid +put - puts a new entry into the grid +remove - removes an entry (by key) from the grid +...]]> + + For example to add new items to the grid one can use: + -> put 1 unu +INFO: Added [1=unu] to the cache +null +-> put 1 one +INFO: Updated [1] from [unu] to [one] +unu +-> size +1 +-> put 2 two +INFO: Added [2=two] to the cache +null +-> size +2 + + Multiple instances can be created at the same time. Once started, the new VMs automatically see the existing region and its information: + + INFO: Connected to Distributed System ['Spring GemFire World'=xxxx:56218/49320@yyyyy] +Hello World! +... + +-> size +2 +-> map +[2=two] [1=one] +-> query length = 3 +[one, two] + + + Experiment with the example, start (and stop) as many instances as you want, run various commands in one instance and see how the others react. + To preserve data, at least one instance needs to be alive all times - if all instances are shutdown, the grid data is completely destroyed (in this example + - to preserve data between runs, see the GemFire documentations). +
+ +
+ Hello World Sample Explained + + Hello World uses both Spring XML and annotations for its configuration. The initial boostrapping configuration is app-context.xml which + includes the cache configuration, defined under cache-context.xml file and performs classpath + scanning for Spring + components. + The cache configuration defines the GemFire cache, region and for illustrative purposes a simple cache listener that acts as a logger. + + + The main beans are HelloWorld and CommandProcessor which rely on the GemfireTemplate + to interact with the distributed fabric. Both classes use annotations to define their dependency and life-cycle callbacks. + +
+
+ +
\ No newline at end of file