Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/jsf-managedBean-and-ejb.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/jsf-managedBean-and-ejb.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/jsf-managedBean-and-ejb.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/jsf-managedBean-and-ejb.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,277 @@
+= JSF Application that uses managed-bean and ejb
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example jsf-managedBean-and-ejb can be browsed at 
https://github.com/apache/tomee/tree/master/examples/jsf-managedBean-and-ejb
+
+
+This is a simple web-app showing how to use dependency injection in JSF 
managed beans using TomEE.
+
+It contains a Local Stateless session bean `CalculatorImpl` which adds two 
numbers and returns the result.
+The application also contains a JSF managed bean `CalculatorBean`, which uses 
the EJB to add two numbers
+and display the results to the user. The EJB is injected in the managed bean 
using `@EJB` annotation.
+
+
+==  A little note on the setup:
+
+You could run this in the latest Apache TomEE 
link:https://repository.apache.org/content/repositories/snapshots/org/apache/openejb/apache-tomee/[snapshot]
+
+As for the libraries, myfaces-api and myfaces-impl are provided in tomee/lib 
and hence they should not be a part of the
+war. In maven terms, they would be with scope 'provided'
+
+Also note that we use servlet 2.5 declaration in web.xml
+    
+
+[source,xml]
+----
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+xmlns="http://java.sun.com/xml/ns/javaee";
+xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
+version="2.5">
+
+And we use 2.0 version of faces-config
+
+ <faces-config 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-facesconfig_2_0.xsd";
+           version="2.0">
+
+
+The complete source code is provided below but let's break down to look at 
some smaller snippets and see  how it works.
+
+We'll first declare the `FacesServlet` in the `web.xml`
+
+  <servlet>
+    <servlet-name>Faces Servlet</servlet-name>
+    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+`FacesServlet` acts as the master controller.
+
+We'll then create the `calculator.xhtml` file.
+
+       <h:outputText value='Enter first number'/>
+       <h:inputText value='#{calculatorBean.x}'/>
+       <h:outputText value='Enter second number'/>
+       <h:inputText value='#{calculatorBean.y}'/>
+       <h:commandButton action="#{calculatorBean.add}" value="Add"/>
+
+
+Notice how we've use the bean here.
+By default it is the simple class name of the managed bean.
+
+When a request comes in, the bean is instantiated and placed in the 
appropriate scope.
+By default, the bean is placed in the request scope.
+
+        <h:inputText value='#{calculatorBean.x}'/>
+
+Here, getX() method of calculatorBean is invoked and the resulting value is 
displayed.
+x being a Double, we rightly should see 0.0 displayed.
+
+When you change the value and submit the form, these entered values are bound 
using the setters
+in the bean and then the commandButton-action method is invoked.
+
+In this case, `CalculatorBean#add()` is invoked.
+
+`Calculator#add()` delegates the work to the ejb, gets the result, stores it
+and then instructs what view is to be rendered.
+
+You're right. The return value "success" is checked up in faces-config 
navigation-rules
+and the respective page is rendered.
+
+In our case, `result.xhtml` page is rendered.
+
+The request scoped `calculatorBean` is available here, and we use EL to 
display the values.
+
+## Source
+
+## Calculator
+
+package org.superbiz.jsf;
+
+import javax.ejb.Local;
+
+@Local
+public interface Calculator {
+    public double add(double x, double y);
+}
+
+
+## CalculatorBean
+
+package org.superbiz.jsf;
+
+import javax.ejb.EJB;
+import javax.faces.bean.ManagedBean;
+
+@ManagedBean
+public class CalculatorBean {
+    @EJB
+    Calculator calculator;
+    private double x;
+    private double y;
+    private double result;
+
+    public double getX() {
+        return x;
+    }
+
+    public void setX(double x) {
+        this.x = x;
+    }
+
+    public double getY() {
+        return y;
+    }
+
+    public void setY(double y) {
+        this.y = y;
+    }
+
+    public double getResult() {
+        return result;
+    }
+
+    public void setResult(double result) {
+        this.result = result;
+    }
+
+    public String add() {
+        result = calculator.add(x, y);
+        return "success";
+    }
+}
+
+## CalculatorImpl
+
+package org.superbiz.jsf;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class CalculatorImpl implements Calculator {
+
+    public double add(double x, double y) {
+        return x + y;
+    }
+}
+
+
+# web.xml
+
+<?xml version="1.0"?>
+
+    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xmlns="http://java.sun.com/xml/ns/javaee";
+    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
+    version="2.5">
+
+    <description>MyProject web.xml</description>
+
+    <!-- Faces Servlet -->
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <!-- Faces Servlet Mapping -->
+    <servlet-mapping>
+       <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.jsf</url-pattern>
+    </servlet-mapping>
+
+    <!-- Welcome files -->
+    <welcome-file-list>
+       <welcome-file>index.jsp</welcome-file>
+       <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+    </web-app>
+----
+
+
+    
+== Calculator.xhtml
+
+
+[source,xml]
+----
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";
+xmlns:f="http://java.sun.com/jsf/core";
+xmlns:h="http://java.sun.com/jsf/html";>
+
+
+<h:body bgcolor="white">
+    <f:view>
+        <h:form>
+            <h:panelGrid columns="2">
+            <h:outputText value='Enter first number'/>
+           <h:inputText value='#{calculatorBean.x}'/>
+            <h:outputText value='Enter second number'/>
+            <h:inputText value='#{calculatorBean.y}'/>
+           <h:commandButton action="#{calculatorBean.add}" value="Add"/>
+            </h:panelGrid>
+        </h:form>
+   </f:view>
+</h:body>
+</html>
+
+
+##Result.xhtml
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";
+xmlns:f="http://java.sun.com/jsf/core";
+xmlns:h="http://java.sun.com/jsf/html";>
+
+<h:body>
+    <f:view>
+        <h:form id="mainForm">
+            <h2><h:outputText value="Result of adding #{calculatorBean.x} and 
#{calculatorBean.y} is #{calculatorBean.result }"/></h2>
+            <h:commandLink action="back">
+            <h:outputText value="Home"/>
+            </h:commandLink>
+        </h:form>
+    </f:view>
+</h:body>
+</html>
+
+#faces-config.xml
+
+<?xml version="1.0"?>
+<faces-config 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-facesconfig_2_0.xsd";
+version="2.0">
+
+<navigation-rule>
+    <from-view-id>/calculator.xhtml</from-view-id>
+    <navigation-case>
+        <from-outcome>success</from-outcome>
+        <to-view-id>/result.xhtml</to-view-id>
+    </navigation-case>
+</navigation-rule>
+
+<navigation-rule>
+    <from-view-id>/result.xhtml</from-view-id>
+    <navigation-case>
+        <from-outcome>back</from-outcome>
+        <to-view-id>/calculator.xhtml</to-view-id>
+    </navigation-case>
+</navigation-rule>
+</faces-config>
+

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/jsf-managedBean-and-ejb.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs-with-descriptor.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs-with-descriptor.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs-with-descriptor.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs-with-descriptor.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,229 @@
+= Lookup Of Ejbs with Descriptor
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example lookup-of-ejbs-with-descriptor can be browsed at 
https://github.com/apache/tomee/tree/master/examples/lookup-of-ejbs-with-descriptor
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  BlueBean
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+import javax.ejb.EJBException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+//START SNIPPET: code
+public class BlueBean implements Friend {
+
+    public String sayHello() {
+        return "Blue says, Hello!";
+    }
+
+    public String helloFromFriend() {
+        try {
+            Friend friend = (Friend) new 
InitialContext().lookup("java:comp/env/myFriend");
+            return "My friend " + friend.sayHello();
+        } catch (NamingException e) {
+            throw new EJBException(e);
+        }
+    }
+}
+----
+
+
+==  Friend
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+/**
+ * This is an EJB 3 local business interface
+ * A local business interface may be annotated with the @Local
+ * annotation, but it's optional. A business interface which is
+ * not annotated with @Local or @Remote is assumed to be Local
+ * if the bean does not implement any other interfaces
+ */
+//START SNIPPET: code
+public interface Friend {
+
+    public String sayHello();
+
+    public String helloFromFriend();
+}
+----
+
+
+==  RedBean
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+import javax.ejb.EJBException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+//START SNIPPET: code
+public class RedBean implements Friend {
+
+    public String sayHello() {
+        return "Red says, Hello!";
+    }
+
+    public String helloFromFriend() {
+        try {
+            Friend friend = (Friend) new 
InitialContext().lookup("java:comp/env/myFriend");
+            return "My friend " + friend.sayHello();
+        } catch (NamingException e) {
+            throw new EJBException(e);
+        }
+    }
+}
+----
+
+
+==  ejb-jar.xml
+
+
+[source,xml]
+----
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee";>
+
+  <!-- Notice this changes the global jndi name -->
+  <module-name>wombat</module-name>
+
+  <enterprise-beans>
+
+    <session>
+      <ejb-name>BlueBean</ejb-name>
+      <business-local>org.superbiz.ejblookup.Friend</business-local>
+      <ejb-class>org.superbiz.ejblookup.BlueBean</ejb-class>
+      <session-type>Stateless</session-type>
+      <transaction-type>Container</transaction-type>
+      <ejb-local-ref>
+        <ejb-ref-name>myFriend</ejb-ref-name>
+        <local>org.superbiz.ejblookup.Friend</local>
+        <ejb-link>RedBean</ejb-link>
+      </ejb-local-ref>
+    </session>
+
+    <session>
+      <ejb-name>RedBean</ejb-name>
+      <business-local>org.superbiz.ejblookup.Friend</business-local>
+      <ejb-class>org.superbiz.ejblookup.RedBean</ejb-class>
+      <session-type>Stateless</session-type>
+      <transaction-type>Container</transaction-type>
+      <ejb-local-ref>
+        <ejb-ref-name>myFriend</ejb-ref-name>
+        <local>org.superbiz.ejblookup.Friend</local>
+        <ejb-link>BlueBean</ejb-link>
+      </ejb-local-ref>
+    </session>
+
+  </enterprise-beans>
+</ejb-jar>
+----
+
+    
+
+==  EjbDependencyTest
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+//START SNIPPET: code
+public class EjbDependencyTest extends TestCase {
+
+    private Context context;
+
+    protected void setUp() throws Exception {
+        context = EJBContainer.createEJBContainer().getContext();
+    }
+
+    public void testRed() throws Exception {
+
+        Friend red = (Friend) context.lookup("java:global/wombat/RedBean");
+
+        assertNotNull(red);
+        assertEquals("Red says, Hello!", red.sayHello());
+        assertEquals("My friend Blue says, Hello!", red.helloFromFriend());
+    }
+
+    public void testBlue() throws Exception {
+
+        Friend blue = (Friend) context.lookup("java:global/wombat/BlueBean");
+
+        assertNotNull(blue);
+        assertEquals("Blue says, Hello!", blue.sayHello());
+        assertEquals("My friend Red says, Hello!", blue.helloFromFriend());
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.ejblookup.EjbDependencyTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+INFO - openejb.base = /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/classes
+INFO - Beginning load: 
/Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+INFO - Configuring Service(id=Default Stateless Container, type=Container, 
provider-id=Default Stateless Container)
+INFO - Auto-creating a container for bean BlueBean: Container(type=STATELESS, 
id=Default Stateless Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.ejblookup.EjbDependencyTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Enterprise application 
"/Users/dblevins/examples/lookup-of-ejbs-with-descriptor" loaded.
+INFO - Assembling app: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+INFO - Jndi(name="java:global/wombat/BlueBean!org.superbiz.ejblookup.Friend")
+INFO - Jndi(name="java:global/wombat/BlueBean")
+INFO - Jndi(name="java:global/wombat/RedBean!org.superbiz.ejblookup.Friend")
+INFO - Jndi(name="java:global/wombat/RedBean")
+INFO - 
Jndi(name="java:global/EjbModule136565368/org.superbiz.ejblookup.EjbDependencyTest!org.superbiz.ejblookup.EjbDependencyTest")
+INFO - 
Jndi(name="java:global/EjbModule136565368/org.superbiz.ejblookup.EjbDependencyTest")
+INFO - Created Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default 
Stateless Container)
+INFO - Created Ejb(deployment-id=BlueBean, ejb-name=BlueBean, 
container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, 
ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed 
Container)
+INFO - Started Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default 
Stateless Container)
+INFO - Started Ejb(deployment-id=BlueBean, ejb-name=BlueBean, 
container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, 
ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed 
Container)
+INFO - Deployed 
Application(path=/Users/dblevins/examples/lookup-of-ejbs-with-descriptor)
+INFO - EJBContainer already initialized.  Call ejbContainer.close() to allow 
reinitialization
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.679 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs-with-descriptor.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,196 @@
+= Lookup Of Ejbs
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example lookup-of-ejbs can be browsed at 
https://github.com/apache/tomee/tree/master/examples/lookup-of-ejbs
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  BlueBean
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+import javax.ejb.EJB;
+import javax.ejb.EJBException;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+//START SNIPPET: code
+@Stateless
+@EJB(beanInterface = Friend.class, beanName = "RedBean", name = "myFriend")
+public class BlueBean implements Friend {
+
+    public String sayHello() {
+        return "Blue says, Hello!";
+    }
+
+    public String helloFromFriend() {
+        try {
+            Friend friend = (Friend) new 
InitialContext().lookup("java:comp/env/myFriend");
+            return "My friend " + friend.sayHello();
+        } catch (NamingException e) {
+            throw new EJBException(e);
+        }
+    }
+}
+----
+
+
+==  Friend
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+import javax.ejb.Local;
+
+/**
+ * This is an EJB 3 local business interface
+ * A local business interface may be annotated with the @Local
+ * annotation, but it's optional. A business interface which is
+ * not annotated with @Local or @Remote is assumed to be Local
+ * if the bean does not implement any other interfaces
+ */
+//START SNIPPET: code
+@Local
+public interface Friend {
+
+    public String sayHello();
+
+    public String helloFromFriend();
+}
+----
+
+
+==  RedBean
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+import javax.ejb.EJB;
+import javax.ejb.EJBException;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+//START SNIPPET: code
+@Stateless
+@EJB(beanInterface = Friend.class, beanName = "BlueBean", name = "myFriend")
+public class RedBean implements Friend {
+
+    public String sayHello() {
+        return "Red says, Hello!";
+    }
+
+    public String helloFromFriend() {
+        try {
+            Friend friend = (Friend) new 
InitialContext().lookup("java:comp/env/myFriend");
+            return "My friend " + friend.sayHello();
+        } catch (NamingException e) {
+            throw new EJBException(e);
+        }
+    }
+}
+----
+
+
+==  EjbDependencyTest
+
+
+[source,java]
+----
+package org.superbiz.ejblookup;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+//START SNIPPET: code
+public class EjbDependencyTest extends TestCase {
+
+    private Context context;
+
+    protected void setUp() throws Exception {
+        context = EJBContainer.createEJBContainer().getContext();
+    }
+
+    public void testRed() throws Exception {
+
+        Friend red = (Friend) 
context.lookup("java:global/lookup-of-ejbs/RedBean");
+
+        assertNotNull(red);
+        assertEquals("Red says, Hello!", red.sayHello());
+        assertEquals("My friend Blue says, Hello!", red.helloFromFriend());
+    }
+
+    public void testBlue() throws Exception {
+
+        Friend blue = (Friend) 
context.lookup("java:global/lookup-of-ejbs/BlueBean");
+
+        assertNotNull(blue);
+        assertEquals("Blue says, Hello!", blue.sayHello());
+        assertEquals("My friend Red says, Hello!", blue.helloFromFriend());
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.ejblookup.EjbDependencyTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/lookup-of-ejbs
+INFO - openejb.base = /Users/dblevins/examples/lookup-of-ejbs
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/lookup-of-ejbs/target/classes
+INFO - Beginning load: /Users/dblevins/examples/lookup-of-ejbs/target/classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/lookup-of-ejbs
+INFO - Configuring Service(id=Default Stateless Container, type=Container, 
provider-id=Default Stateless Container)
+INFO - Auto-creating a container for bean RedBean: Container(type=STATELESS, 
id=Default Stateless Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.ejblookup.EjbDependencyTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Enterprise application "/Users/dblevins/examples/lookup-of-ejbs" loaded.
+INFO - Assembling app: /Users/dblevins/examples/lookup-of-ejbs
+INFO - 
Jndi(name="java:global/lookup-of-ejbs/RedBean!org.superbiz.ejblookup.Friend")
+INFO - Jndi(name="java:global/lookup-of-ejbs/RedBean")
+INFO - 
Jndi(name="java:global/lookup-of-ejbs/BlueBean!org.superbiz.ejblookup.Friend")
+INFO - Jndi(name="java:global/lookup-of-ejbs/BlueBean")
+INFO - 
Jndi(name="java:global/EjbModule1374821456/org.superbiz.ejblookup.EjbDependencyTest!org.superbiz.ejblookup.EjbDependencyTest")
+INFO - 
Jndi(name="java:global/EjbModule1374821456/org.superbiz.ejblookup.EjbDependencyTest")
+INFO - Created Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default 
Stateless Container)
+INFO - Created Ejb(deployment-id=BlueBean, ejb-name=BlueBean, 
container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, 
ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed 
Container)
+INFO - Started Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default 
Stateless Container)
+INFO - Started Ejb(deployment-id=BlueBean, ejb-name=BlueBean, 
container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, 
ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed 
Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/lookup-of-ejbs)
+INFO - EJBContainer already initialized.  Call ejbContainer.close() to allow 
reinitialization
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.267 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/lookup-of-ejbs.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mbean-auto-registration.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mbean-auto-registration.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mbean-auto-registration.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mbean-auto-registration.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,172 @@
+= Mbean Auto Registration
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example mbean-auto-registration can be browsed at 
https://github.com/apache/tomee/tree/master/examples/mbean-auto-registration
+
+
+This example shows how to automatically create and register mbeans using TomEE 
features.
+
+=  Dependencies
+
+To be able to use it you need to import the mbean api (annotations):
+
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.apache.openejb</groupId>
+  <artifactId>mbean-annotation-api</artifactId>
+  <version>4.5.0</version>
+  <scope>provided</scope>
+</dependency>
+----
+
+
+=  The MBean
+
+The mbean implements a simple game where the goal is to guess a number.
+
+It allows the user to change the value too.
+
+
+[source,java]
+----
+package org.superbiz.mbean;
+
+import javax.management.Description;
+import javax.management.MBean;
+import javax.management.ManagedAttribute;
+import javax.management.ManagedOperation;
+
+@MBean
+@Description("play with me to guess a number")
+public class GuessHowManyMBean {
+    private int value = 0;
+
+    @ManagedAttribute
+    @Description("you are cheating!")
+    public int getValue() {
+        return value;
+    }
+
+    @ManagedAttribute
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    @ManagedOperation
+    public String tryValue(int userValue) {
+        if (userValue == value) {
+            return "winner";
+        }
+        return "not the correct value, please have another try";
+    }
+}
+----
+
+
+To register a MBean you simply have to specify a property either in 
system.properties,
+or in intial context properties.
+
+    Properties properties = new Properties();
+    properties.setProperty("openejb.user.mbeans.list", 
GuessHowManyMBean.class.getName());
+    EJBContainer.createEJBContainer(properties);
+
+=  Accessing the MBean
+
+Then simply get the platform server and you can play with parameters and 
operations:
+
+
+[source,java]
+----
+package org.superbiz.mbean;
+
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.management.Attribute;
+import javax.management.MBeanInfo;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import java.lang.management.ManagementFactory;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+
+public class GuessHowManyMBeanTest {
+    private static final String OBJECT_NAME = 
"openejb.user.mbeans:group=org.superbiz.mbean,application=mbean-auto-registration,name=GuessHowManyMBean";
+
+    @Test
+    public void play() throws Exception {
+        Properties properties = new Properties();
+        properties.setProperty("openejb.user.mbeans.list", 
GuessHowManyMBean.class.getName());
+        EJBContainer container = EJBContainer.createEJBContainer(properties);
+
+        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+        ObjectName objectName = new ObjectName(OBJECT_NAME);
+        MBeanInfo infos = server.getMBeanInfo(objectName);
+        assertEquals(0, server.getAttribute(objectName, "value"));
+        server.setAttribute(objectName, new Attribute("value", 3));
+        assertEquals(3, server.getAttribute(objectName, "value"));
+        assertEquals("winner", server.invoke(objectName, "tryValue", new 
Object[]{3}, null));
+        assertEquals("not the correct value, please have another try", 
server.invoke(objectName, "tryValue", new Object[]{2}, null));
+
+        container.close();
+    }
+}
+----
+
+
+====  Note
+
+If OpenEJB can't find any module it can't start. So to force him to start even 
if the example has only the mbean
+as java class, we added a `beans.xml` file to turn our project into a Java EE 
module.
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.mbean.GuessHowManyMBeanTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/mbean-auto-registration
+INFO - openejb.base = /Users/dblevins/examples/mbean-auto-registration
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/mbean-auto-registration/target/classes
+INFO - Beginning load: 
/Users/dblevins/examples/mbean-auto-registration/target/classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/mbean-auto-registration
+INFO - MBean 
openejb.user.mbeans:application=,group=org.superbiz.mbean,name=GuessHowManyMBean
 registered.
+INFO - MBean 
openejb.user.mbeans:application=mbean-auto-registration,group=org.superbiz.mbean,name=GuessHowManyMBean
 registered.
+INFO - MBean 
openejb.user.mbeans:application=EjbModule1847652919,group=org.superbiz.mbean,name=GuessHowManyMBean
 registered.
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean mbean-auto-registration.Comp: 
Container(type=MANAGED, id=Default Managed Container)
+INFO - Enterprise application 
"/Users/dblevins/examples/mbean-auto-registration" loaded.
+INFO - Assembling app: /Users/dblevins/examples/mbean-auto-registration
+INFO - 
Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp!org.apache.openejb.BeanContext$Comp")
+INFO - 
Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp")
+INFO - 
Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest!org.superbiz.mbean.GuessHowManyMBeanTest")
+INFO - 
Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest")
+INFO - Created Ejb(deployment-id=mbean-auto-registration.Comp, 
ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
+INFO - Created Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, 
ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed 
Container)
+INFO - Started Ejb(deployment-id=mbean-auto-registration.Comp, 
ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
+INFO - Started Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, 
ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed 
Container)
+INFO - Deployed 
Application(path=/Users/dblevins/examples/mbean-auto-registration)
+INFO - Undeploying app: /Users/dblevins/examples/mbean-auto-registration
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.063 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mbean-auto-registration.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun-rest.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun-rest.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun-rest.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun-rest.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,9 @@
+= moviefun-rest
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example moviefun-rest can be browsed at 
https://github.com/apache/tomee/tree/master/examples/moviefun-rest
+
+No README.md yet, be the first to contribute one!

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun-rest.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,385 @@
+= Movies Complete
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example moviefun can be browsed at 
https://github.com/apache/tomee/tree/master/examples/moviefun
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  AddInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class AddInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Add
+        return context.proceed();
+    }
+}
+----
+
+
+==  DeleteInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class DeleteInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Delete
+        return context.proceed();
+    }
+}
+----
+
+
+==  Movie
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Movie {
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}
+----
+
+
+==  Movies
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.annotation.security.PermitAll;
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.interceptor.Interceptors;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import java.util.List;
+
+//START SNIPPET: code
+@Stateful
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = 
PersistenceContextType.TRANSACTION)
+    private EntityManager entityManager;
+
+    @RolesAllowed({"Employee", "Manager"})
+    @TransactionAttribute(TransactionAttributeType.REQUIRED)
+    @Interceptors(AddInterceptor.class)
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    @RolesAllowed({"Manager"})
+    @TransactionAttribute(TransactionAttributeType.MANDATORY)
+    @Interceptors(DeleteInterceptor.class)
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    @PermitAll
+    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+}
+----
+
+
+==  ReadInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class ReadInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Delete
+        return context.proceed();
+    }
+}
+----
+
+
+==  persistence.xml
+
+
+[source,xml]
+----
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"; version="1.0">
+
+  <persistence-unit name="movie-unit">
+    <jta-data-source>movieDatabase</jta-data-source>
+    <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+    <class>org.superbiz.injection.tx.Movie</class>
+
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>
+----
+
+
+==  MoviesTest
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import junit.framework.TestCase;
+
+import javax.annotation.security.RunAs;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.embeddable.EJBContainer;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+
+import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+
+/**
+ * See the transaction-rollback example as it does the same thing
+ * via UserTransaction and shows more techniques for rollback 
+ */
+//START SNIPPET: code
+public class MoviesTest extends TestCase {
+
+    @EJB
+    private Movies movies;
+
+    @EJB(beanName = "TransactionBean")
+    private Caller transactionalCaller;
+
+    @EJB(beanName = "NoTransactionBean")
+    private Caller nonTransactionalCaller;
+
+    protected void setUp() throws Exception {
+        final Properties p = new Properties();
+        p.put("movieDatabase", "new://Resource?type=DataSource");
+        p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+        EJBContainer.createEJBContainer(p).getContext().bind("inject", this);
+    }
+
+    private void doWork() throws Exception {
+
+        movies.addMovie(new Movie("Quentin Tarantino", "Reservoir Dogs", 
1992));
+        movies.addMovie(new Movie("Joel Coen", "Fargo", 1996));
+        movies.addMovie(new Movie("Joel Coen", "The Big Lebowski", 1998));
+
+        List<Movie> list = movies.getMovies();
+        assertEquals("List.size()", 3, list.size());
+
+        for (Movie movie : list) {
+            movies.deleteMovie(movie);
+        }
+
+        assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
+    }
+
+    public void testWithTransaction() throws Exception {
+        transactionalCaller.call(new Callable() {
+            public Object call() throws Exception {
+                doWork();
+                return null;
+            }
+        });
+    }
+
+    public void testWithoutTransaction() throws Exception {
+        try {
+            nonTransactionalCaller.call(new Callable() {
+                public Object call() throws Exception {
+                    doWork();
+                    return null;
+                }
+            });
+            fail("The Movies bean should be using 
TransactionAttributeType.MANDATORY");
+        } catch (javax.ejb.EJBException e) {
+            // good, our Movies bean is using 
TransactionAttributeType.MANDATORY as we want
+        }
+    }
+
+
+    public static interface Caller {
+        public <V> V call(Callable<V> callable) throws Exception;
+    }
+
+    /**
+     * This little bit of magic allows our test code to execute in
+     * the scope of a container controlled transaction.
+     */
+    @Stateless
+    @RunAs("Manager")
+    @TransactionAttribute(REQUIRES_NEW)
+    public static class TransactionBean implements Caller {
+
+        public <V> V call(Callable<V> callable) throws Exception {
+            return callable.call();
+        }
+    }
+
+    @Stateless
+    @RunAs("Manager")
+    @TransactionAttribute(TransactionAttributeType.NEVER)
+    public static class NoTransactionBean implements Caller {
+
+        public <V> V call(Callable<V> callable) throws Exception {
+            return callable.call();
+        }
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.injection.tx.MoviesTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/movies-complete
+INFO - openejb.base = /Users/dblevins/examples/movies-complete
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Configuring Service(id=movieDatabase, type=Resource, 
provider-id=Default JDBC Database)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/movies-complete/target/classes
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/movies-complete/target/test-classes
+INFO - Beginning load: /Users/dblevins/examples/movies-complete/target/classes
+INFO - Beginning load: 
/Users/dblevins/examples/movies-complete/target/test-classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/movies-complete
+INFO - Configuring Service(id=Default Stateful Container, type=Container, 
provider-id=Default Stateful Container)
+INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, 
id=Default Stateful Container)
+INFO - Configuring Service(id=Default Stateless Container, type=Container, 
provider-id=Default Stateless Container)
+INFO - Auto-creating a container for bean TransactionBean: 
Container(type=STATELESS, id=Default Stateless Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Configuring PersistenceUnit(name=movie-unit)
+INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 
'DataSource for 'movie-unit'.
+INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, 
provider-id=movieDatabase)
+INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource 
ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
+INFO - Enterprise application "/Users/dblevins/examples/movies-complete" 
loaded.
+INFO - Assembling app: /Users/dblevins/examples/movies-complete
+INFO - PersistenceUnit(name=movie-unit, 
provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider 
time 402ms
+INFO - 
Jndi(name="java:global/movies-complete/Movies!org.superbiz.injection.tx.Movies")
+INFO - Jndi(name="java:global/movies-complete/Movies")
+INFO - 
Jndi(name="java:global/movies-complete/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+INFO - Jndi(name="java:global/movies-complete/TransactionBean")
+INFO - 
Jndi(name="java:global/movies-complete/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+INFO - Jndi(name="java:global/movies-complete/NoTransactionBean")
+INFO - 
Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest")
+INFO - 
Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest")
+INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default 
Stateful Container)
+INFO - Created Ejb(deployment-id=NoTransactionBean, 
ejb-name=NoTransactionBean, container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, 
container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, 
ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed 
Container)
+INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default 
Stateful Container)
+INFO - Started Ejb(deployment-id=NoTransactionBean, 
ejb-name=NoTransactionBean, container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, 
container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, 
ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed 
Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete)
+INFO - EJBContainer already initialized.  Call ejbContainer.close() to allow 
reinitialization
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.418 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/moviefun.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete-meta.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete-meta.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete-meta.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete-meta.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,502 @@
+= Movies Complete Meta
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example movies-complete-meta can be browsed at 
https://github.com/apache/tomee/tree/master/examples/movies-complete-meta
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  AddInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class AddInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Add
+        return context.proceed();
+    }
+}
+----
+
+
+==  Add
+
+
+[source,java]
+----
+package org.superbiz.injection.tx.api;
+
+import org.superbiz.injection.tx.AddInterceptor;
+
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.interceptor.Interceptors;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+
+public @interface Add {
+    public interface $ {
+
+        @Add
+        @RolesAllowed({"Employee", "Manager"})
+        @TransactionAttribute(TransactionAttributeType.REQUIRED)
+        @Interceptors(AddInterceptor.class)
+        public void method();
+    }
+}
+----
+
+
+==  Delete
+
+
+[source,java]
+----
+package org.superbiz.injection.tx.api;
+
+import org.superbiz.injection.tx.DeleteInterceptor;
+
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.interceptor.Interceptors;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+
+public @interface Delete {
+    public interface $ {
+
+        @Delete
+        @RolesAllowed({"Manager"})
+        @TransactionAttribute(TransactionAttributeType.MANDATORY)
+        @Interceptors(DeleteInterceptor.class)
+        public void method();
+    }
+}
+----
+
+
+==  Metatype
+
+
+[source,java]
+----
+package org.superbiz.injection.tx.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Metatype {
+}
+----
+
+
+==  MovieUnit
+
+
+[source,java]
+----
+package org.superbiz.injection.tx.api;
+
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+@Metatype
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+
+@PersistenceContext(name = "movie-unit", unitName = "movie-unit", type = 
PersistenceContextType.EXTENDED)
+public @interface MovieUnit {
+}
+----
+
+
+==  Read
+
+
+[source,java]
+----
+package org.superbiz.injection.tx.api;
+
+import javax.annotation.security.PermitAll;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+
+public @interface Read {
+    public interface $ {
+
+        @Read
+        @PermitAll
+        @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+        public void method();
+    }
+}
+----
+
+
+==  DeleteInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class DeleteInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Delete
+        return context.proceed();
+    }
+}
+----
+
+
+==  Movie
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Movie {
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}
+----
+
+
+==  Movies
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import org.superbiz.injection.tx.api.Add;
+import org.superbiz.injection.tx.api.Delete;
+import org.superbiz.injection.tx.api.MovieUnit;
+import org.superbiz.injection.tx.api.Read;
+
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.List;
+
+//END SNIPPET: code
+
+//START SNIPPET: code
+@Stateful
+public class Movies {
+
+    @MovieUnit
+    private EntityManager entityManager;
+
+    @Add
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    @Delete
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    @Read
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+}
+----
+
+
+==  persistence.xml
+
+
+[source,xml]
+----
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"; version="1.0">
+
+  <persistence-unit name="movie-unit">
+    <jta-data-source>movieDatabase</jta-data-source>
+    <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+    <class>org.superbiz.injection.tx.Movie</class>
+
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>
+----
+
+
+==  MoviesTest
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import junit.framework.TestCase;
+
+import javax.annotation.security.RunAs;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.embeddable.EJBContainer;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+
+import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+
+/**
+ * See the transaction-rollback example as it does the same thing
+ * via UserTransaction and shows more techniques for rollback 
+ */
+//START SNIPPET: code
+public class MoviesTest extends TestCase {
+
+    @EJB
+    private Movies movies;
+
+    @EJB(beanName = "TransactionBean")
+    private Caller transactionalCaller;
+
+    @EJB(beanName = "NoTransactionBean")
+    private Caller nonTransactionalCaller;
+
+    protected void setUp() throws Exception {
+        final Properties p = new Properties();
+        p.put("movieDatabase", "new://Resource?type=DataSource");
+        p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+        EJBContainer.createEJBContainer(p).getContext().bind("inject", this);
+    }
+
+    private void doWork() throws Exception {
+
+        movies.addMovie(new Movie("Quentin Tarantino", "Reservoir Dogs", 
1992));
+        movies.addMovie(new Movie("Joel Coen", "Fargo", 1996));
+        movies.addMovie(new Movie("Joel Coen", "The Big Lebowski", 1998));
+
+        List<Movie> list = movies.getMovies();
+        assertEquals("List.size()", 3, list.size());
+
+        for (Movie movie : list) {
+            movies.deleteMovie(movie);
+        }
+
+        assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
+    }
+
+    public void testWithTransaction() throws Exception {
+        transactionalCaller.call(new Callable() {
+            public Object call() throws Exception {
+                doWork();
+                return null;
+            }
+        });
+    }
+
+    public void testWithoutTransaction() throws Exception {
+        try {
+            nonTransactionalCaller.call(new Callable() {
+                public Object call() throws Exception {
+                    doWork();
+                    return null;
+                }
+            });
+            fail("The Movies bean should be using 
TransactionAttributeType.MANDATORY");
+        } catch (javax.ejb.EJBException e) {
+            // good, our Movies bean is using 
TransactionAttributeType.MANDATORY as we want
+        }
+    }
+
+
+    public static interface Caller {
+        public <V> V call(Callable<V> callable) throws Exception;
+    }
+
+    /**
+     * This little bit of magic allows our test code to execute in
+     * the scope of a container controlled transaction.
+     */
+    @Stateless
+    @RunAs("Manager")
+    @TransactionAttribute(REQUIRES_NEW)
+    public static class TransactionBean implements Caller {
+
+        public <V> V call(Callable<V> callable) throws Exception {
+            return callable.call();
+        }
+    }
+
+    @Stateless
+    @RunAs("Manager")
+    @TransactionAttribute(TransactionAttributeType.NEVER)
+    public static class NoTransactionBean implements Caller {
+
+        public <V> V call(Callable<V> callable) throws Exception {
+            return callable.call();
+        }
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.injection.tx.MoviesTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/movies-complete-meta
+INFO - openejb.base = /Users/dblevins/examples/movies-complete-meta
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Configuring Service(id=movieDatabase, type=Resource, 
provider-id=Default JDBC Database)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/movies-complete-meta/target/test-classes
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/movies-complete-meta/target/classes
+INFO - Beginning load: 
/Users/dblevins/examples/movies-complete-meta/target/test-classes
+INFO - Beginning load: 
/Users/dblevins/examples/movies-complete-meta/target/classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/movies-complete-meta
+INFO - Configuring Service(id=Default Stateless Container, type=Container, 
provider-id=Default Stateless Container)
+INFO - Auto-creating a container for bean TransactionBean: 
Container(type=STATELESS, id=Default Stateless Container)
+INFO - Configuring Service(id=Default Stateful Container, type=Container, 
provider-id=Default Stateful Container)
+INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, 
id=Default Stateful Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Configuring PersistenceUnit(name=movie-unit)
+INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 
'DataSource for 'movie-unit'.
+INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, 
provider-id=movieDatabase)
+INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource 
ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
+INFO - Enterprise application "/Users/dblevins/examples/movies-complete-meta" 
loaded.
+INFO - Assembling app: /Users/dblevins/examples/movies-complete-meta
+INFO - PersistenceUnit(name=movie-unit, 
provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider 
time 408ms
+INFO - 
Jndi(name="java:global/movies-complete-meta/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+INFO - Jndi(name="java:global/movies-complete-meta/TransactionBean")
+INFO - 
Jndi(name="java:global/movies-complete-meta/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+INFO - Jndi(name="java:global/movies-complete-meta/NoTransactionBean")
+INFO - 
Jndi(name="java:global/movies-complete-meta/Movies!org.superbiz.injection.tx.Movies")
+INFO - Jndi(name="java:global/movies-complete-meta/Movies")
+INFO - 
Jndi(name="java:global/EjbModule1861413442/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest")
+INFO - 
Jndi(name="java:global/EjbModule1861413442/org.superbiz.injection.tx.MoviesTest")
+INFO - Created Ejb(deployment-id=NoTransactionBean, 
ejb-name=NoTransactionBean, container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, 
container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default 
Stateful Container)
+INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, 
ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed 
Container)
+INFO - Started Ejb(deployment-id=NoTransactionBean, 
ejb-name=NoTransactionBean, container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, 
container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default 
Stateful Container)
+INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, 
ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed 
Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete-meta)
+INFO - EJBContainer already initialized.  Call ejbContainer.close() to allow 
reinitialization
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.869 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete-meta.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,385 @@
+= Movies Complete
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example movies-complete can be browsed at 
https://github.com/apache/tomee/tree/master/examples/movies-complete
+
+
+*Help us document this example! Click the blue pencil icon in the upper right 
to edit this page.*
+
+==  AddInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class AddInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Add
+        return context.proceed();
+    }
+}
+----
+
+
+==  DeleteInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class DeleteInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Delete
+        return context.proceed();
+    }
+}
+----
+
+
+==  Movie
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Movie {
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}
+----
+
+
+==  Movies
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.annotation.security.PermitAll;
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.interceptor.Interceptors;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import java.util.List;
+
+//START SNIPPET: code
+@Stateful
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = 
PersistenceContextType.TRANSACTION)
+    private EntityManager entityManager;
+
+    @RolesAllowed({"Employee", "Manager"})
+    @TransactionAttribute(TransactionAttributeType.REQUIRED)
+    @Interceptors(AddInterceptor.class)
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    @RolesAllowed({"Manager"})
+    @TransactionAttribute(TransactionAttributeType.MANDATORY)
+    @Interceptors(DeleteInterceptor.class)
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    @PermitAll
+    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+}
+----
+
+
+==  ReadInterceptor
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class ReadInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Delete
+        return context.proceed();
+    }
+}
+----
+
+
+==  persistence.xml
+
+
+[source,xml]
+----
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"; version="1.0">
+
+  <persistence-unit name="movie-unit">
+    <jta-data-source>movieDatabase</jta-data-source>
+    <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+    <class>org.superbiz.injection.tx.Movie</class>
+
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>
+----
+
+
+==  MoviesTest
+
+
+[source,java]
+----
+package org.superbiz.injection.tx;
+
+import junit.framework.TestCase;
+
+import javax.annotation.security.RunAs;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.embeddable.EJBContainer;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+
+import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+
+/**
+ * See the transaction-rollback example as it does the same thing
+ * via UserTransaction and shows more techniques for rollback 
+ */
+//START SNIPPET: code
+public class MoviesTest extends TestCase {
+
+    @EJB
+    private Movies movies;
+
+    @EJB(beanName = "TransactionBean")
+    private Caller transactionalCaller;
+
+    @EJB(beanName = "NoTransactionBean")
+    private Caller nonTransactionalCaller;
+
+    protected void setUp() throws Exception {
+        final Properties p = new Properties();
+        p.put("movieDatabase", "new://Resource?type=DataSource");
+        p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+        EJBContainer.createEJBContainer(p).getContext().bind("inject", this);
+    }
+
+    private void doWork() throws Exception {
+
+        movies.addMovie(new Movie("Quentin Tarantino", "Reservoir Dogs", 
1992));
+        movies.addMovie(new Movie("Joel Coen", "Fargo", 1996));
+        movies.addMovie(new Movie("Joel Coen", "The Big Lebowski", 1998));
+
+        List<Movie> list = movies.getMovies();
+        assertEquals("List.size()", 3, list.size());
+
+        for (Movie movie : list) {
+            movies.deleteMovie(movie);
+        }
+
+        assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
+    }
+
+    public void testWithTransaction() throws Exception {
+        transactionalCaller.call(new Callable() {
+            public Object call() throws Exception {
+                doWork();
+                return null;
+            }
+        });
+    }
+
+    public void testWithoutTransaction() throws Exception {
+        try {
+            nonTransactionalCaller.call(new Callable() {
+                public Object call() throws Exception {
+                    doWork();
+                    return null;
+                }
+            });
+            fail("The Movies bean should be using 
TransactionAttributeType.MANDATORY");
+        } catch (javax.ejb.EJBException e) {
+            // good, our Movies bean is using 
TransactionAttributeType.MANDATORY as we want
+        }
+    }
+
+
+    public static interface Caller {
+        public <V> V call(Callable<V> callable) throws Exception;
+    }
+
+    /**
+     * This little bit of magic allows our test code to execute in
+     * the scope of a container controlled transaction.
+     */
+    @Stateless
+    @RunAs("Manager")
+    @TransactionAttribute(REQUIRES_NEW)
+    public static class TransactionBean implements Caller {
+
+        public <V> V call(Callable<V> callable) throws Exception {
+            return callable.call();
+        }
+    }
+
+    @Stateless
+    @RunAs("Manager")
+    @TransactionAttribute(TransactionAttributeType.NEVER)
+    public static class NoTransactionBean implements Caller {
+
+        public <V> V call(Callable<V> callable) throws Exception {
+            return callable.call();
+        }
+    }
+}
+----
+
+
+=  Running
+
+    
+
+[source]
+----
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.injection.tx.MoviesTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/movies-complete
+INFO - openejb.base = /Users/dblevins/examples/movies-complete
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Configuring Service(id=movieDatabase, type=Resource, 
provider-id=Default JDBC Database)
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/movies-complete/target/classes
+INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/movies-complete/target/test-classes
+INFO - Beginning load: /Users/dblevins/examples/movies-complete/target/classes
+INFO - Beginning load: 
/Users/dblevins/examples/movies-complete/target/test-classes
+INFO - Configuring enterprise application: 
/Users/dblevins/examples/movies-complete
+INFO - Configuring Service(id=Default Stateful Container, type=Container, 
provider-id=Default Stateful Container)
+INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, 
id=Default Stateful Container)
+INFO - Configuring Service(id=Default Stateless Container, type=Container, 
provider-id=Default Stateless Container)
+INFO - Auto-creating a container for bean TransactionBean: 
Container(type=STATELESS, id=Default Stateless Container)
+INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
+INFO - Auto-creating a container for bean 
org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default 
Managed Container)
+INFO - Configuring PersistenceUnit(name=movie-unit)
+INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 
'DataSource for 'movie-unit'.
+INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, 
provider-id=movieDatabase)
+INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource 
ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
+INFO - Enterprise application "/Users/dblevins/examples/movies-complete" 
loaded.
+INFO - Assembling app: /Users/dblevins/examples/movies-complete
+INFO - PersistenceUnit(name=movie-unit, 
provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider 
time 402ms
+INFO - 
Jndi(name="java:global/movies-complete/Movies!org.superbiz.injection.tx.Movies")
+INFO - Jndi(name="java:global/movies-complete/Movies")
+INFO - 
Jndi(name="java:global/movies-complete/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+INFO - Jndi(name="java:global/movies-complete/TransactionBean")
+INFO - 
Jndi(name="java:global/movies-complete/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+INFO - Jndi(name="java:global/movies-complete/NoTransactionBean")
+INFO - 
Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest")
+INFO - 
Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest")
+INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default 
Stateful Container)
+INFO - Created Ejb(deployment-id=NoTransactionBean, 
ejb-name=NoTransactionBean, container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, 
container=Default Stateless Container)
+INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, 
ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed 
Container)
+INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default 
Stateful Container)
+INFO - Started Ejb(deployment-id=NoTransactionBean, 
ejb-name=NoTransactionBean, container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, 
container=Default Stateless Container)
+INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, 
ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed 
Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete)
+INFO - EJBContainer already initialized.  Call ejbContainer.close() to allow 
reinitialization
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.418 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+----
+
+    

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/movies-complete.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mtom.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mtom.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mtom.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mtom.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,8 @@
+= mtom
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example mtom can be browsed at 
https://github.com/apache/tomee/tree/master/examples/mtom
+

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/mtom.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,9 @@
+= multi-jpa-provider-testing
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example multi-jpa-provider-testing can be browsed at 
https://github.com/apache/tomee/tree/master/examples/multi-jpa-provider-testing
+
+No README.md yet, be the first to contribute one!

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,9 @@
+= multiple-arquillian-adapters
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example multiple-arquillian-adapters can be browsed at 
https://github.com/apache/tomee/tree/master/examples/multiple-arquillian-adapters
+
+No README.md yet, be the first to contribute one!

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,9 @@
+= multiple-tomee-arquillian
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example multiple-tomee-arquillian can be browsed at 
https://github.com/apache/tomee/tree/master/examples/multiple-tomee-arquillian
+
+No README.md yet, be the first to contribute one!

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc
------------------------------------------------------------------------------
    svn:executable = *

