Author: simonetripodi
Date: Mon May 19 12:28:24 2014
New Revision: 1595863

URL: http://svn.apache.org/r1595863
Log:
@trivial site code samples make-up

Modified:
    onami/sandbox/persist/src/site/apt/complexWebApp.apt.vm
    onami/sandbox/persist/src/site/apt/daoExample.apt.vm
    onami/sandbox/persist/src/site/apt/emProvider.apt.vm
    onami/sandbox/persist/src/site/apt/guicePersist.apt.vm
    onami/sandbox/persist/src/site/apt/index.apt.vm
    onami/sandbox/persist/src/site/apt/simpleWebApp.apt.vm
    onami/sandbox/persist/src/site/apt/standaloneApp.apt.vm

Modified: onami/sandbox/persist/src/site/apt/complexWebApp.apt.vm
URL: 
http://svn.apache.org/viewvc/onami/sandbox/persist/src/site/apt/complexWebApp.apt.vm?rev=1595863&r1=1595862&r2=1595863&view=diff
==============================================================================
--- onami/sandbox/persist/src/site/apt/complexWebApp.apt.vm (original)
+++ onami/sandbox/persist/src/site/apt/complexWebApp.apt.vm Mon May 19 12:28:24 
2014
@@ -29,31 +29,41 @@ Multi Datasource Web Application
 * java code
 
 +--------------------------------------+
