tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [33/35] tomee-site-generator git commit: import from old website
Date Tue, 04 Jul 2017 18:22:11 GMT
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/972cc356/examples.cache
----------------------------------------------------------------------
diff --git a/examples.cache b/examples.cache
new file mode 100755
index 0000000..ba5ccce
--- /dev/null
+++ b/examples.cache
@@ -0,0 +1,1653 @@
+{
+  "all":{
+    "adapters":[
+      {
+        "name":"multiple-arquillian-adapters",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/multiple-arquillian-adapters"
+      }
+    ],
+    "alternate":[
+      {
+        "name":"alternate-descriptors",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/alternate-descriptors"
+      }
+    ],
+    "alternative":[
+      {
+        "name":"cdi-alternative-and-stereotypes",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-alternative-and-stereotypes"
+      }
+    ],
+    "applet":[
+      {
+        "name":"applet",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/applet"
+      }
+    ],
+    "applicationcomposer":[
+      {
+        "name":"applicationcomposer-jaxws-cdi",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/applicationcomposer-jaxws-cdi"
+      },
+      {
+        "name":"rest-applicationcomposer",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/rest-applicationcomposer"
+      },
+      {
+        "name":"application-composer",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/application-composer"
+      },
+      {
+        "name":"rest-applicationcomposer-mockito",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/rest-applicationcomposer-mockito"
+      }
+    ],
+    "applicationexception":[
+      {
+        "name":"applicationexception",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/applicationexception"
+      }
+    ],
+    "arquillian":[
+      {
+        "name":"arquillian-jpa",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/arquillian-jpa"
+      },
+      {
+        "name":"multiple-tomee-arquillian",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/multiple-tomee-arquillian"
+      },
+      {
+        "name":"multiple-arquillian-adapters",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/multiple-arquillian-adapters"
+      }
+    ],
+    "async":[
+      {
+        "name":"async-postconstruct",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/async-postconstruct"
+      },
+      {
+        "name":"async-methods",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/async-methods"
+      }
+    ],
+    "attachments":[
+      {
+        "name":"webservice-attachments",
+        "readme":"Title: Webservice Attachments\n\n*Help us document this example! Click the blue pencil icon in the upper right to edit this page.*\n\n## AttachmentImpl\n\n    package org.superbiz.attachment;\n    \n    import javax.activation.DataHandler;\n    import javax.activation.DataSource;\n    import javax.ejb.Stateless;\n    import javax.jws.WebService;\n    import javax.xml.ws.BindingType;\n    import javax.xml.ws.soap.SOAPBinding;\n    import java.io.IOException;\n    import java.io.InputStream;\n    \n    /**\n     * This is an EJB 3 style pojo stateless session bean\n     * Every stateless session bean implementation must be annotated\n     * using the annotation @Stateless\n     * This EJB has a single interface: {@link AttachmentWs} a webservice interface.\n     */\n    @Stateless\n    @WebService(\n            portName = \"AttachmentPort\",\n            serviceName = \"AttachmentWsService\",\n            targetNamespace = \"http://superbiz.org/wsdl\",\n            e
 ndpointInterface = \"org.superbiz.attachment.AttachmentWs\")\n    @BindingType(value = SOAPBinding.SOAP12HTTP_MTOM_BINDING)\n    public class AttachmentImpl implements AttachmentWs {\n    \n        public String stringFromBytes(byte[] data) {\n            return new String(data);\n        }\n    \n        public String stringFromDataSource(DataSource source) {\n    \n            try {\n                InputStream inStr = source.getInputStream();\n                int size = inStr.available();\n                byte[] data = new byte[size];\n                inStr.read(data);\n                inStr.close();\n                return new String(data);\n            } catch (IOException e) {\n                e.printStackTrace();\n            }\n            return \"\";\n        }\n    \n        public String stringFromDataHandler(DataHandler handler) {\n    \n            try {\n                return (String) handler.getContent();\n            } catch (IOException e) {\n                e.pri
 ntStackTrace();\n            }\n            return \"\";\n        }\n    }\n\n## AttachmentWs\n\n    package org.superbiz.attachment;\n    \n    import javax.activation.DataHandler;\n    import javax.jws.WebService;\n    \n    /**\n     * This is an EJB 3 webservice interface to send attachments throughout SAOP.\n     */\n    @WebService(targetNamespace = \"http://superbiz.org/wsdl\")\n    public interface AttachmentWs {\n    \n        public String stringFromBytes(byte[] data);\n    \n        // Not working at the moment with SUN saaj provider and CXF\n        //public String stringFromDataSource(DataSource source);\n    \n        public String stringFromDataHandler(DataHandler handler);\n    }\n\n## ejb-jar.xml\n\n    <ejb-jar/>\n\n## AttachmentTest\n\n    package org.superbiz.attachment;\n    \n    import junit.framework.TestCase;\n    \n    import javax.activation.DataHandler;\n    import javax.activation.DataSource;\n    import javax.mail.util.ByteArrayDataSource;\n    import j
 avax.naming.Context;\n    import javax.naming.InitialContext;\n    import javax.xml.namespace.QName;\n    import javax.xml.ws.BindingProvider;\n    import javax.xml.ws.Service;\n    import javax.xml.ws.soap.SOAPBinding;\n    import java.net.URL;\n    import java.util.Properties;\n    \n    public class AttachmentTest extends TestCase {\n    \n        //START SNIPPET: setup\t\n        private InitialContext initialContext;\n    \n        protected void setUp() throws Exception {\n    \n            Properties properties = new Properties();\n            properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, \"org.apache.openejb.core.LocalInitialContextFactory\");\n            properties.setProperty(\"openejb.embedded.remotable\", \"true\");\n    \n            initialContext = new InitialContext(properties);\n        }\n        //END SNIPPET: setup    \n    \n        /**\n         * Create a webservice client using wsdl url\n         *\n         * @throws Exception\n         */\n      
   //START SNIPPET: webservice\n        public void testAttachmentViaWsInterface() throws Exception {\n            Service service = Service.create(\n                    new URL(\"http://127.0.0.1:4204/AttachmentImpl?wsdl\"),\n                    new QName(\"http://superbiz.org/wsdl\", \"AttachmentWsService\"));\n            assertNotNull(service);\n    \n            AttachmentWs ws = service.getPort(AttachmentWs.class);\n    \n            // retrieve the SOAPBinding\n            SOAPBinding binding = (SOAPBinding) ((BindingProvider) ws).getBinding();\n            binding.setMTOMEnabled(true);\n    \n            String request = \"tsztelak@gmail.com\";\n    \n            // Byte array\n            String response = ws.stringFromBytes(request.getBytes());\n            assertEquals(request, response);\n    \n            // Data Source\n            DataSource source = new ByteArrayDataSource(request.getBytes(), \"text/plain; charset=UTF-8\");\n    \n            // not yet supported !\n 
    //        response = ws.stringFromDataSource(source);\n    //        assertEquals(request, response);\n    \n            // Data Handler\n            response = ws.stringFromDataHandler(new DataHandler(source));\n            assertEquals(request, response);\n        }\n        //END SNIPPET: webservice\n    }\n\n# Running\n\n    \n    -------------------------------------------------------\n     T E S T S\n    -------------------------------------------------------\n    Running org.superbiz.attachment.AttachmentTest\n    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06\n    http://tomee.apache.org/\n    INFO - openejb.home = /Users/dblevins/examples/webservice-attachments\n    INFO - openejb.base = /Users/dblevins/examples/webservice-attachments\n    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)\n    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Tran
 saction Manager)\n    INFO - Found EjbModule in classpath: /Users/dblevins/examples/webservice-attachments/target/classes\n    INFO - Beginning load: /Users/dblevins/examples/webservice-attachments/target/classes\n    INFO - Configuring enterprise application: /Users/dblevins/examples/webservice-attachments/classpath.ear\n    INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)\n    INFO - Auto-creating a container for bean AttachmentImpl: Container(type=STATELESS, id=Default Stateless Container)\n    INFO - Enterprise application \"/Users/dblevins/examples/webservice-attachments/classpath.ear\" loaded.\n    INFO - Assembling app: /Users/dblevins/examples/webservice-attachments/classpath.ear\n    INFO - Created Ejb(deployment-id=AttachmentImpl, ejb-name=AttachmentImpl, container=Default Stateless Container)\n    INFO - Started Ejb(deployment-id=AttachmentImpl, ejb-name=AttachmentImpl, container=Default Stateless Containe
 r)\n    INFO - Deployed Application(path=/Users/dblevins/examples/webservice-attachments/classpath.ear)\n    INFO - Initializing network services\n    INFO - Creating ServerService(id=httpejbd)\n    INFO - Creating ServerService(id=cxf)\n    INFO - Creating ServerService(id=admin)\n    INFO - Creating ServerService(id=ejbd)\n    INFO - Creating ServerService(id=ejbds)\n    INFO - Initializing network services\n      ** Starting Services **\n      NAME                 IP              PORT  \n      httpejbd             127.0.0.1       4204  \n      admin thread         127.0.0.1       4200  \n      ejbd                 127.0.0.1       4201  \n      ejbd                 127.0.0.1       4203  \n    -------\n    Ready!\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.034 sec\n    \n    Results :\n    \n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0\n    \n",
+        "url":"https://github.com/apache/tomee/tree/master/examples/webservice-attachments"
+      }
+    ],
+    "bmt":[
+      {
+        "name":"testing-transactions-bmt",
+        "readme":"Title: Testing Transactions BMT\n\nShows how to begin, commit and rollback transactions using a UserTransaction via a Stateful Bean.\n\n## Movie\n\n    package org.superbiz.injection.tx;\n\n    import javax.persistence.Entity;\n    import javax.persistence.GeneratedValue;\n    import javax.persistence.Id;\n\n    @Entity\n    public class Movie {\n\n        @Id\n        @GeneratedValue\n        private Long id;\n        private String director;\n        private String title;\n        private int year;\n\n        public Movie(String director, String title, int year) {\n            this.director = director;\n            this.title = title;\n            this.year = year;\n        }\n\n        public Movie() {\n\n        }\n\n        public Long getId() {\n            return id;\n        }\n\n        public void setId(Long id) {\n            this.id = id;\n        }\n\n        public String getDirector() {\n            return director;\n        }\n\n        public void 
 setDirector(String director) {\n            this.director = director;\n        }\n\n        public String getTitle() {\n            return title;\n        }\n\n        public void setTitle(String title) {\n            this.title = title;\n        }\n\n        public int getYear() {\n            return year;\n        }\n\n        public void setYear(int year) {\n            this.year = year;\n        }\n    }\n\n## Movies\n\n    package org.superbiz.injection.tx;\n\n    import javax.annotation.Resource;\n    import javax.ejb.Stateful;\n    import javax.ejb.TransactionManagement;\n    import javax.ejb.TransactionManagementType;\n    import javax.persistence.EntityManager;\n    import javax.persistence.PersistenceContext;\n    import javax.persistence.PersistenceContextType;\n    import javax.persistence.Query;\n    import javax.transaction.UserTransaction;\n\n    @Stateful(name = \"Movies\")\n    @TransactionManagement(TransactionManagementType.BEAN)\n    public class Movies {\n\n    
     @PersistenceContext(unitName = \"movie-unit\", type = PersistenceContextType.TRANSACTION)\n        private EntityManager entityManager;\n\n        @Resource\n        private UserTransaction userTransaction;\n\n        public void addMovie(Movie movie) throws Exception {\n            try {\n                userTransaction.begin();\n                entityManager.persist(movie);\n\n                //For some dummy reason, this db can have only 5 titles. :O)\n                if (countMovies() > 5) {\n                    userTransaction.rollback();\n                } else {\n                    userTransaction.commit();\n                }\n\n\n            } catch (Exception e) {\n                e.printStackTrace();\n                userTransaction.rollback();\n            }\n        }\n\n        public Long countMovies() throws Exception {\n            Query query = entityManager.createQuery(\"SELECT COUNT(m) FROM Movie m\");\n            return Long.class.cast(query.getSingleResult
 ());\n        }\n    }\n\n\n## persistence.xml\n\n    <persistence xmlns=\"http://java.sun.com/xml/ns/persistence\" version=\"1.0\">\n\n      <persistence-unit name=\"movie-unit\">\n        <jta-data-source>movieDatabase</jta-data-source>\n        <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>\n        <class>org.superbiz.injection.tx.Movie</class>\n\n        <properties>\n          <property name=\"openjpa.jdbc.SynchronizeMappings\" value=\"buildSchema(ForeignKeys=true)\"/>\n        </properties>\n      </persistence-unit>\n    </persistence>\n\n## MoviesTest\n\n    package org.superbiz.injection.tx;\n\n    import org.junit.Assert;\n    import org.junit.Test;\n\n    import javax.ejb.EJB;\n    import javax.ejb.embeddable.EJBContainer;\n    import java.util.Properties;\n\n    public class MoviesTest {\n\n        @EJB\n        private Movies movies;\n\n        @Test\n        public void testMe() throws Exception {\n            final Properties p = new Properties();\
 n            p.put(\"movieDatabase\", \"new://Resource?type=DataSource\");\n            p.put(\"movieDatabase.JdbcDriver\", \"org.hsqldb.jdbcDriver\");\n            p.put(\"movieDatabase.JdbcUrl\", \"jdbc:hsqldb:mem:moviedb\");\n\n            EJBContainer.createEJBContainer(p).getContext().bind(\"inject\", this);\n\n            movies.addMovie(new Movie(\"Asif Kapadia\", \"Senna\", 2010));\n            movies.addMovie(new Movie(\"José Padilha\", \"Tropa de Elite\", 2007));\n            movies.addMovie(new Movie(\"Andy Wachowski/Lana Wachowski\", \"The Matrix\", 1999));\n            movies.addMovie(new Movie(\"Quentin Tarantino\", \"Reservoir Dogs\", 1992));\n            movies.addMovie(new Movie(\"Joel Coen\", \"Fargo\", 1996));\n            movies.addMovie(new Movie(\"Joel Coen\", \"The Big Lebowski\", 1998));\n\n            Assert.assertEquals(5L, movies.countMovies().longValue());\n        }\n\n    }\n\n\n# Running\n\n    -------------------------------------------------------\n
      T E S T S\n    -------------------------------------------------------\n    Running org.superbiz.injection.tx.MoviesTest\n    INFO - ********************************************************************************\n    INFO - OpenEJB http://tomee.apache.org/\n    INFO - Startup: Sat Jul 21 16:39:28 EDT 2012\n    INFO - Copyright 1999-2012 (C) Apache OpenEJB Project, All Rights Reserved.\n    INFO - Version: 4.1.0\n    INFO - Build date: 20120721\n    INFO - Build time: 12:06\n    INFO - ********************************************************************************\n    INFO - openejb.home = /home/boto/dev/ws/openejb_trunk/openejb/examples/testing-transactions-bmt\n    INFO - openejb.base = /home/boto/dev/ws/openejb_trunk/openejb/examples/testing-transactions-bmt\n    INFO - Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@3f3f210f\n    INFO - Succeeded in installing singleton service\n    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'\n   
  INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt to create one for the beans deployed.\n    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)\n    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)\n    INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)\n    INFO - Creating TransactionManager(id=Default Transaction Manager)\n    INFO - Creating SecurityService(id=Default Security Service)\n    INFO - Creating Resource(id=movieDatabase)\n    INFO - Beginning load: /home/boto/dev/ws/openejb_trunk/openejb/examples/testing-transactions-bmt/target/classes\n    INFO - Configuring enterprise application: /home/boto/dev/ws/openejb_trunk/openejb/examples/testing-transactions-bmt\n    WARNING - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older R
 untime.\n    INFO - Auto-deploying ejb Movies: EjbDeployment(deployment-id=Movies)\n    INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)\n    INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)\n    INFO - Creating Container(id=Default Stateful Container)\n    INFO - Using directory /tmp for stateful session passivation\n    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)\n    INFO - Auto-creating a container for bean org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default Managed Container)\n    INFO - Creating Container(id=Default Managed Container)\n    INFO - Using directory /tmp for stateful session passivation\n    INFO - Configuring PersistenceUnit(name=movie-unit)\n    INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'.\n    INFO -
  Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase)\n    INFO - Creating Resource(id=movieDatabaseNonJta)\n    INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'\n    INFO - Enterprise application \"/home/boto/dev/ws/openejb_trunk/openejb/examples/testing-transactions-bmt\" loaded.\n    INFO - Assembling app: /home/boto/dev/ws/openejb_trunk/openejb/examples/testing-transactions-bmt\n    SEVERE - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent.  See http://tomee.apache.org/3.0/javaagent.html\n    INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 399ms\n    INFO - Jndi(name=\"java:global/testing-transactions-bmt/Movies!org.superbiz.injection.tx.Movies\")\n    INFO - Jndi(name=\"java:global/testing-transactions-bmt/Movi
 es\")\n    INFO - Existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@3f3f210f\n    INFO - OpenWebBeans Container is starting...\n    INFO - Adding OpenWebBeansPlugin : [CdiPlugin]\n    INFO - All injection points are validated successfully.\n    INFO - OpenWebBeans Container has started, it took 157 ms.\n    INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)\n    INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)\n    INFO - Deployed Application(path=/home/boto/dev/ws/openejb_trunk/openejb/examples/testing-transactions-bmt)\n    INFO - Started user transaction org.apache.geronimo.transaction.manager.TransactionImpl@709a1411\n    21-Jul-2012 4:39:32 PM null openjpa.Runtime\n    INFO: Starting OpenJPA 2.2.0\n    21-Jul-2012 4:39:32 PM null openjpa.jdbc.JDBC\n    INFO: Using dictionary class \"org.apache.openjpa.jdbc.sql.HSQLDictionary\" (HSQL D
 atabase Engine 2.2.8 ,HSQL Database Engine Driver 2.2.8).\n    21-Jul-2012 4:39:33 PM null openjpa.Enhance\n    INFO: Creating subclass and redefining methods for \"[class org.superbiz.injection.tx.Movie]\". This means that your application will be less efficient than it would if you ran the OpenJPA enhancer.\n    INFO - Committing user transaction org.apache.geronimo.transaction.manager.TransactionImpl@709a1411\n    INFO - Started user transaction org.apache.geronimo.transaction.manager.TransactionImpl@2bb64b70\n    INFO - Committing user transaction org.apache.geronimo.transaction.manager.TransactionImpl@2bb64b70\n    INFO - Started user transaction org.apache.geronimo.transaction.manager.TransactionImpl@627b5c\n    INFO - Committing user transaction org.apache.geronimo.transaction.manager.TransactionImpl@627b5c\n    INFO - Started user transaction org.apache.geronimo.transaction.manager.TransactionImpl@2f031310\n    INFO - Committing user transaction org.apache.geronimo.transacti
 on.manager.TransactionImpl@2f031310\n    INFO - Started user transaction org.apache.geronimo.transaction.manager.TransactionImpl@4df2a9da\n    INFO - Committing user transaction org.apache.geronimo.transaction.manager.TransactionImpl@4df2a9da\n    INFO - Started user transaction org.apache.geronimo.transaction.manager.TransactionImpl@3fa9b4a4\n    INFO - Rolling back user transaction org.apache.geronimo.transaction.manager.TransactionImpl@3fa9b4a4\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.471 sec\n\n    Results :\n\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0\n",