Added: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/myfaces-codi-demo.adoc
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/myfaces-codi-demo.adoc?rev=1772522&view=auto
==============================================================================
--- 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/myfaces-codi-demo.adoc
 (added)
+++ 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/myfaces-codi-demo.adoc
 Sun Dec  4 11:01:40 2016
@@ -0,0 +1,76 @@
+= MyFaces CODI Demo
+:jbake-date: 2016-09-06
+:jbake-type: page
+:jbake-tomeepdf:
+:jbake-status: published
+
+Example myfaces-codi-demo can be browsed at 
https://github.com/apache/tomee/tree/master/examples/myfaces-codi-demo
+
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+<h2>Steps to run the example</h2>
+
+Build and start the demo:
+
+    mvn clean package tomee:run
+
+Open:
+
+    http://localhost:8080/myfaces-codi-1.0-SNAPSHOT/
+
+This example shows how to improve JSF2/CDI/BV/JPA applications with features 
provided by Apache MyFaces CODI and ExtVal.
+
+<h2>Intro of MyFaces CODI and ExtVal</h2>
+
+The Apache MyFaces Extensions CDI project (aka CODI) hosts portable extensions 
for Contexts and Dependency Injection (CDI - JSR 299). CODI is a toolbox for 
your CDI application. Like CDI itself CODI is focused on type-safety. It is a 
modularized and extensible framework. So it's easy to choose the needed parts 
to facilitate the daily work in your project.
+
+MyFaces Extensions Validator (aka ExtVal) is a JSF centric validation 
framework which is compatible with JSF 1.x and JSF 2.x.
+This example shows how it improves the default integration of Bean-Validation 
(JSR-303) with JSF2 as well as meta-data based cross-field validation.
+
+
+<h2>Illustrated Features</h2>
+
+<h3>Apache MyFaces CODI</h3>
+
+<ul>
+
+[source,xml]
+----
+<li><a href="./src/main/java/org/superbiz/myfaces/view/config/Pages.java" 
target="_blank">Type-safe view-config</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/InfoPage.java" 
target="_blank">Type-safe (custom) view-meta-data</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/MenuBean.java" 
target="_blank">Type-safe navigation</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/CustomJsfModuleConfig.java" 
target="_blank">Type-safe (specialized) config</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/CustomProjectStage.java" 
target="_blank">Type-safe custom project-stage</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/UserHolder.java" 
target="_blank">@WindowScoped</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/MenuBean.java" 
target="_blank">Controlling CODI scopes with WindowContext</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/FeedbackPage.java" 
target="_blank">@ViewAccessScoped</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/FeedbackPage.java" 
target="_blank">Manual conversation handling</a></li>
+<li><a 
href="./src/main/java/org/superbiz/myfaces/view/security/LoginAccessDecisionVoter.java"
 target="_blank">Secured pages (AccessDecisionVoter)</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/repository/Repository.java" 
target="_blank">@Transactional</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/RegistrationPage.java" 
target="_blank">I18n (fluent API)</a></li>
+<li><a 
href="./src/main/java/org/superbiz/myfaces/domain/validation/UniqueUserNameValidator.java"
 target="_blank">Dependency-Injection for JSR303 (BV) 
constraint-validators</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/DebugPhaseListener.java" 
target="_blank">Dependency-Injection for JSF phase-listeners</a></li>
+</ul>
+
+<h3>Apache MyFaces ExtVal</h3>
+
+<ul>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/RegistrationPage.java" 
target="_blank">Cross-Field validation (@Equals)</a></li>
+<li><a href="./src/main/java/org/superbiz/myfaces/view/RegistrationPage.java" 
target="_blank">Type-safe group-validation (@BeanValidation) for JSF 
action-methods</a></li>
+</ul>
+

Propchange: 
tomee/site/trunk/generators/site-tomee-ng/src/main/jbake/content/examples/myfaces-codi-demo.adoc
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to