-public class BootstrapServletListener extends GuiceServletContextListener {
-    protected Injector getInjector() {
+public class BootstrapServletListener
+    extends GuiceServletContextListener
+{
+
+    protected Injector getInjector()
+    {
         final PersistenceModule persistenceModule = new PersistenceModule() {
+
             @Override
-            protected void configurePersistence() {
-                
bindContainerManagedPersistenceUnitWithJndiName("java:comp/env/foobar/mainPuJndiName")
+            protected void configurePersistence()
+            {
+                bindContainerManagedPersistenceUnitWithJndiName( 
"java:comp/env/foobar/mainPuJndiName" )
                     .annotatedWith(MainPU.class)
-                    
.useGlobalTransactionWithJndiName("java:comp/env/UserTransaction");
+                    .useGlobalTransactionWithJndiName( 
"java:comp/env/UserTransaction" );
 
-                
bindContainerManagedPersistenceUnitWithJndiName("java:comp/env/foobar/alternativePUJndiName")
+                bindContainerManagedPersistenceUnitWithJndiName( 
"java:comp/env/foobar/alternativePUJndiName" )
                     .annotatedWith(AlternativePU.class)
-                    
.useGlobalTransactionWithJndiName("java:comp/env/UserTransaction");
+                    .useGlobalTransactionWithJndiName( 
"java:comp/env/UserTransaction" );
 
-                
bindContainerManagedPersistenceUnitWithJndiName("java:comp/env/foobar/systemPuJndiName")
+                bindContainerManagedPersistenceUnitWithJndiName( 
"java:comp/env/foobar/systemPuJndiName" )
                     .annotatedWith(SystemPU.class)
                     .useLocalTransaction();
             }
+
         };
 
-        final ServletModule servletModule = new ServletModule() {
+        final ServletModule servletModule = new ServletModule()
+        {
             filter("/*").through(PersistenceFilter.class);
         };
 
-        return Guice.createInjector(servletModule, persistenceModule, 
getApplicationSpecificModules());
+        return Guice.createInjector( servletModule, persistenceModule, 
getApplicationSpecificModules() );
     }
+
+}
 +--------------------------------------+
 
 * web.xml
@@ -157,4 +167,3 @@ xmlns:xsi="http://www.w3.org/2001/XMLSch
 |    |    |    + guice.jar
 |    |    |    + onami-persist.jar
 +--------------------------------------+
-

Modified: onami/sandbox/persist/src/site/apt/daoExample.apt.vm
URL: 
http://svn.apache.org/viewvc/onami/sandbox/persist/src/site/apt/daoExample.apt.vm?rev=1595863&r1=1595862&r2=1595863&view=diff
==============================================================================
--- onami/sandbox/persist/src/site/apt/daoExample.apt.vm (original)
+++ onami/sandbox/persist/src/site/apt/daoExample.apt.vm Mon May 19 12:28:24 
2014
@@ -29,23 +29,28 @@ DAO Example
   The following code snippet is a little example on how to use Onami-Persist 
to access a persistence unit.
 
 +--------------------------------------+
-public class FooDao {
+public class FooDao
+{
 
     private final EntityManagerProvider emProvider;
 
     @Inject
-    public FooDao(EntityManagerProvider emProvider) {
+    public FooDao( EntityManagerProvider emProvider )
+    {
         this.emProvider = emProvider;
     }
 
     @Transactional
-    public Foo getFooByName(String name) {
+    public Foo getFooByName( String name )
+    {
         final EntityManager em = emProvider.get();
         return getFooByName(name, em);
     }
 
-    private Foo getFooByName(String name, EntityManager em) {
+    private Foo getFooByName( String name, EntityManager em )
+    {
         // retrieve foo from the DB using the entity manager...
     }
+
 }
 +--------------------------------------+

Modified: onami/sandbox/persist/src/site/apt/emProvider.apt.vm
URL: 
http://svn.apache.org/viewvc/onami/sandbox/persist/src/site/apt/emProvider.apt.vm?rev=1595863&r1=1595862&r2=1595863&view=diff
==============================================================================
--- onami/sandbox/persist/src/site/apt/emProvider.apt.vm (original)
+++ onami/sandbox/persist/src/site/apt/emProvider.apt.vm Mon May 19 12:28:24 
2014
@@ -36,19 +36,23 @@ EntityManagerProvider vs. Provider of En
   People not familiar with the life cycle of the EntityManager tend to build a 
DAO or service like this:
 
 +--------------------------------------+
-public class ExampleService {
+public class ExampleService
+{
 
     private final EntityManager em;
 
     @Inject
-    public ExamleService(EntityManager em) {
+    public ExamleService( EntityManager em )
+    {
         this.em = em;
     }
 
     @Transactional
-    public Foo getFooByName(String name) {
+    public Foo getFooByName( String name )
+    {
         // retrieve foo from the DB using the EntityManager.
     }
+
 }
 +--------------------------------------+
 
@@ -62,15 +66,19 @@ public class ExampleService {
   If you need the EntityManager to be bound in the injector you can do this as 
follows:
 
 +--------------------------------------+
-public class MyPersistenceModule extends PersistenceModule {
+public class MyPersistenceModule
+    extends PersistenceModule
+{
 
     @Override
-    protected void configurePersistence() {
-        
addApplicationManagedPersistenceUnit("main").annotatedWith(MainPU.class);
-
-        bind(EntityManager.class)
-            .annotatedWith(MainPU.class)
-            .toProvider(Key.get(EntityManagerProvider.class, MainPU.class));
+    protected void configurePersistence()
+    {
+        addApplicationManagedPersistenceUnit( "main" ).annotatedWith( 
MainPU.class );
+
+        bind( EntityManager.class )
+            .annotatedWith( MainPU.class )
+            .toProvider( Key.get( EntityManagerProvider.class, MainPU.class ) 
);
     }
+
 }
 +--------------------------------------+

Modified: onami/sandbox/persist/src/site/apt/guicePersist.apt.vm
URL: 
http://svn.apache.org/viewvc/onami/sandbox/persist/src/site/apt/guicePersist.apt.vm?rev=1595863&r1=1595862&r2=1595863&view=diff
==============================================================================
--- onami/sandbox/persist/src/site/apt/guicePersist.apt.vm (original)
+++ onami/sandbox/persist/src/site/apt/guicePersist.apt.vm Mon May 19 12:28:24 
2014
@@ -26,29 +26,29 @@
 
 Onami-Persist vs. Guice-Persist
 
-  Onami-Persist is inspired and based upon Guice-Persist. Most of the concepts 
and ideas have been adapted and/or reused.
+  <Onami-Persist> is inspired and based upon <Guice-Persist>. Most of the 
concepts and ideas have been adapted and/or reused;
 
-  * UnitOfWork as the life cycle manager for EntityManagers.
+  * <<<UnitOfWork>>> as the life cycle manager for <<<EntityManagers>>>;
 
-  * PersistFilter for spanning a UnitOfWork around a request.
+  * <<<PersistFilter>>> for spanning a <<<UnitOfWork>>> around a request;
 
-  * PersistenceService for starting and stopping the entire persistence engine.
+  * <<<PersistenceServic>>>e for starting and stopping the entire persistence 
engine;
 
-  * @Transactional annotation on methods to span a transaction around the 
method.
+  * <<<@Transactional>>> annotation on methods to span a transaction around 
the method.
 
   []
 
-  The most notable changes to guice-persist:
+  The most notable changes to <Guice-Persist>:
 
-  * Integrated support for multiple persistence units, JTA and custom 
annotation.
+  * Integrated support for multiple persistence units, JTA and custom 
annotation;
 
-  * EntityManager cannot be injected. Instead an EntityManagerProvider has to 
be injected ({{{./emProvider.html}details}}).
+  * <<<EntityManager>>> cannot be injected. Instead an 
<<<EntityManagerProvider>>> has to be injected ({{{./emProvider.html}details}});
 
-  * @Transactional annotation allows to specify which persistence units are 
involved in the transaction.
+  * <<<@Transactional>>> annotation allows to specify which persistence units 
are involved in the transaction;
 
-  * UnitOfWork has a new method isActive()
+  * <<<UnitOfWork>>> has a new method <<<isActive()>>>;
 
-  * Retrieving an EntityManager does not start a UnitOfWork. Instead it will 
throw an Exception if the UnitOfWork is not active.
+  * Retrieving an <<<EntityManager>>> does not start a <<<UnitOfWork>>>. 
Instead it will throw an Exception if the <<<UnitOfWork>>> is not active;
 
-  * PersistenceService can be restarted after it has been stopped.
+  * <<<PersistenceService>>> can be restarted after it has been stopped.
 

Modified: onami/sandbox/persist/src/site/apt/index.apt.vm
URL: 
http://svn.apache.org/viewvc/onami/sandbox/persist/src/site/apt/index.apt.vm?rev=1595863&r1=1595862&r2=1595863&view=diff
==============================================================================
--- onami/sandbox/persist/src/site/apt/index.apt.vm (original)
+++ onami/sandbox/persist/src/site/apt/index.apt.vm Mon May 19 12:28:24 2014
@@ -73,4 +73,3 @@ Overview
   * {{{./simpleWebApp.html}Simple Web Application Setup}}
 
   * {{{./complexWebApp.html}Multi Datasource Web Application Setup}}
-

Modified: onami/sandbox/persist/src/site/apt/simpleWebApp.apt.vm
URL: 
http://svn.apache.org/viewvc/onami/sandbox/persist/src/site/apt/simpleWebApp.apt.vm?rev=1595863&r1=1595862&r2=1595863&view=diff
==============================================================================
--- onami/sandbox/persist/src/site/apt/simpleWebApp.apt.vm (original)
+++ onami/sandbox/persist/src/site/apt/simpleWebApp.apt.vm Mon May 19 12:28:24 
2014
@@ -29,20 +29,29 @@ Simple Web Application
 * java code
 
 +--------------------------------------+
-public class BootstrapServletListener extends GuiceServletContextListener {
-    protected Injector getInjector() {
-        final PersistenceModule persistenceModule = new PersistenceModule() {
+public class BootstrapServletListener
+extends GuiceServletContextListener
+{
+
+    protected Injector getInjector()
+    {
+        final PersistenceModule persistenceModule = new PersistenceModule()
+        {
+
             @Override
-            protected void configurePersistence() {
-                
bindContainerManagedPersistenceUnitWithJndiName("java:comp/env/foobar/puJndiName");
+            protected void configurePersistence()
+            {
+                bindContainerManagedPersistenceUnitWithJndiName( 
"java:comp/env/foobar/puJndiName" );
             }
+
         };
 
-        final ServletModule servletModule = new ServletModule() {
-            filter("/*").through(PersistenceFilter.class);
+        final ServletModule servletModule = new ServletModule()
+        {
+            filter( "/*" ).through( PersistenceFilter.class );
         };
 
-        return Guice.createInjector(servletModule, persistenceModule, 
getApplicationSpecificModules());
+        return Guice.createInjector( servletModule, persistenceModule, 
getApplicationSpecificModules() );
     }
 +--------------------------------------+
 
@@ -53,18 +62,23 @@ public class BootstrapServletListener ex
 <web-app version="2.5" 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/web-app_2_5.xsd";>
     <display-name>FooBar App</display-name>
+
     <filter>
         <filter-name>guiceFilter</filter-name>
         <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
     </filter>
+
     <filter-mapping>
         <filter-name>guiceFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
+
     <listener>
         <listener-class>foo.bar.BootstrapServletListener</listener-class>
     </listener>
+
     <!-- More config. -->
+
 </web-app>
 +--------------------------------------+
 
@@ -73,9 +87,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSch
 +--------------------------------------+
 <persistence xmlns="http://java.sun.com/xml/ns/persistence"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"; version="2.0">
+
     <persistence-unit name="puName" transaction-type="RESOURCE_LOCAL">
         <!-- your configuration -->
     </peristence-unit>
+
 </peristence>
 +--------------------------------------+
 
@@ -127,4 +143,3 @@ xmlns:xsi="http://www.w3.org/2001/XMLSch
 |    |    |    + guice.jar
 |    |    |    + onami-persist.jar
 +--------------------------------------+
-

Modified: onami/sandbox/persist/src/site/apt/standaloneApp.apt.vm
URL: 
http://svn.apache.org/viewvc/onami/sandbox/persist/src/site/apt/standaloneApp.apt.vm?rev=1595863&r1=1595862&r2=1595863&view=diff
==============================================================================
--- onami/sandbox/persist/src/site/apt/standaloneApp.apt.vm (original)
+++ onami/sandbox/persist/src/site/apt/standaloneApp.apt.vm Mon May 19 12:28:24 
2014
@@ -29,25 +29,35 @@ Standalone Application
 * java code
 
 +--------------------------------------+
-public static void main(String[] args) {
-    final PersistenceModule persistenceModule = new PersistenceModule() {
+public static void main( String[] args )
+{
+
+    final PersistenceModule persistenceModule = new PersistenceModule()
+    {
+
         @Override
-        protected void configurePersistence() {
+        protected void configurePersistence()
+        {
             bindApplicationManagedPersistenceUnit( "puName" );
         }
+
     };
-    final Injector injector = Guice.createInjector(persistenceModule, 
getApplicationSpecificModules());
 
-    final PersistenceService persistenceService = 
injector.getInstance(PersistenceService.class);
+    final Injector injector = Guice.createInjector( persistenceModule, 
getApplicationSpecificModules() );
 
-    try {
+    final PersistenceService persistenceService = injector.getInstance( 
PersistenceService.class );
+
+    try
+    {
         persistenceService.start();
 
-        while(notTerminated()) {
+        while( notTerminated() )
+        {
             // run application
         }
     }
-    finally {
+    finally
+    {
         persistenceService.stop();
     }
 }
@@ -82,4 +92,3 @@ public static void main(String[] args) {
 |    |    |    + Main.class
 |    |    |    + App.class
 +--------------------------------------+
-


Reply via email to