Author: rmannibucau
Date: Mon Dec 26 10:25:42 2011
New Revision: 1224704

URL: http://svn.apache.org/viewvc?rev=1224704&view=rev
Log:
TOMEE-57 Examples documentation improvement. Patch from Dianel Siwiec. Thanks\!

Modified:
    openejb/trunk/openejb/examples/schedule-expression/README.md
    openejb/trunk/openejb/examples/simple-singleton/README.md
    openejb/trunk/openejb/examples/simple-stateful/README.md
    openejb/trunk/openejb/examples/simple-stateless-with-descriptor/README.md

Modified: openejb/trunk/openejb/examples/schedule-expression/README.md
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/schedule-expression/README.md?rev=1224704&r1=1224703&r2=1224704&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/schedule-expression/README.md (original)
+++ openejb/trunk/openejb/examples/schedule-expression/README.md Mon Dec 26 
10:25:42 2011
@@ -1,9 +1,21 @@
 Title: Schedule Expression
 
-*Help us document this example! Source available in 
[svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/schedule-expression)
 or 
[git](https://github.com/apache/openejb/tree/trunk/openejb/examples/schedule-expression).
 Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull 
request*
+In this example we exercise the `TimerService`.
+
+>"The TimerService interface provides enterprise bean components with access 
to the container-provided Timer Service. 
+The EJB Timer Service allows entity beans, stateless session beans, and 
message-driven beans to be registered for timer 
+callback events at a specified time, after a specified elapsed time, or after 
a specified interval."
+
+For a complete description of the TimerService, please refer to the JEE 
tutorial dedicated to the 
+[Timer Service](http://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html).
 
 ## FarmerBrown
 
+At `PostConstruct` we create 5 programmatic timers. First four will most 
likely not be triggered during the test
+execution, however the last one will timeout a couple of times.
+
+Each timer contains an info attribute, which can be inspected at timeout.   
+
     package org.superbiz.corn;
     
     import javax.annotation.PostConstruct;
@@ -78,6 +90,8 @@ Title: Schedule Expression
 
 ## FarmerBrownTest
 
+The test class acquires an instance from the context and waits for 5 seconds 
to give the timers a chance to timeout.
+
     package org.superbiz.corn;
     
     import junit.framework.TestCase;

Modified: openejb/trunk/openejb/examples/simple-singleton/README.md
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-singleton/README.md?rev=1224704&r1=1224703&r2=1224704&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-singleton/README.md (original)
+++ openejb/trunk/openejb/examples/simple-singleton/README.md Mon Dec 26 
10:25:42 2011
@@ -113,7 +113,7 @@ In the example we see `ComponentRegistry
  1. We use `@Lock(WRITE)` on the methods that mutate the map such as the 
`put()` and `remove()` methods.
  1. We use `@Lock(READ)` on the `get()` and `values()` methods as they do not 
change the map state and are guaranteed not to be called at the same as any of 
the `@Lock(WRITE)` methods, so we know the state of the HashMap is no being 
mutated and therefore safe for reading.
 
-The end result is that the threading model for this bean will switch from 
multi-threaded access to single-threaded access dynamically as needed depending 
on the which methods are being invoked. This gives Singletons a bit of an 
advantage over Servlets for processing multi-threaded requests.
+The end result is that the threading model for this bean will switch from 
multi-threaded access to single-threaded access dynamically as needed, 
depending on the method being invoked. This gives Singletons a bit of an 
advantage over Servlets for processing multi-threaded requests.
 
 See the [Singleton Beans](../../singleton-beans.html) page for  more advanced 
details on Container-Managed Concurrency.
 

Modified: openejb/trunk/openejb/examples/simple-stateful/README.md
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-stateful/README.md?rev=1224704&r1=1224703&r2=1224704&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-stateful/README.md (original)
+++ openejb/trunk/openejb/examples/simple-stateful/README.md Mon Dec 26 
10:25:42 2011
@@ -1,6 +1,17 @@
 Title: Simple Stateful
 
-*Help us document this example! Source available in 
[svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/simple-stateful)
 or 
[git](https://github.com/apache/openejb/tree/trunk/openejb/examples/simple-stateful).
 Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull 
request*
+This example demonstrates a simple deployment of a Stateful session bean.
+
+>"As its name suggests, a stateful session bean is similar to an interactive 
session. A stateful session bean is not shared; 
+it can have only one client, in the same way that an interactive session can 
have only one user. 
+When the client terminates, its stateful session bean appears to terminate and 
is no longer associated with the client."
+
+The `Counter` class is a Stateful session bean that maintains a state in a 
form of a `count` integer field.
+It exposes three methods: `count()`, `increment()` and `reset()` to manipulate 
and view its state.
+
+Typically, Stateful and Stateless beans implement Local and/or Remote 
interfaces to determine which methods should
+be exposed. In this case, the bean is using a no-interface view, which means 
that all public methods are exposed
+as a local view. 
 
 ## Counter
 
@@ -43,6 +54,10 @@ Title: Simple Stateful
 
 ## CounterTest
 
+The `Counter` class is tested by obtaining a `Context` object and performing a 
JNDI lookup on it, to retrieve
+an instance of the `Counter` bean. After some state manipulation, a new 
instance is fetched from the container
+and we can see that it's a new instance.
+
     package org.superbiz.counter;
     
     import junit.framework.TestCase;

Modified: 
openejb/trunk/openejb/examples/simple-stateless-with-descriptor/README.md
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-stateless-with-descriptor/README.md?rev=1224704&r1=1224703&r2=1224704&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-stateless-with-descriptor/README.md 
(original)
+++ openejb/trunk/openejb/examples/simple-stateless-with-descriptor/README.md 
Mon Dec 26 10:25:42 2011
@@ -1,6 +1,7 @@
 Title: Simple Stateless with Descriptor
 
-*Help us document this example! Source available in 
[svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/simple-stateless-with-descriptor)
 or 
[git](https://github.com/apache/openejb/tree/trunk/openejb/examples/simple-stateless-with-descriptor).
 Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull 
request*
+This test is similar to simple-stateless, with two major differences. In this 
case all the classes are regular POJOs without annotations.
+The EJB-specific metadata is provided via an XML descriptor. The second 
difference is the explicite use of Local and Remote interfaces. 
 
 ## CalculatorImpl
 
@@ -56,6 +57,8 @@ Title: Simple Stateless with Descriptor
 
 ## ejb-jar.xml
 
+The XML descriptor defines the EJB class and both local and remote interfaces.
+
     <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee";
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd";
@@ -71,10 +74,14 @@ Title: Simple Stateless with Descriptor
         </session>
       </enterprise-beans>
     </ejb-jar>
+
     
 
 ## CalculatorTest
 
+Two tests obtain a Local and Remote interface to the bean instance. This time 
an `InitialContext` object is directly created, 
+as opposed to getting the context from `EJBContainer`, as we did in the 
previous example. 
+
     package org.superbiz.calculator;
     
     import junit.framework.TestCase;


Reply via email to