+        "url":"https://github.com/apache/tomee/tree/master/examples/testing-transactions-bmt"
+      }
+    ],
+    "bval":[
+      {
+        "name":"bval-evaluation-redeployment",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/bval-evaluation-redeployment"
+      }
+    ],
+    "callbacks":[
+      {
+        "name":"simple-stateful-callbacks",
+        "readme":"Title: Simple Stateful with callback methods\n\nThis example shows how to create a stateful session bean that uses the @PrePassivate, @PostActivate, @PostConstruct, @PreDestroy and @AroundInvoke annotations.\n\n## CallbackCounter\n\n    package org.superbiz.counter;\n\n    import javax.annotation.PostConstruct;\n    import javax.annotation.PreDestroy;\n    import javax.ejb.PostActivate;\n    import javax.ejb.PrePassivate;\n    import javax.ejb.Stateful;\n    import javax.ejb.StatefulTimeout;\n    import javax.interceptor.AroundInvoke;\n    import javax.interceptor.InvocationContext;\n    import java.io.Serializable;\n    import java.util.concurrent.TimeUnit;\n\n    @Stateful\n    @StatefulTimeout(value = 1, unit = TimeUnit.SECONDS)\n    public class CallbackCounter implements Serializable {\n\n        private int count = 0;\n\n        @PrePassivate\n        public void prePassivate() {\n            ExecutionChannel.getInstance().notifyObservers(\"prePassivate\");\n
         }\n\n        @PostActivate\n        public void postActivate() {\n            ExecutionChannel.getInstance().notifyObservers(\"postActivate\");\n        }\n\n        @PostConstruct\n        public void postConstruct() {\n            ExecutionChannel.getInstance().notifyObservers(\"postConstruct\");\n        }\n\n        @PreDestroy\n        public void preDestroy() {\n            ExecutionChannel.getInstance().notifyObservers(\"preDestroy\");\n        }\n\n        @AroundInvoke\n        public Object intercept(InvocationContext ctx) throws Exception {\n            ExecutionChannel.getInstance().notifyObservers(ctx.getMethod().getName());\n            return ctx.proceed();\n        }\n\n        public int count() {\n            return count;\n        }\n\n        public int increment() {\n            return ++count;\n        }\n\n        public int reset() {\n            return (count = 0);\n        }\n    }\n\n## ExecutionChannel\n\n    package org.superbiz.counter;\n\n    i
 mport java.util.ArrayList;\n    import java.util.List;\n\n    public class ExecutionChannel {\n        private static final ExecutionChannel INSTANCE = new ExecutionChannel();\n\n        private final List<ExecutionObserver> observers = new ArrayList<ExecutionObserver>();\n\n        public static ExecutionChannel getInstance() {\n            return INSTANCE;\n        }\n\n        public void addObserver(ExecutionObserver observer) {\n            this.observers.add(observer);\n        }\n\n        public void notifyObservers(Object value) {\n            for (ExecutionObserver observer : this.observers) {\n                observer.onExecution(value);\n            }\n        }\n    }\n\n## ExecutionObserver\n\n    package org.superbiz.counter;\n\n    public interface ExecutionObserver {\n\n        void onExecution(Object value);\n\n    }\n\n## CounterCallbacksTest\n\n    package org.superbiz.counter;\n\n    import junit.framework.Assert;\n    import org.junit.Test;\n\n    import javax.
 ejb.embeddable.EJBContainer;\n    import javax.naming.Context;\n    import javax.naming.InitialContext;\n    import javax.naming.NamingException;\n    import java.util.*;\n\n    public class CounterCallbacksTest implements ExecutionObserver {\n        private static List<Object> received = new ArrayList<Object>();\n\n        public Context getContext() throws NamingException {\n            final Properties p = new Properties();\n            p.put(Context.INITIAL_CONTEXT_FACTORY, \"org.apache.openejb.core.LocalInitialContextFactory\");\n            return new InitialContext(p);\n\n        }\n\n        @Test\n        public void test() throws Exception {\n            final Map<String, Object> p = new HashMap<String, Object>();\n            p.put(\"MySTATEFUL\", \"new://Container?type=STATEFUL\");\n            p.put(\"MySTATEFUL.Capacity\", \"2\"); //How many instances of Stateful beans can our server hold in memory?\n            p.put(\"MySTATEFUL.Frequency\", \"1\"); //Interval in se
 conds between checks\n            p.put(\"MySTATEFUL.BulkPassivate\", \"0\"); //No bulkPassivate - just passivate entities whenever it is needed\n            final EJBContainer container = EJBContainer.createEJBContainer(p);\n\n            //this is going to track the execution\n            ExecutionChannel.getInstance().addObserver(this);\n\n            {\n                final Context context = getContext();\n\n                CallbackCounter counterA = (CallbackCounter) context.lookup(\"java:global/simple-stateful-callbacks/CallbackCounter\");\n                Assert.assertNotNull(counterA);\n                Assert.assertEquals(\"postConstruct\", received.remove(0));\n\n                Assert.assertEquals(0, counterA.count());\n                Assert.assertEquals(\"count\", received.remove(0));\n\n                Assert.assertEquals(1, counterA.increment());\n                Assert.assertEquals(\"increment\", received.remove(0));\n\n                Assert.assertEquals(0, counterA
 .reset());\n                Assert.assertEquals(\"reset\", received.remove(0));\n\n                Assert.assertEquals(1, counterA.increment());\n                Assert.assertEquals(\"increment\", received.remove(0));\n\n                System.out.println(\"Waiting 2 seconds...\");\n                Thread.sleep(2000);\n\n                Assert.assertEquals(\"preDestroy\", received.remove(0));\n\n                try {\n                    counterA.increment();\n                    Assert.fail(\"The ejb is not supposed to be there.\");\n                } catch (javax.ejb.NoSuchEJBException e) {\n                    //excepted\n                }\n\n                context.close();\n            }\n\n            {\n                final Context context = getContext();\n\n                CallbackCounter counterA = (CallbackCounter) context.lookup(\"java:global/simple-stateful-callbacks/CallbackCounter\");\n                Assert.assertEquals(\"postConstruct\", received.remove(0));\n\n    
             Assert.assertEquals(1, counterA.increment());\n                Assert.assertEquals(\"increment\", received.remove(0));\n\n                ((CallbackCounter) context.lookup(\"java:global/simple-stateful-callbacks/CallbackCounter\")).count();\n                Assert.assertEquals(\"postConstruct\", received.remove(0));\n                Assert.assertEquals(\"count\", received.remove(0));\n\n                ((CallbackCounter) context.lookup(\"java:global/simple-stateful-callbacks/CallbackCounter\")).count();\n                Assert.assertEquals(\"postConstruct\", received.remove(0));\n                Assert.assertEquals(\"count\", received.remove(0));\n\n                System.out.println(\"Waiting 2 seconds...\");\n                Thread.sleep(2000);\n                Assert.assertEquals(\"prePassivate\", received.remove(0));\n\n                context.close();\n            }\n            container.close();\n\n            Assert.assertEquals(\"preDestroy\", received.remove(0)
 );\n            Assert.assertEquals(\"preDestroy\", received.remove(0));\n\n            Assert.assertTrue(received.toString(), received.isEmpty());\n        }\n\n        @Override\n        public void onExecution(Object value) {\n            System.out.println(\"Test step -> \" + value);\n            received.add(value);\n        }\n    }\n\n# Running\n\n    -------------------------------------------------------\n     T E S T S\n    -------------------------------------------------------\n    Running org.superbiz.counter.CounterCallbacksTest\n    INFO - ********************************************************************************\n    INFO - OpenEJB http://tomee.apache.org/\n    INFO - Startup: Sat Jul 21 08:18:28 EDT 2012\n    INFO - Copyright 1999-2012 (C) Apache OpenEJB Project, All Rights Reserved.\n    INFO - Version: 4.1.0\n    INFO - Build date: 20120721\n    INFO - Build time: 04:06\n    INFO - *****************************************************************************
 ***\n    INFO - openejb.home = /home/boto/dev/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks\n    INFO - openejb.base = /home/boto/dev/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks\n    INFO - Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@527736bd\n    INFO - Succeeded in installing singleton service\n    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'\n    INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt to create one for the beans deployed.\n    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)\n    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)\n    INFO - Configuring Service(id=MySTATEFUL, type=Container, provider-id=Default Stateful Container)\n    INFO - Creating TransactionManager(id=Default Transaction Manager)\n    INFO - Creating SecuritySe
 rvice(id=Default Security Service)\n    INFO - Creating Container(id=MySTATEFUL)\n    INFO - Using directory /tmp for stateful session passivation\n    INFO - Beginning load: /home/boto/dev/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks/target/classes\n    INFO - Configuring enterprise application: /home/boto/dev/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks\n    INFO - Auto-deploying ejb CallbackCounter: EjbDeployment(deployment-id=CallbackCounter)\n    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)\n    INFO - Auto-creating a container for bean org.superbiz.counter.CounterCallbacksTest: Container(type=MANAGED, id=Default Managed Container)\n    INFO - Creating Container(id=Default Managed Container)\n    INFO - Using directory /tmp for stateful session passivation\n    INFO - Enterprise application \"/home/boto/dev/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks\" loaded.\n    I
 NFO - Assembling app: /home/boto/dev/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks\n    INFO - Jndi(name=\"java:global/simple-stateful-callbacks/CallbackCounter!org.superbiz.counter.CallbackCounter\")\n    INFO - Jndi(name=\"java:global/simple-stateful-callbacks/CallbackCounter\")\n    INFO - Existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@527736bd\n    INFO - OpenWebBeans Container is starting...\n    INFO - Adding OpenWebBeansPlugin : [CdiPlugin]\n    INFO - All injection points are validated successfully.\n    INFO - OpenWebBeans Container has started, it took 225 ms.\n    INFO - Created Ejb(deployment-id=CallbackCounter, ejb-name=CallbackCounter, container=MySTATEFUL)\n    INFO - Started Ejb(deployment-id=CallbackCounter, ejb-name=CallbackCounter, container=MySTATEFUL)\n    INFO - Deployed Application(path=/home/boto/dev/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks)\n    Test step -> postConstru
 ct\n    Test step -> count\n    Test step -> increment\n    Test step -> reset\n    Test step -> increment\n    Waiting 2 seconds...\n    Test step -> preDestroy\n    INFO - Removing the timed-out stateful session bean instance 583c10bfdbd326ba:57f94a9b:138a9798adf:-8000\n    INFO - Activation failed: file not found /tmp/583c10bfdbd326ba=57f94a9b=138a9798adf=-8000\n    Test step -> postConstruct\n    Test step -> increment\n    Test step -> postConstruct\n    Test step -> count\n    Test step -> postConstruct\n    Test step -> count\n    Waiting 2 seconds...\n    Test step -> prePassivate\n    INFO - Passivating to file /tmp/583c10bfdbd326ba=57f94a9b=138a9798adf=-7fff\n    Test step -> preDestroy\n    INFO - Removing the timed-out stateful session bean instance 583c10bfdbd326ba:57f94a9b:138a9798adf:-7ffe\n    Test step -> preDestroy\n    INFO - Removing the timed-out stateful session bean instance 583c10bfdbd326ba:57f94a9b:138a9798adf:-7ffd\n    INFO - Undeploying app: /home/boto/de
 v/ws/openejb_trunk/openejb/examples/simple-stateful-callbacks\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.487 sec\n\n    Results :\n\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0\n\n    [INFO] ------------------------------------------------------------------------\n    [INFO] BUILD SUCCESS\n    [INFO] ------------------------------------------------------------------------\n    [INFO] Total time: 15.803s\n    [INFO] Finished at: Sat Jul 21 08:18:35 EDT 2012\n    [INFO] Final Memory: 11M/247M\n    [INFO] ------------------------------------------------------------------------\n\n\n",
+        "url":"https://github.com/apache/tomee/tree/master/examples/simple-stateful-callbacks"
+      },
+      {
+        "name":"simple-stateless-callbacks",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/simple-stateless-callbacks"
+      }
+    ],
+    "cdi":[
+      {
+        "name":"applicationcomposer-jaxws-cdi",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/applicationcomposer-jaxws-cdi"
+      },
+      {
+        "name":"cdi-basic",
+        "readme":"Title: CDI @Inject\n\nTo use `@Inject`, the first thing you need is a `META-INF/beans.xml` file in the module\nor jar.  This effectively turns on CDI and allows the `@Inject` references to work.\nNo `META-INF/beans.xml` no injection, period.  This may seem overly strict,\nbut it is not without reason.  The CDI API is a bit greedy and does consume a fair\nabout of resources by design.\n\nWhen the container constructs a bean with an `@Inject` reference,\nit will first find or create the object that will be injected.  For the sake of\nsimplicity, the is example has a basic `Faculty` pojo with a no-arg constructor.  Anyone\nreferencing `@Inject Faculty` will get their own instance of `Faculty`.  If the desire\nis to share the same instance of `Faculty`, see the concept of `scopes` -- this is\nexactly what scopes are for.\n\n# Example\n\nIn this example we have an `@Stateless` bean `Course` with an `@Inject` reference to an\nobject of type `Faculty`.  When `Course` is c
 reated, the container will also create an\ninstance of `Faculty`.  The `@PostConstruct` will be called on the `Faculty`,\nthen the `Faculty` instance will be injected into the `Course` bean.  Finally, the\n`@PostConstruct` will be invoked on `Course` and then we're done.  All instances will\nhave been created.\n\nThe `CourseTest` test case drives this creation process by having `Course` injected\ninto it in its `@Setup` method.  By the time our `@Test` method is invoked,\nall the real work should be done and we should be ready to go.  In the test case we do\nsome basic asserts to ensure everything was constructed, all `@PostConstruct` methods\ncalled and everyting injected.\n\n## Faculty <small>a basic injectable pojo</small>\n\n    public class Faculty {\n\n        private List<String> facultyMembers;\n\n        private String facultyName;\n\n        @PostConstruct\n        public void initialize() {\n            this.facultyMembers = new ArrayList<String>();\n            facultyMe
 mbers.add(\"Ian Schultz\");\n            facultyMembers.add(\"Diane Reyes\");\n            facultyName = \"Computer Science\";\n        }\n\n        public List<String> getFacultyMembers() {\n            return facultyMembers;\n        }\n\n        public String getFacultyName() {\n            return facultyName;\n        }\n\n    }\n\n## Course <small>a simple session bean</small>\n\n    @Stateless\n    public class Course {\n\n        @Inject\n        private Faculty faculty;\n\n        private String courseName;\n\n        private int capacity;\n\n        @PostConstruct\n        private void init() {\n            assert faculty != null;\n\n            // These strings can be externalized\n            // We'll see how to do that later\n            this.courseName = \"CDI 101 - Introduction to CDI\";\n            this.capacity = 100;\n        }\n\n        public String getCourseName() {\n            return courseName;\n        }\n\n        public int getCapacity() {\n            re
 turn capacity;\n        }\n\n        public Faculty getFaculty() {\n            return faculty;\n        }\n    }\n\n# Test Case\n\n    public class CourseTest extends TestCase {\n\n        @EJB\n        private Course course;\n\n        @Before\n        public void setUp() throws Exception {\n            EJBContainer.createEJBContainer().getContext().bind(\"inject\", this);\n        }\n\n        @Test\n        public void test() {\n\n            // Was the EJB injected?\n            assertTrue(course != null);\n\n            // Was the Course @PostConstruct called?\n            assertNotNull(course.getCourseName());\n            assertTrue(course.getCapacity() > 0);\n\n            // Was a Faculty instance injected into Course?\n            final Faculty faculty = course.getFaculty();\n            assertTrue(faculty != null);\n\n            // Was the @PostConstruct called on Faculty?\n            assertEquals(faculty.getFacultyName(), \"Computer Science\");\n            assertEqua
 ls(faculty.getFacultyMembers().size(), 2);\n        }\n    }\n\n# Running\n\n\n    -------------------------------------------------------\n     T E S T S\n    -------------------------------------------------------\n    Running org.superbiz.cdi.basic.CourseTest\n    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06\n    http://tomee.apache.org/\n    INFO - openejb.home = /Users/dblevins/examples/cdi-basic\n    INFO - openejb.base = /Users/dblevins/examples/cdi-basic\n    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'\n    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)\n    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)\n    INFO - Found EjbModule in classpath: /Users/dblevins/examples/cdi-basic/target/classes\n    INFO - Beginning load: /Users/dblevins/examples/cdi-basic/target/classes\n    INFO - Configuring enterprise applica
 tion: /Users/dblevins/examples/cdi-basic\n    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)\n    INFO - Auto-creating a container for bean cdi-basic.Comp: Container(type=MANAGED, id=Default Managed Container)\n    INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)\n    INFO - Auto-creating a container for bean Course: Container(type=STATELESS, id=Default Stateless Container)\n    INFO - Enterprise application \"/Users/dblevins/examples/cdi-basic\" loaded.\n    INFO - Assembling app: /Users/dblevins/examples/cdi-basic\n    INFO - Jndi(name=\"java:global/cdi-basic/cdi-basic.Comp!org.apache.openejb.BeanContext$Comp\")\n    INFO - Jndi(name=\"java:global/cdi-basic/cdi-basic.Comp\")\n    INFO - Jndi(name=\"java:global/cdi-basic/Course!org.superbiz.cdi.basic.Course\")\n    INFO - Jndi(name=\"java:global/cdi-basic/Course\")\n    INFO - Jndi(name=\"java:global/E
 jbModule1833350875/org.superbiz.cdi.basic.CourseTest!org.superbiz.cdi.basic.CourseTest\")\n    INFO - Jndi(name=\"java:global/EjbModule1833350875/org.superbiz.cdi.basic.CourseTest\")\n    INFO - Created Ejb(deployment-id=Course, ejb-name=Course, container=Default Stateless Container)\n    INFO - Created Ejb(deployment-id=cdi-basic.Comp, ejb-name=cdi-basic.Comp, container=Default Managed Container)\n    INFO - Created Ejb(deployment-id=org.superbiz.cdi.basic.CourseTest, ejb-name=org.superbiz.cdi.basic.CourseTest, container=Default Managed Container)\n    INFO - Started Ejb(deployment-id=Course, ejb-name=Course, container=Default Stateless Container)\n    INFO - Started Ejb(deployment-id=cdi-basic.Comp, ejb-name=cdi-basic.Comp, container=Default Managed Container)\n    INFO - Started Ejb(deployment-id=org.superbiz.cdi.basic.CourseTest, ejb-name=org.superbiz.cdi.basic.CourseTest, container=Default Managed Container)\n    INFO - Deployed Application(path=/Users/dblevins/examples/cdi-bas
 ic)\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.126 sec\n\n    Results :\n\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0\n",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-basic"
+      },
+      {
+        "name":"simple-mdb-and-cdi",
+        "readme":"Title: Simple MDB and CDI\n\n*Help us document this example! Click the blue pencil icon in the upper right to edit this page.*\n\n## ChatBean\n\n    package org.superbiz.mdb;\n    \n    import javax.annotation.Resource;\n    import javax.ejb.MessageDriven;\n    import javax.inject.Inject;\n    import javax.jms.Connection;\n    import javax.jms.ConnectionFactory;\n    import javax.jms.DeliveryMode;\n    import javax.jms.JMSException;\n    import javax.jms.Message;\n    import javax.jms.MessageListener;\n    import javax.jms.MessageProducer;\n    import javax.jms.Queue;\n    import javax.jms.Session;\n    import javax.jms.TextMessage;\n    \n    @MessageDriven\n    public class ChatBean implements MessageListener {\n    \n        @Resource\n        private ConnectionFactory connectionFactory;\n    \n        @Resource(name = \"AnswerQueue\")\n        private Queue answerQueue;\n    \n        @Inject\n        private ChatRespondCreator responder;\n    \n        public 
 void onMessage(Message message) {\n            try {\n    \n                final TextMessage textMessage = (TextMessage) message;\n                final String question = textMessage.getText();\n                final String response = responder.respond(question);\n    \n                if (response != null) {\n                    respond(response);\n                }\n            } catch (JMSException e) {\n                throw new IllegalStateException(e);\n            }\n        }\n    \n        private void respond(String text) throws JMSException {\n    \n            Connection connection = null;\n            Session session = null;\n    \n            try {\n                connection = connectionFactory.createConnection();\n                connection.start();\n    \n                // Create a Session\n                session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n    \n                // Create a MessageProducer from the Session to the Topic or Queue\n
                 MessageProducer producer = session.createProducer(answerQueue);\n                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);\n    \n                // Create a message\n                TextMessage message = session.createTextMessage(text);\n    \n                // Tell the producer to send the message\n                producer.send(message);\n            } finally {\n                // Clean up\n                if (session != null) session.close();\n                if (connection != null) connection.close();\n            }\n        }\n    }\n\n## ChatRespondCreator\n\n    package org.superbiz.mdb;\n    \n    public class ChatRespondCreator {\n        public String respond(String question) {\n            if (\"Hello World!\".equals(question)) {\n                return \"Hello, Test Case!\";\n            } else if (\"How are you?\".equals(question)) {\n                return \"I'm doing well.\";\n            } else if (\"Still spinning?\".equals(question)) 
 {\n                return \"Once every day, as usual.\";\n            }\n            return null;\n        }\n    }\n\n## beans.xml\n\n    <!--\n    \n        Licensed to the Apache Software Foundation (ASF) under one or more\n        contributor license agreements.  See the NOTICE file distributed with\n        this work for additional information regarding copyright ownership.\n        The ASF licenses this file to You under the Apache License, Version 2.0\n        (the \"License\"); you may not use this file except in compliance with\n        the License.  You may obtain a copy of the License at\n    \n           http://www.apache.org/licenses/LICENSE-2.0\n        Unless required by applicable law or agreed to in writing, software\n        distributed under the License is distributed on an \"AS IS\" BASIS,\n        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n        See the License for the specific language governing permissions and\n        limitati
 ons under the License.\n    -->\n    \n    <beans/>\n    \n\n## ChatBeanTest\n\n    package org.superbiz.mdb;\n    \n    import junit.framework.TestCase;\n    \n    import javax.annotation.Resource;\n    import javax.ejb.embeddable.EJBContainer;\n    import javax.jms.Connection;\n    import javax.jms.ConnectionFactory;\n    import javax.jms.JMSException;\n    import javax.jms.MessageConsumer;\n    import javax.jms.MessageProducer;\n    import javax.jms.Queue;\n    import javax.jms.Session;\n    import javax.jms.TextMessage;\n    \n    public class ChatBeanTest extends TestCase {\n    \n        @Resource\n        private ConnectionFactory connectionFactory;\n    \n        @Resource(name = \"ChatBean\")\n        private Queue questionQueue;\n    \n        @Resource(name = \"AnswerQueue\")\n        private Queue answerQueue;\n    \n        public void test() throws Exception {\n            EJBContainer.createEJBContainer().getContext().bind(\"inject\", this);\n    \n    \n            f
 inal Connection connection = connectionFactory.createConnection();\n    \n            connection.start();\n    \n            final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n    \n            final MessageProducer questions = session.createProducer(questionQueue);\n    \n            final MessageConsumer answers = session.createConsumer(answerQueue);\n    \n    \n            sendText(\"Hello World!\", questions, session);\n    \n            assertEquals(\"Hello, Test Case!\", receiveText(answers));\n    \n    \n            sendText(\"How are you?\", questions, session);\n    \n            assertEquals(\"I'm doing well.\", receiveText(answers));\n    \n    \n            sendText(\"Still spinning?\", questions, session);\n    \n            assertEquals(\"Once every day, as usual.\", receiveText(answers));\n        }\n    \n        private void sendText(String text, MessageProducer questions, Session session) throws JMSException {\n    \n            q
 uestions.send(session.createTextMessage(text));\n        }\n    \n        private String receiveText(MessageConsumer answers) throws JMSException {\n    \n            return ((TextMessage) answers.receive(1000)).getText();\n        }\n    }\n",
+        "url":"https://github.com/apache/tomee/tree/master/examples/simple-mdb-and-cdi"
+      },
+      {
+        "name":"jsf-cdi-and-ejb",
+        "readme":"Title: JSF-CDI-EJB\n\nThe simple application contains a CDI managed bean `CalculatorBean`, which uses the `Calculator` EJB to add two numbers\nand display the results to the user. The EJB is injected in the managed bean using @Inject annotation.\n\nYou could run this in the latest Apache TomEE [snapshot](https://repository.apache.org/content/repositories/snapshots/org/apache/openejb/apache-tomee/)\n\nThe complete source code is below but lets break down to look at some smaller snippets and see  how it works.\n\n\nA little note on the setup:\n\nAs for the libraries, myfaces-api and myfaces-impl are provided in tomee/lib and hence they should not be a part of the\nwar. In maven terms, they would be with scope 'provided'\n\nAlso note that we use servlet 2.5 declaration in web.xml\n<web-app xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xmlns=\"http://java.sun.com/xml/ns/javaee\"\n  xmlns:web=\"http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\"\n  xsi:sche
 maLocation=\"http://java.sun.com/xml/ns/javaee\n      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\"\n  version=\"2.5\">\n\nAnd we use 2.0 version of faces-config\n\n <faces-config xmlns=\"http://java.sun.com/xml/ns/javaee\"\n               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n               xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee\n       http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd\"\n               version=\"2.0\">\n\nTo make this a cdi-aware-archive (i.e bean archive) an empty beans.xml is added in WEB-INF\n\n       <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n       <beans xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee\n         http://java.sun.com/xml/ns/javaee/beans_1_0.xsd\">\n       </beans>\n\nWe'll first declare the FacesServlet in the web.xml\n\n      <servlet>\n        <servlet-name>Faces Servlet</serv
 let-name>\n        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>\n        <load-on-startup>1</load-on-startup>\n      </servlet>\n\nFacesServlet acts as the master controller.\n\nWe'll then create the calculator.xhtml file.\n\n           <h:outputText value='Enter first number'/>\n           <h:inputText value='#{calculatorBean.x}'/>\n           <h:outputText value='Enter second number'/>\n           <h:inputText value='#{calculatorBean.y}'/>\n           <h:commandButton action=\"#{calculatorBean.add}\" value=\"Add\"/>\n\nNotice how we've used the bean here. By default, the bean name would be the simple name of the bean\nclass with the first letter in lower case.\n\nWe've annotated the `CalculatorBean` with `@RequestScoped`.\nSo when a request comes in, the bean is instantiated and placed in the request scope.\n\n<h:inputText value='#{calculatorBean.x}'/>\n\nHere, getX() method of calculatorBean is invoked and the resulting value is displayed.\nx being a Double, we 
 rightly should see 0.0 displayed.\n\nWhen you change the value and submit the form, these entered values are bound using the setters\nin the bean and then the commandButton-action method is invoked.\n\nIn this case, CalculatorBean#add() is invoked.\n\nCalculator#add() delegates the work to the ejb, gets the result, stores it\nand then returns what view is to be rendered.\n\nThe return value \"success\" is checked up in faces-config navigation-rules\nand the respective page is rendered.\n\nIn our case, 'result.xhtml' page is rendered where\nuse EL and display the result from the request-scoped `calculatorBean`.\n\n#Source Code\n\n## CalculatorBean\n\n    import javax.enterprise.context.RequestScoped;\n    import javax.inject.Named;\n    import javax.inject.Inject;\n\n    @RequestScoped\n    @Named\n    public class CalculatorBean {\n        @Inject\n        Calculator calculator;\n        private double x;\n        private double y;\n        private double result;\n    \n        publ
 ic double getX() {\n            return x;\n        }\n    \n        public void setX(double x) {\n            this.x = x;\n        }\n    \n        public double getY() {\n            return y;\n        }\n    \n        public void setY(double y) {\n            this.y = y;\n        }\n    \n        public double getResult() {\n            return result;\n        }\n    \n        public void setResult(double result) {\n            this.result = result;\n        }\n    \n        public String add() {\n            result = calculator.add(x, y);\n            return \"success\";\n        }\n    }\n\n## Calculator\n\n    package org.superbiz.jsf;\n    \n    import javax.ejb.Stateless;\n    \n    @Stateless\n    public class Calculator{\n    \n        public double add(double x, double y) {\n            return x + y;\n        }\n    }\n\n\n#web.xml\n\n<?xml version=\"1.0\"?>\n\n<web-app xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xmlns=\"http://java.sun.com/xml/ns/jav
 aee\"\n         xmlns:web=\"http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\"\n         xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee\n      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\"\n         version=\"2.5\">\n\n  <description>MyProject web.xml</description>\n\n  <!-- Faces Servlet -->\n  <servlet>\n    <servlet-name>Faces Servlet</servlet-name>\n    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>\n    <load-on-startup>1</load-on-startup>\n  </servlet>\n\n  <!-- Faces Servlet Mapping -->\n  <servlet-mapping>\n    <servlet-name>Faces Servlet</servlet-name>\n    <url-pattern>*.jsf</url-pattern>\n  </servlet-mapping>\n\n  <!-- Welcome files -->\n  <welcome-file-list>\n    <welcome-file>index.jsp</welcome-file>\n    <welcome-file>index.html</welcome-file>\n  </welcome-file-list>\n\n</web-app>\n\n\n#Calculator.xhtml\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/x
 html1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xmlns:h=\"http://java.sun.com/jsf/html\">\n\n\n<h:body bgcolor=\"white\">\n    <f:view>\n        <h:form>\n            <h:panelGrid columns=\"2\">\n                <h:outputText value='Enter first number'/>\n                <h:inputText value='#{calculatorBean.x}'/>\n                <h:outputText value='Enter second number'/>\n                <h:inputText value='#{calculatorBean.y}'/>\n                <h:commandButton action=\"#{calculatorBean.add}\" value=\"Add\"/>\n            </h:panelGrid>\n        </h:form>\n    </f:view>\n</h:body>\n</html>\n\n\n #Result.xhtml\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"\n      xmlns:f=\"http://java.sun.com/jsf/core\"\n      xml
 ns:h=\"http://java.sun.com/jsf/html\">\n\n<h:body>\n<f:view>\n    <h:form id=\"mainForm\">\n        <h2><h:outputText value=\"Result of adding #{calculatorBean.x} and #{calculatorBean.y} is #{calculatorBean.result }\"/></h2>\n        <h:commandLink action=\"back\">\n            <h:outputText value=\"Home\"/>\n        </h:commandLink>\n    </h:form>\n</f:view>\n</h:body>\n</html>\n\n #faces-config.xml\n\n <?xml version=\"1.0\"?>\n <faces-config xmlns=\"http://java.sun.com/xml/ns/javaee\"\n               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n               xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee\n       http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd\"\n               version=\"2.0\">\n\n   <navigation-rule>\n     <from-view-id>/calculator.xhtml</from-view-id>\n     <navigation-case>\n       <from-outcome>success</from-outcome>\n       <to-view-id>/result.xhtml</to-view-id>\n     </navigation-case>\n   </navigation-rule>\n\n   <navigation-ru
 le>\n     <from-view-id>/result.xhtml</from-view-id>\n     <navigation-case>\n       <from-outcome>back</from-outcome>\n       <to-view-id>/calculator.xhtml</to-view-id>\n     </navigation-case>\n   </navigation-rule>\n </faces-config>",
+        "url":"https://github.com/apache/tomee/tree/master/examples/jsf-cdi-and-ejb"
+      },
+      {
+        "name":"groovy-cdi",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/groovy-cdi"
+      },
+      {
+        "name":"cdi-ejbcontext-jaas",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-ejbcontext-jaas"
+      },
+      {
+        "name":"cdi-produces-disposes",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-produces-disposes"
+      },
+      {
+        "name":"cdi-interceptors",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-interceptors"
+      },
+      {
+        "name":"cdi-application-scope",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-application-scope"
+      },
+      {
+        "name":"cdi-request-scope",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-request-scope"
+      },
+      {
+        "name":"cdi-alternative-and-stereotypes",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-alternative-and-stereotypes"
+      },
+      {
+        "name":"cdi-produces-field",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-produces-field"
+      },
+      {
+        "name":"simple-cdi-interceptor",
+        "readme":"#Simple CDI Interceptor\n\nLet's write a simple application that would allow us to book tickets for a movie show. As with all applications, logging is one cross-cutting concern that we have. \n\n(Relevant snippets are inlined but you can check out the complete code, from the links provided)\n\nHow do we mark which methods are to be intercepted ? Wouldn't it be handy to annotate a method like \n\n    @Log\n    public void aMethod(){...} \n\nLet's create an  annotation that would \"mark\" a method for interception. \n\n    @InterceptorBinding\n    @Target({ TYPE, METHOD })\n    @Retention(RUNTIME)\n    public @interface Log {\n    }\n\nSure, you haven't missed the @InterceptorBinding annotation above ! Now that our custom annotation is created, lets attach it (or to use a better term for it, \"bind it\" )\nto an interceptor. \n\nSo here's our logging interceptor. An @AroundInvoke method and we are almost done.\n\n    @Interceptor\n    @Log  //binding the interceptor 
 here. now any method annotated with @Log would be intercepted by logMethodEntry\n    public class LoggingInterceptor {\n        @AroundInvoke\n        public Object logMethodEntry(InvocationContext ctx) throws Exception {\n            System.out.println(\"Entering method: \" + ctx.getMethod().getName());\n            //or logger.info statement \n            return ctx.proceed();\n        }\n    }\n\nNow the @Log annotation we created is bound to this interceptor.\n\nThat done, let's annotate at class-level or method-level and have fun intercepting ! \n\n    @Log\n    @Stateful\n    public class BookShow implements Serializable {\n        private static final long serialVersionUID = 6350400892234496909L;\n        public List<String> getMoviesList() {\n            List<String> moviesAvailable = new ArrayList<String>();\n            moviesAvailable.add(\"12 Angry Men\");\n            moviesAvailable.add(\"Kings speech\");\n            return moviesAvailable;\n        }\n        public 
 Integer getDiscountedPrice(int ticketPrice) {\n            return ticketPrice - 50;\n        }\n        // assume more methods are present\n    }\n\nThe `@Log` annotation applied at class level denotes that all the methods should be intercepted with `LoggingInterceptor`.\n\nBefore we say \"all done\" there's one last thing we are left with ! To enable the interceptors ! \n\nLets quickly put up a [beans.xml file]\n\n    <beans>\n      <interceptors>\n        <class>org.superbiz.cdi.bookshow.interceptors.LoggingInterceptor\n        </class>\n      </interceptors>\n    </beans>\n\n in META-INF\n\n\nThose lines in beans.xml not only \"enable\" the interceptors, but also define the \"order of execution\" of the interceptors.\nBut we'll see that in another example on multiple-cdi-interceptors.\n\nFire up the test, and we should see a 'Entering method: getMoviesList' printed in the console.\n\n#Tests\n    Apache OpenEJB 4.0.0-beta-2    build: 20111103-01:00\n    http://tomee.apache.org/\n 
    INFO - openejb.home = /media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors\n    INFO - openejb.base = /media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors\n    INFO - Using 'javax.ejb.embeddable.EJBContainer=true' \n    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)\n    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)\n    INFO - Found EjbModule in classpath: /media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors/target/classes\n    INFO - Beginning load: /media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors/target/classes\n    INFO - Configuring enterprise application: /media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors\n    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)\n    INFO - Au
 to-creating a container for bean cdi-simple-interceptors.Comp: Container(type=MANAGED, id=Default Managed Container)\n    INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)\n    INFO - Auto-creating a container for bean BookShow: Container(type=STATEFUL, id=Default Stateful Container)\n    INFO - Enterprise application \"/media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors\" loaded.\n    INFO - Assembling app: /media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors\n    INFO - Jndi(name=\"java:global/cdi-simple-interceptors/BookShow!org.superbiz.cdi.bookshow.beans.BookShow\")\n    INFO - Jndi(name=\"java:global/cdi-simple-interceptors/BookShow\")\n    INFO - Created Ejb(deployment-id=BookShow, ejb-name=BookShow, container=Default Stateful Container)\n    INFO - Started Ejb(deployment-id=BookShow, ejb-name=BookShow, container=Default Stateful Container)\n    INFO - Deployed Application(pat
 h=/media/fthree/Workspace/open4/openejb/examples/cdi-simple-interceptors)\n    Entering method: getMoviesList\n",
+        "url":"https://github.com/apache/tomee/tree/master/examples/simple-cdi-interceptor"
+      },
+      {
+        "name":"cdi-events",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-events"
+      },
+      {
+        "name":"cdi-realm",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-realm"
+      },
+      {
+        "name":"rest-cdi",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/rest-cdi"
+      },
+      {
+        "name":"cdi-session-scope",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/cdi-session-scope"
+      }
+    ],
+    "ciphered":[
+      {
+        "name":"datasource-ciphered-password",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/datasource-ciphered-password"
+      }
+    ],
+    "client":[
+      {
+        "name":"client-resource-lookup-preview",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/client-resource-lookup-preview"
+      }
+    ],
+    "cmp2":[
+      {
+        "name":"simple-cmp2",
+        "readme":"Title: EJB 2.1 CMP EntityBeans (CMP2)\n\n\n\nOpenEJB, the EJB Container for TomEE and Geronimo,  does support all of EJB 1.1 to 3.1, including CMP2.\n\nThe CMP2 implementation is actually done by adapting the CMP2 bean into a JPA Entity dynamically at deploy time.\n\nAppropriate subclasses, a JPA persistence.xml file and a mapping.xml file are generated at deployment\ntime for the CMP2 EntityBeans and all the Entities will be then run on OpenJPA.  This innovative code\nhas been used as the sole CMP2 implementation in Geronimo for its J2EE 1.4, JavaEE 5 and JavaEE 6 certifications.\n\nThe persistence.xml and mapping.xml files generated at deploy time can be saved to disk and included\nin the application, allowing you to:\n\n - gain finer control over persistence options\n - slowly convert individual entities from CMP2 to JPA\n\nLet's see an example.\n\n# Movies application\n\nThe following is a basic EJB 2.1 application consisting of one CMP2 Entity.  For those that
  are reading this example\nout of curiosity and are not familiar with CMP2 or EJB 2.x, each CMP2 Entity is composed of two parts\n\n - **A Home interface** which has data access methods like \"find\", \"create\", and \"remove\".  This is essentially\n  what people use `@Stateless` beans for today, but with difference that you do not need to supply\n  the implementation of the interface -- the container will generate one for you.  This is partly what inspired\n  the creation of the OpenEJB-specific [Dynamic DAO](../dynamic-dao-implementation/README.html) feature.\n\n - **An abstract EntityBean class** which declares the persistent \"properties\" of the entity without actually\ndeclaring any fields.  It is the container's job to implement the actual methods and create the appropriate\nfields.  OpenEJB will implement this bean as a JPA `@Entity` bean.\n\nAs such a CMP2 EntityBean is really just the description of a persistent object and the description of a \ndata-access object.  There
  is no actual code to write.\n\nThe majority of work in CMP2 is done in the xml:\n\n - **ejb-jar.xml** mapping information, which describes the persistent properties of the entity and the queries\n for all *Home* find, create and remove methods.  This information will be converted by OpenEJB into\n a JPA mapping.xml file.  All queries in the cmp2 part of the ejb-jar.xml are converted \n into named queries in JPA and generally everything is converted to its JPA equivalent. \n\n## CMP2 EntityBean, MovieBean\n\n    package org.superbiz.cmp2;\n    \n    import javax.ejb.EntityBean;\n    \n    public abstract class MovieBean implements EntityBean {\n    \n        public MovieBean() {\n        }\n    \n        public Integer ejbCreate(String director, String title, int year) {\n            this.setDirector(director);\n            this.setTitle(title);\n            this.setYear(year);\n            return null;\n        }\n    \n        public abstract java.lang.Integer getId();\n    \n    
     public abstract void setId(java.lang.Integer id);\n    \n        public abstract String getDirector();\n    \n        public abstract void setDirector(String director);\n    \n        public abstract String getTitle();\n    \n        public abstract void setTitle(String title);\n    \n        public abstract int getYear();\n    \n        public abstract void setYear(int year);\n    \n    }\n\n## CMP2 Home interface, Movies\n\n    package org.superbiz.cmp2;\n    \n    import javax.ejb.CreateException;\n    import javax.ejb.FinderException;\n    import java.util.Collection;\n    \n    /**\n     * @version $Revision$ $Date$\n     */\n    interface Movies extends javax.ejb.EJBLocalHome {\n        Movie create(String director, String title, int year) throws CreateException;\n    \n        Movie findByPrimaryKey(Integer primarykey) throws FinderException;\n    \n        Collection<Movie> findAll() throws FinderException;\n    \n        Collection<Movie> findByDirector(String director)
  throws FinderException;\n    }\n\n## CMP2 mapping in ejb-jar.xml\n\n    <ejb-jar>\n      <enterprise-beans>\n        <entity>\n          <ejb-name>MovieBean</ejb-name>\n          <local-home>org.superbiz.cmp2.Movies</local-home>\n          <local>org.superbiz.cmp2.Movie</local>\n          <ejb-class>org.superbiz.cmp2.MovieBean</ejb-class>\n          <persistence-type>Container</persistence-type>\n          <prim-key-class>java.lang.Integer</prim-key-class>\n          <reentrant>false</reentrant>\n          <cmp-version>2.x</cmp-version>\n          <abstract-schema-name>MovieBean</abstract-schema-name>\n          <cmp-field>\n            <field-name>id</field-name>\n          </cmp-field>\n          <cmp-field>\n            <field-name>director</field-name>\n          </cmp-field>\n          <cmp-field>\n            <field-name>year</field-name>\n          </cmp-field>\n          <cmp-field>\n            <field-name>title</field-name>\n          </cmp-field>\n          <primkey-fiel
 d>id</primkey-field>\n          <query>\n            <query-method>\n              <method-name>findByDirector</method-name>\n              <method-params>\n                <method-param>java.lang.String</method-param>\n              </method-params>\n            </query-method>\n            <ejb-ql>SELECT m FROM MovieBean m WHERE m.director = ?1</ejb-ql>\n          </query>\n          <query>\n            <query-method>\n              <method-name>findAll</method-name>\n              <method-params/>\n            </query-method>\n            <ejb-ql>SELECT m FROM MovieBean as m</ejb-ql>\n          </query>\n        </entity>\n      </enterprise-beans>\n    </ejb-jar>\n    \n\n## openejb-jar.xml\n\n    <openejb-jar xmlns=\"http://www.openejb.org/xml/ns/openejb-jar-2.1\">\n      <enterprise-beans>\n        <entity>\n          <ejb-name>MovieBean</ejb-name>\n          <key-generator xmlns=\"http://www.openejb.org/xml/ns/pkgen-2.1\">\n            <uuid/>\n          </key-generator>\n  
       </entity>\n      </enterprise-beans>\n    </openejb-jar>\n    \n\n## MoviesTest\n\n    package org.superbiz.cmp2;\n    \n    import junit.framework.TestCase;\n    \n    import javax.naming.Context;\n    import javax.naming.InitialContext;\n    import java.util.Collection;\n    import java.util.Properties;\n    \n    /**\n     * @version $Revision: 607077 $ $Date: 2007-12-27 06:55:23 -0800 (Thu, 27 Dec 2007) $\n     */\n    public class MoviesTest extends TestCase {\n    \n        public void test() throws Exception {\n            Properties p = new Properties();\n            p.put(Context.INITIAL_CONTEXT_FACTORY, \"org.apache.openejb.core.LocalInitialContextFactory\");\n            p.put(\"movieDatabase\", \"new://Resource?type=DataSource\");\n            p.put(\"movieDatabase.JdbcDriver\", \"org.hsqldb.jdbcDriver\");\n            p.put(\"movieDatabase.JdbcUrl\", \"jdbc:hsqldb:mem:moviedb\");\n    \n            p.put(\"movieDatabaseUnmanaged\", \"new://Resource?type=DataSource
 \");\n            p.put(\"movieDatabaseUnmanaged.JdbcDriver\", \"org.hsqldb.jdbcDriver\");\n            p.put(\"movieDatabaseUnmanaged.JdbcUrl\", \"jdbc:hsqldb:mem:moviedb\");\n            p.put(\"movieDatabaseUnmanaged.JtaManaged\", \"false\");\n    \n            Context context = new InitialContext(p);\n    \n            Movies movies = (Movies) context.lookup(\"MovieBeanLocalHome\");\n    \n            movies.create(\"Quentin Tarantino\", \"Reservoir Dogs\", 1992);\n            movies.create(\"Joel Coen\", \"Fargo\", 1996);\n            movies.create(\"Joel Coen\", \"The Big Lebowski\", 1998);\n    \n            Collection<Movie> list = movies.findAll();\n            assertEquals(\"Collection.size()\", 3, list.size());\n    \n            for (Movie movie : list) {\n                movies.remove(movie.getPrimaryKey());\n            }\n    \n            assertEquals(\"Movies.findAll()\", 0, movies.findAll().size());\n        }\n    }\n\n# Running\n\n    \n    ----------------------
 ---------------------------------\n     T E S T S\n    -------------------------------------------------------\n    Running org.superbiz.cmp2.MoviesTest\n    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06\n    http://tomee.apache.org/\n    INFO - openejb.home = /Users/dblevins/examples/simple-cmp2/target\n    INFO - openejb.base = /Users/dblevins/examples/simple-cmp2/target\n    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)\n    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)\n    INFO - Configuring Service(id=movieDatabaseUnmanaged, type=Resource, provider-id=Default JDBC Database)\n    INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)\n    INFO - Found EjbModule in classpath: /Users/dblevins/examples/simple-cmp2/target/classes\n    INFO - Beginning load: /Users/dblevins/examples/simple-
 cmp2/target/classes\n    INFO - Configuring enterprise application: /Users/dblevins/examples/simple-cmp2/target/classpath.ear\n    INFO - Configuring Service(id=Default CMP Container, type=Container, provider-id=Default CMP Container)\n    INFO - Auto-creating a container for bean MovieBean: Container(type=CMP_ENTITY, id=Default CMP Container)\n    INFO - Configuring PersistenceUnit(name=cmp)\n    INFO - Adjusting PersistenceUnit cmp <jta-data-source> to Resource ID 'movieDatabase' from 'null'\n    INFO - Adjusting PersistenceUnit cmp <non-jta-data-source> to Resource ID 'movieDatabaseUnmanaged' from 'null'\n    INFO - Enterprise application \"/Users/dblevins/examples/simple-cmp2/target/classpath.ear\" loaded.\n    INFO - Assembling app: /Users/dblevins/examples/simple-cmp2/target/classpath.ear\n    INFO - PersistenceUnit(name=cmp, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 160ms\n    INFO - Jndi(name=MovieBeanLocalHome) --> Ejb(deployment-id=Mo
 vieBean)\n    INFO - Jndi(name=global/classpath.ear/simple-cmp2/MovieBean!org.superbiz.cmp2.Movies) --> Ejb(deployment-id=MovieBean)\n    INFO - Jndi(name=global/classpath.ear/simple-cmp2/MovieBean) --> Ejb(deployment-id=MovieBean)\n    INFO - Created Ejb(deployment-id=MovieBean, ejb-name=MovieBean, container=Default CMP Container)\n    INFO - Started Ejb(deployment-id=MovieBean, ejb-name=MovieBean, container=Default CMP Container)\n    INFO - Deployed Application(path=/Users/dblevins/examples/simple-cmp2/target/classpath.ear)\n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.919 sec\n    \n    Results :\n    \n    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0\n\n# CMP2 to JPA\n\nAs mentioned OpenEJB will implement the abstract CMP2 `EntityBean` as a JPA `@Entity`, create a `persistence.xml` file and convert all `ejb-jar.xml` mapping and queries to\na JPA `entity-mappings.xml` file.\n\nBoth of these files will be written to disk by setting the system property
  `openejb.descriptors.output` to `true`.  In the testcase\nabove, this can be done via the `InitialContext` parameters via code like this:\n\n    Properties p = new Properties();\n    p.put(Context.INITIAL_CONTEXT_FACTORY, \"org.apache.openejb.core.LocalInitialContextFactory\");\n\n    // setup the data sources as usual...\n\n    // write the generated descriptors\n    p.put(\"openejb.descriptors.output\", \"true\");\n\n    Context context = new InitialContext(p);\n\nBelow are the generated `persistence.xml` and `mapping.xml` files for our CMP2 `EntityBean`\n\n## CMP2 to JPA generated persistence.xml file\n\n    <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n    <persistence xmlns=\"http://java.sun.com/xml/ns/persistence\" version=\"1.0\">\n        <persistence-unit name=\"cmp\" transaction-type=\"JTA\">\n            <jta-data-source>movieDatabase</jta-data-source>\n            <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>\n            <mapping-fi
 le>META-INF/openejb-cmp-generated-orm.xml</mapping-file>\n            <class>openejb.org.superbiz.cmp2.MovieBean</class>\n            <properties>\n                <property name=\"openjpa.jdbc.SynchronizeMappings\"\n                value=\"buildSchema(ForeignKeys=true, Indexes=false, IgnoreErrors=true)\"/>\n                <property name=\"openjpa.Log\" value=\"DefaultLevel=INFO\"/>\n            </properties>\n        </persistence-unit>\n    </persistence>\n\nAll of this `persitence.xml` can be changed, however the `persistence-unit` must have the `name` fixed to `cmp`.\n\n## CMP2 to JPA generated mapping file\n\nNote that the `persistence.xml` above refers to this mappings file as `META-INF/openejb-cmp-generated-orm.xml`.  It is possible\nto rename this file to whatever name you prefer, just make sure to update the `<mapping-file>` element of the `cmp` persistence unit\naccordingly.\n\n    <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n    <entity-mappings xmlns=\
 "http://java.sun.com/xml/ns/persistence/orm\" version=\"1.0\">\n        <entity class=\"openejb.org.superbiz.cmp2.MovieBean\" name=\"MovieBean\">\n            <description>simple-cmp2#MovieBean</description>\n            <table/>\n            <named-query name=\"MovieBean.findByDirector(java.lang.String)\">\n                <query>SELECT m FROM MovieBean m WHERE m.director = ?1</query>\n            </named-query>\n            <named-query name=\"MovieBean.findAll\">\n                <query>SELECT m FROM MovieBean as m</query>\n            </named-query>\n            <attributes>\n                <id name=\"id\">\n                    <generated-value strategy=\"IDENTITY\"/>\n                </id>\n                <basic name=\"director\"/>\n                <basic name=\"year\"/>\n                <basic name=\"title\"/>\n            </attributes>\n        </entity>\n    </entity-mappings>\n",
+        "url":"https://github.com/apache/tomee/tree/master/examples/simple-cmp2"
+      }
+    ],
+    "codi":[
+      {
+        "name":"myfaces-codi-demo",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/myfaces-codi-demo"
+      }
+    ],
+    "component":[
+      {
+        "name":"component-interfaces",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/component-interfaces"
+      }
+    ],
+    "config":[
+      {
+        "name":"deltaspike-configproperty",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/deltaspike-configproperty"
+      },
+      {
+        "name":"webservice-ws-with-resources-config",
+        "readme":"No README.md yet, be the first to contribute one!",
+        "url":"https://github.com/apache/tomee/tree/master/examples/webservice-ws-with-resources-config"
+      }
+    ],
+    "connectionfactory":[
+      {
+        "name":"injection-of-connectionfactory",
+        "readme":"Title: Injection Of Connectionfactory\n\n*Help us document this example! Click the blue pencil icon in the upper right to edit this page.*\n\n## Messages\n\n    package org.superbiz.injection.jms;\n    \n    import javax.annotation.Resource;\n    import javax.ejb.Stateless;\n    import javax.jms.Connection;\n    import javax.jms.ConnectionFactory;\n    import javax.jms.DeliveryMode;\n    import javax.jms.JMSException;\n    import javax.jms.MessageConsumer;\n    import javax.jms.MessageProducer;\n    import javax.jms.Queue;\n    import javax.jms.Session;\n    import javax.jms.TextMessage;\n    \n    @Stateless\n    public class Messages {\n    \n        @Resource\n        private ConnectionFactory connectionFactory;\n    \n        @Resource\n        private Queue chatQueue;\n    \n    \n        public void sendMessage(String text) throws JMSException {\n    \n            Connection connection = null;\n            Session session = null;\n    \n            try {\n   
              connection = connectionFactory.createConnection();\n                connection.start();\n    \n                // Create a Session\n                session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n    \n                // Create a MessageProducer from the Session to the Topic or Queue\n                MessageProducer producer = session.createProducer(chatQueue);\n                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);\n    \n                // Create a message\n                TextMessage message = session.createTextMessage(text);\n    \n                // Tell the producer to send the message\n                producer.send(message);\n            } finally {\n                // Clean up\n                if (session != null) session.close();\n                if (connection != null) connection.close();\n            }\n        }\n    \n        public String receiveMessage() throws JMSException {\n    \n            Connection connection =
  null;\n            Session session = null;\n            MessageConsumer consumer = null;\n            try {\n                connection = connectionFactory.createConnection();\n                connection.start();\n    \n                // Create a Session\n                session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);\n    \n                // Create a MessageConsumer from the Session to the Topic or Queue\n                consumer = session.createConsumer(chatQueue);\n    \n                // Wait for a message\n                TextMessage message = (TextMessage) consumer.receive(1000);\n    \n                return message.getText();\n            } finally {\n                if (consumer != null) consumer.close();\n                if (session != null) session.close();\n                if (connection != null) connection.close();\n            }\n        }\n    }\n\n## MessagingBeanTest\n\n    package org.superbiz.injection.jms;\n    \n    import junit.framewor
 k.TestCase;\n    \n    import javax.ejb.embeddable.EJBContainer;\n    import javax.naming.Context;\n    \n    public class MessagingBeanTest extends TestCase {\n    \n        public void test() throws Exception {\n    \n            final Context context = EJBContainer.createEJBContainer().getContext();\n    \n            Messages messages = (Messages) context.lookup(\"java:global/injection-of-connectionfactory/Messages\");\n    \n            messages.sendMessage(\"Hello World!\");\n            messages.sendMessage(\"How are you?\");\n            messages.sendMessage(\"Still spinning?\");\n    \n            assertEquals(messages.receiveMessage(), \"Hello World!\");\n            assertEquals(messages.receiveMessage(), \"How are you?\");\n            assertEquals(messages.receiveMessage(), \"Still spinning?\");\n        }\n    }\n\n# Running\n\n    \n    -------------------------------------------------------\n     T E S T S\n    -------------------------------------------------------\
 n    Running org.superbiz.injection.jms.MessagingBeanTest\n    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06\n    http://tomee.apache.org/\n    INFO - openejb.home = /Users/dblevins/examples/injection-of-connectionfactory\n    INFO - openejb.base = /Users/dblevins/examples/injection-of-connectionfactory\n    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'\n    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)\n    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)\n    INFO - Found EjbModule in classpath: /Users/dblevins/examples/injection-of-connectionfactory/target/classes\n    INFO - Beginning load: /Users/dblevins/examples/injection-of-connectionfactory/target/classes\n    INFO - Configuring enterprise application: /Users/dblevins/examples/injection-of-connectionfactory\n    WARN - Method 'lookup' is not available for 'javax.ann
 otation.Resource'. Probably using an older Runtime.\n    INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)\n    INFO - Auto-creating a container for bean Messages: Container(type=STATELESS, id=Default Stateless Container)\n    INFO - Configuring Service(id=Default JMS Connection Factory, type=Resource, provider-id=Default JMS Connection Factory)\n    INFO - Auto-creating a Resource with id 'Default JMS Connection Factory' of type 'javax.jms.ConnectionFactory for 'Messages'.\n    INFO - Configuring Service(id=Default JMS Resource Adapter, type=Resource, provider-id=Default JMS Resource Adapter)\n    INFO - Auto-linking resource-ref 'java:comp/env/org.superbiz.injection.jms.Messages/connectionFactory' in bean Messages to Resource(id=Default JMS Connection Factory)\n    INFO - Configuring Service(id=org.superbiz.injection.jms.Messages/chatQueue, type=Resource, provider-id=Default Queue)\n    INFO - Auto-creating a Resour
 ce with id 'org.superbiz.injection.jms.Messages/chatQueue' of type 'javax.jms.Queue for 'Messages'.\n    INFO - Auto-linking resource-env-ref 'java:comp/env/org.superbiz.injection.jms.Messages/chatQueue' in bean Messages to Resource(id=org.superbiz.injection.jms.Messages/chatQueue)\n    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)\n    INFO - Auto-creating a container for bean org.superbiz.injection.jms.MessagingBeanTest: Container(type=MANAGED, id=Default Managed Container)\n    INFO - Enterprise application \"/Users/dblevins/examples/injection-of-connectionfactory\" loaded.\n    INFO - Assembling app: /Users/dblevins/examples/injection-of-connectionfactory\n    INFO - Jndi(name=\"java:global/injection-of-connectionfactory/Messages!org.superbiz.injection.jms.Messages\")\n    INFO - Jndi(name=\"java:global/injection-of-connectionfactory/Messages\")\n    INFO - Jndi(name=\"java:global/EjbModule1634151355/org.superbiz.
 injection.jms.MessagingBeanTest!org.super

<TRUNCATED>

Mime
View raw message