You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/07/10 07:36:21 UTC

svn commit: r1144778 [13/13] - /openejb/site/trunk/content/

Added: openejb/site/trunk/content/understanding-callbacks.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/understanding-callbacks.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/understanding-callbacks.mdtext (added)
+++ openejb/site/trunk/content/understanding-callbacks.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,91 @@
+Title: Understanding Callbacks
+The rules here are pretty hard to follow without examples.  
+
+When they say one AroundInvoke per class they mean that in the most literal
+sense as in one individual java class definition, not including it's parent
+class or classes, may exactly one AroundInvoke method.	The bean or
+interceptor class may have an AroundInvoke method, its parent class may
+have an AroundInvoke method, the parent's parent class may have an
+AroundInvoke method and so on.
+
+So the following is legal.
+
+
+        public class Plant {
+    	@AroundInvoke
+    	public Object a(InvocationContext ctx) throws Exception {
+    	    return ctx.proceed();
+    	}
+        }
+    
+        public class Fruit extends Plant {
+    	@AroundInvoke
+    	public Object b(InvocationContext ctx) throws Exception {
+    	    return ctx.proceed();
+    	}
+        }
+    
+        @Stateless
+        public class Apple extends Fruit implements AppleLocal {
+    	@AroundInvoke
+    	public Object c(InvocationContext ctx) throws Exception {
+    	    return ctx.proceed();
+    	}
+    
+    	public String grow(){
+    	    return "ready to pick";
+    	}
+        }
+    
+        public interface AppleLocal {
+    	public String grow();
+        }
+
+
+The result is that when the "grow" method on AppleLocal (and consequently
+on Apple) is invoked, the container will first invoke the following
+AroundInvoke methods in this order; a, b, c.
+
+What the ejb spec doesn't do such a good job at stating is that there are
+ways to effectively shut off the callbacks, including AroundInvoke, of a
+parent class by simply overriding the method.  We can shut off the "a"
+around invoke with a slightly different version of Apple as follows:
+
+
+        @Stateless
+        public class Apple extends Fruit implements AppleLocal {
+    
+    	// This will now never be called.
+    	public Object a(InvocationContext ctx) throws Exception {
+    	    return null;
+    	}
+    
+    	@AroundInvoke
+    	public Object c(InvocationContext ctx) throws Exception {
+    	    return ctx.proceed();
+    	}
+    
+    	public String grow(){
+    	    return "ready to pick";
+    	}
+        }
+
+
+The result of this is that when the "grow" method on AppleLocal is invoked,
+the container will first invoke the AroundInvoke methods "b" then "c"
+skipping "a" completely.
+
+When they say that an AroundInvoke method cannot be a business method, they
+mean that they cannot be exposed to clients through a local or remote
+interface.  The following would be illegal.
+
+
+        public interface AppleLocal {
+    	public String grow();
+    
+    	// This is an AroundInvoke method in the bean class, not a legal
+business method!
+    	public Object c(InvocationContext ctx) throws Exception;
+        }
+
+

Added: openejb/site/trunk/content/understanding-the-directory-layout.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/understanding-the-directory-layout.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/understanding-the-directory-layout.cwiki (added)
+++ openejb/site/trunk/content/understanding-the-directory-layout.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,59 @@
+When freshly unpacked, OpenEJB will look like this:
+
+{panel}
+ openejb-3.0/
+ openejb-3.0/logs/
+ openejb-3.0/apps/
+ openejb-3.0/lib/
+ openejb-3.0/lib/_<several jars>_
+ openejb-3.0/LICENSE.txt
+ openejb-3.0/NOTICE.txt
+ openejb-3.0/README.txt
+ openejb-3.0/bin/
+ openejb-3.0/bin/openejb.bat
+ openejb-3.0/bin/openejb
+ openejb-3.0/conf/
+ openejb-3.0/conf/README.txt
+{panel}
+
+h1. Directories
+
+h2. bin/
+
+Contains commands to start/stop the server (You can also do a lot of other stuff like deploy/undeploy, but we will just talk about things needed to get you started)
+
+h2. lib/
+
+Contains several jar files (you only need of few of these jars in your classpath to do EJB development)
+
+h2. apps/
+
+Once you create your EJB's and jar them up, you can place your jar file in this directory and start the server. The server will automatically deploy all the EJB's contained in this JAR.
+
+h2. logs/
+
+Contains log files.
+
+h2. conf/
+
+This directory contains nothing but a README.txt file at the time OpenEJB is unpacked.  The first time OpenEJB is started however, these files will be created:
+
+{noformat}
+  conf/
+    openejb.xml                (main config file)
+
+    logging.properties         (log levels and files)
+
+    login.config               (jaas config file)
+    users.properties           (users that can log in)
+    groups.properties          (groups in which users belong)
+
+    admin.properties           (network socket for administration)
+    ejbd.properties            (network socket for ejb invocations)
+    hsql.properties            (network socket for hsql client access)
+    httpejbd.properties        (network socket for ejb invocations over http)
+    telnet.properties          (network socket for telnet "server") 
+{noformat}
+
+These files can be edited as desired.  If at any time you are unhappy with your changes or simply wish to start over, you can delete or move any of the files above and a new one containing the default values will be automatically created.
+

Propchange: openejb/site/trunk/content/understanding-the-directory-layout.cwiki
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openejb/site/trunk/content/understanding-the-directory-layout.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/understanding-the-directory-layout.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/understanding-the-directory-layout.mdtext (added)
+++ openejb/site/trunk/content/understanding-the-directory-layout.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,77 @@
+Title: Understanding the Directory Layout
+When freshly unpacked, OpenEJB will look like this:
+
+{panel}
+ openejb-3.0/
+ openejb-3.0/logs/
+ openejb-3.0/apps/
+ openejb-3.0/lib/
+ openejb-3.0/lib/_<several jars>_
+ openejb-3.0/LICENSE.txt
+ openejb-3.0/NOTICE.txt
+ openejb-3.0/README.txt
+ openejb-3.0/bin/
+ openejb-3.0/bin/openejb.bat
+ openejb-3.0/bin/openejb
+ openejb-3.0/conf/
+ openejb-3.0/conf/README.txt
+{panel}
+
+<a name="UnderstandingtheDirectoryLayout-Directories"></a>
+# Directories
+
+<a name="UnderstandingtheDirectoryLayout-bin/"></a>
+## bin/
+
+Contains commands to start/stop the server (You can also do a lot of other
+stuff like deploy/undeploy, but we will just talk about things needed to
+get you started)
+
+<a name="UnderstandingtheDirectoryLayout-lib/"></a>
+## lib/
+
+Contains several jar files (you only need of few of these jars in your
+classpath to do EJB development)
+
+<a name="UnderstandingtheDirectoryLayout-apps/"></a>
+## apps/
+
+Once you create your EJB's and jar them up, you can place your jar file in
+this directory and start the server. The server will automatically deploy
+all the EJB's contained in this JAR.
+
+<a name="UnderstandingtheDirectoryLayout-logs/"></a>
+## logs/
+
+Contains log files.
+
+<a name="UnderstandingtheDirectoryLayout-conf/"></a>
+## conf/
+
+This directory contains nothing but a README.txt file at the time OpenEJB
+is unpacked.  The first time OpenEJB is started however, these files will
+be created:
+
+
+      conf/
+        openejb.xml 	       (main config file)
+    
+        logging.properties	       (log levels and files)
+    
+        login.config	       (jaas config file)
+        users.properties	       (users that can log in)
+        groups.properties	       (groups in which users belong)
+    
+        admin.properties	       (network socket for administration)
+        ejbd.properties	       (network socket for ejb invocations)
+        hsql.properties	       (network socket for hsql client access)
+        httpejbd.properties        (network socket for ejb invocations over
+http)
+        telnet.properties	       (network socket for telnet "server") 
+
+
+These files can be edited as desired.  If at any time you are unhappy with
+your changes or simply wish to start over, you can delete or move any of
+the files above and a new one containing the default values will be
+automatically created.
+

Added: openejb/site/trunk/content/unit-testing-transactions.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/unit-testing-transactions.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/unit-testing-transactions.cwiki (added)
+++ openejb/site/trunk/content/unit-testing-transactions.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,168 @@
+h1. Basic setup
+
+Add the following interface and bean to your test sources (they could even be inner classes of a test case):
+
+h2. Business interface
+
+{code}
+public interface Caller {
+    public <V> V call(Callable<V> callable) throws Exception;
+}
+{code}
+
+h2. Bean Implementation(s)
+
+{code}
+import java.util.concurrent.Callable;
+
+@Stateless
+@TransactionAttribute(REQUIRES_NEW)
+public class TransactionBean implements Caller {
+    public <V> V call(Callable<V> callable) throws Exception {
+        return callable.call();
+    }
+}
+{code}
+
+h2. Have them discovered
+
+In src/test/resources/ (or related) create an META-INF/ejb-jar.xml containing the text "<ejb-jar/>"
+
+h2. What we accomplished
+
+Essentially what we've done is added an ejb that will be picked up as part of your test code and deployed.  You can then look it up and use it to execute test code with any particular transaction or security constraints that you want.  The above bean specifies REQUIRES_NEW; functionally the same as REQUIRED as the test case itself won't have a transaction, but a little cleaner and more explicit.  
+
+You could also annotate the bean with @RunAs("manager") for example and test that your security restrictions are how you like them.  You can have as many of these test beans in your test code as you like, each with it's own transaction and security constraints allowing you to write some incredibly thorough tests.
+
+You do not need to use java.util.concurrent.Callable, any similar interface of your creation could work just as well.  You may want something with return type void, for example, to eliminate useless 'return null' statements.
+
+h1.  Usage
+
+There are a number of style choices for using the above bean, specifically around the creation of the Callable object you pass in, and it all really depends on what looks nice to you.
+
+In the examples below, the Movies bean being tested is simply a thin layer around JPA that allows us to use enforce various transaction semantics.
+
+{code}
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import static javax.ejb.TransactionAttributeType.MANDATORY;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import java.util.List;
+
+@Stateful(name = "Movies")
+@TransactionAttribute(MANDATORY)
+public class MoviesImpl implements Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.TRANSACTION)
+    private EntityManager entityManager;
+
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+}
+
+{code}
+
+Test code below.
+
+h2. Pure inlined
+
+The Callable can be created right in the test method itself.
+
+{code}
+public class MoviesTest extends TestCase {
+    private Context context;
+
+    protected void setUp() throws Exception {
+        // initialize jndi context as usual
+    }
+
+    public void test() throws Exception {
+        Caller transactionBean = (Caller) context.lookup("TransactionBeanLocal");
+
+        transactionBean.call(new Callable() {
+            public Object call() throws Exception {
+                Movies movies = (Movies) context.lookup("MoviesLocal");
+
+                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());
+
+                return null;
+            }
+        });
+    }
+}
+{code}
+
+h2.  Same test code, different transaction scenarios
+
+Maybe you'd like to test how things behave with and without a transaction to guarantee everyone is doing the right thing in all situations.  Negative testing is often a very good way to stomp out dangerous bugs.
+
+{code}
+public class MoviesTest extends TestCase {
+    private Context context;
+
+    protected void setUp() throws Exception {
+        // initialize jndi context as usual
+    }
+
+    private void doWork() throws Exception {
+        Movies movies = (Movies) context.lookup("MoviesLocal");
+
+        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 {
+        Caller transactionBean = (Caller) context.lookup("TransactionBeanLocal");
+
+        transactionBean.call(new Callable(){
+            public Object call() throws Exception {
+                doWork();
+                return null;
+            }
+        });
+    }
+
+    public void testWithoutTransaction() throws Exception {
+        try {
+            doWork();
+            fail("The Movies bean should be using TransactionAttributeType.MANDATORY");
+        } catch (javax.transaction.TransactionRequiredException e) {
+            // good, our Movies bean is using TransactionAttributeType.MANDATORY as we want
+        }
+    }
+}
+{code}
\ No newline at end of file

Propchange: openejb/site/trunk/content/unit-testing-transactions.cwiki
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openejb/site/trunk/content/unit-testing-transactions.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/unit-testing-transactions.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/unit-testing-transactions.mdtext (added)
+++ openejb/site/trunk/content/unit-testing-transactions.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,206 @@
+Title: Unit Testing Transactions
+<a name="UnitTestingTransactions-Basicsetup"></a>
+# Basic setup
+
+Add the following interface and bean to your test sources (they could even
+be inner classes of a test case):
+
+<a name="UnitTestingTransactions-Businessinterface"></a>
+## Business interface
+
+
+    public interface Caller {
+        public <V> V call(Callable<V> callable) throws Exception;
+    }
+
+
+<a name="UnitTestingTransactions-BeanImplementation(s)"></a>
+## Bean Implementation(s)
+
+
+    import java.util.concurrent.Callable;
+    
+    @Stateless
+    @TransactionAttribute(REQUIRES_NEW)
+    public class TransactionBean implements Caller {
+        public <V> V call(Callable<V> callable) throws Exception {
+    	return callable.call();
+        }
+    }
+
+
+<a name="UnitTestingTransactions-Havethemdiscovered"></a>
+## Have them discovered
+
+In src/test/resources/ (or related) create an META-INF/ejb-jar.xml
+containing the text "<ejb-jar/>"
+
+<a name="UnitTestingTransactions-Whatweaccomplished"></a>
+## What we accomplished
+
+Essentially what we've done is added an ejb that will be picked up as part
+of your test code and deployed.  You can then look it up and use it to
+execute test code with any particular transaction or security constraints
+that you want.	The above bean specifies REQUIRES_NEW; functionally the
+same as REQUIRED as the test case itself won't have a transaction, but a
+little cleaner and more explicit.  
+
+You could also annotate the bean with @RunAs("manager") for example and
+test that your security restrictions are how you like them.  You can have
+as many of these test beans in your test code as you like, each with it's
+own transaction and security constraints allowing you to write some
+incredibly thorough tests.
+
+You do not need to use java.util.concurrent.Callable, any similar interface
+of your creation could work just as well.  You may want something with
+return type void, for example, to eliminate useless 'return null'
+statements.
+
+<a name="UnitTestingTransactions-Usage"></a>
+#  Usage
+
+There are a number of style choices for using the above bean, specifically
+around the creation of the Callable object you pass in, and it all really
+depends on what looks nice to you.
+
+In the examples below, the Movies bean being tested is simply a thin layer
+around JPA that allows us to use enforce various transaction semantics.
+
+
+    import javax.ejb.Stateful;
+    import javax.ejb.TransactionAttribute;
+    import static javax.ejb.TransactionAttributeType.MANDATORY;
+    import javax.persistence.EntityManager;
+    import javax.persistence.PersistenceContext;
+    import javax.persistence.PersistenceContextType;
+    import javax.persistence.Query;
+    import java.util.List;
+    
+    @Stateful(name = "Movies")
+    @TransactionAttribute(MANDATORY)
+    public class MoviesImpl implements Movies {
+    
+        @PersistenceContext(unitName = "movie-unit", type =
+PersistenceContextType.TRANSACTION)
+        private EntityManager entityManager;
+    
+        public void addMovie(Movie movie) throws Exception {
+    	entityManager.persist(movie);
+        }
+    
+        public void deleteMovie(Movie movie) throws Exception {
+    	entityManager.remove(movie);
+        }
+    
+        public List<Movie> getMovies() throws Exception {
+    	Query query = entityManager.createQuery("SELECT m from Movie as
+m");
+    	return query.getResultList();
+        }
+    }
+    
+
+
+Test code below.
+
+<a name="UnitTestingTransactions-Pureinlined"></a>
+## Pure inlined
+
+The Callable can be created right in the test method itself.
+
+
+    public class MoviesTest extends TestCase {
+        private Context context;
+    
+        protected void setUp() throws Exception {
+    	// initialize jndi context as usual
+        }
+    
+        public void test() throws Exception {
+    	Caller transactionBean = (Caller)
+context.lookup("TransactionBeanLocal");
+    
+    	transactionBean.call(new Callable() {
+    	    public Object call() throws Exception {
+    		Movies movies = (Movies) context.lookup("MoviesLocal");
+    
+    		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());
+    
+    		return null;
+    	    }
+    	});
+        }
+    }
+
+
+<a name="UnitTestingTransactions-Sametestcode,differenttransactionscenarios"></a>
+##  Same test code, different transaction scenarios
+
+Maybe you'd like to test how things behave with and without a transaction
+to guarantee everyone is doing the right thing in all situations.  Negative
+testing is often a very good way to stomp out dangerous bugs.
+
+
+    public class MoviesTest extends TestCase {
+        private Context context;
+    
+        protected void setUp() throws Exception {
+    	// initialize jndi context as usual
+        }
+    
+        private void doWork() throws Exception {
+    	Movies movies = (Movies) context.lookup("MoviesLocal");
+    
+    	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 {
+    	Caller transactionBean = (Caller)
+context.lookup("TransactionBeanLocal");
+    
+    	transactionBean.call(new Callable(){
+    	    public Object call() throws Exception {
+    		doWork();
+    		return null;
+    	    }
+    	});
+        }
+    
+        public void testWithoutTransaction() throws Exception {
+    	try {
+    	    doWork();
+    	    fail("The Movies bean should be using
+TransactionAttributeType.MANDATORY");
+    	} catch (javax.transaction.TransactionRequiredException e) {
+    	    // good, our Movies bean is using
+TransactionAttributeType.MANDATORY as we want
+    	}
+        }
+    }
+

Added: openejb/site/trunk/content/users-guide.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/users-guide.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/users-guide.cwiki (added)
+++ openejb/site/trunk/content/users-guide.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,15 @@
+Table of Contents:
+# [Getting Started]
+# [Understanding the Directory Layout]
+# [Introduction to the command line tools]
+# [OPENEJB:Persistence]
+# [Stateless Session Beans]
+# [OPENEJB:Stateful Session Beans]
+# [OPENEJB:Message Driven Beans
+# [Configuring the Server
+## [Configure a DataSource|Configuring DataSources]
+## [Configure Logging|OPENEJB:Logging]
+## System properties
+## Configure security
+
+{color:#ff0000}{*}TODO: Create separate pages for the above in users guide and link to them.&nbsp; Would be good to add "Next Page, Previous Page and Table of contents" links on each page.\**{color}
\ No newline at end of file

Propchange: openejb/site/trunk/content/users-guide.cwiki
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openejb/site/trunk/content/users-guide.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/users-guide.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/users-guide.mdtext (added)
+++ openejb/site/trunk/content/users-guide.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,18 @@
+Title: Users Guide
+Table of Contents:
+1. [Getting Started](getting-started.html)
+1. [Understanding the Directory Layout](understanding-the-directory-layout.html)
+1. [Introduction to the command line tools](introduction-to-the-command-line-tools.html)
+1. [OPENEJB:Persistence](openejb:persistence.html)
+1. [Stateless Session Beans](stateless-session-beans.html)
+1. [OPENEJB:Stateful Session Beans](openejb:stateful-session-beans.html)
+1. [OPENEJB:Message Driven Beans
+1. [Configuring the Server
+1. # [Configure a DataSource](configuring-datasources.html)
+1. # [Configure Logging](openejb:logging.html)
+1. # System properties
+1. # Configure security
+
+{color:#ff0000}{*}TODO: Create separate pages for the above in users guide
+and link to them.&nbsp; Would be good to add "Next Page, Previous Page and
+Table of contents" links on each page.\**{color}

Added: openejb/site/trunk/content/users.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/users.cwiki?rev=1144778&view=auto
==============================================================================
    (empty)

Propchange: openejb/site/trunk/content/users.cwiki
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openejb/site/trunk/content/users.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/users.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/users.mdtext (added)
+++ openejb/site/trunk/content/users.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1 @@
+Title: Users

Added: openejb/site/trunk/content/webapp-based-ejbs.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/webapp-based-ejbs.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/webapp-based-ejbs.cwiki (added)
+++ openejb/site/trunk/content/webapp-based-ejbs.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,84 @@
+{note:title=THIS PAGE WILL BE ARCHIVED AND REMOVED}
+Instructions on Webapp-based EJBs can be found at&nbsp; [Collapsed EAR]
+
+{note}
+h1. Introduction
+
+The basic idea of this approach is that your Servlets and EJBs are together in your war file as one app.
+
+      * No classloader boundries between Serlvets & EJBs
+
+      * EJBs and Servlets can share all third-party libraries (like Spring!), no ear required.
+
+      * Can put the web.xml and ejb-jar.xml in the same archive (the war file).
+
+      * EJBs can see Serlvet classes and vice versa.
+
+How is this done?  The support for running your EJBs (OpenEJB) is loaded into your webapp classloader and not visible to any other webapps.
+
+
+h2. Not quite J2EE
+
+This is very different than J2EE as defined by the spec as there aren't several levels of separation and heirarchy.  This is going to take some getting used to and it should be understood that this style of packaging isn't J2EE compliant.
+
+J2EE classloading rules:
+
+      * You cannot ever have ejbs and servlets in the same classloader.
+
+      * Three classloader minimum; a classloader for the ear, one for each ejb jar, and one for each war file.
+
+      * Servlets can see EJBs, but EJBs cannot see Servlets.
+
+  To pull that off, J2EE has to kill you on packaging:
+
+      * You cannot have EJB classes and Servlet classes in the same archive.
+
+      * You need at least three archives to combine servlets and ejbs;
+        1 ear containing 1 ejb jar and 1 servlet war.
+
+      * Shared libraries must go in the ear and be included in a
+        specially formatted 'Class-Path' entry in the ear's MANIFEST
+        file.
+
+Critically speaking, forcing more than one classloader on an application is where J2EE "jumps the shark" for a large majority of people's needs.
+
+h1. Setup
+
+This is new feature for OpenEJB 1.0.
+
+Configure OpenEJB per webapp requires the following steps:
+* Copy the _openejb-loader-*.jar_ into the WEB-INF/lib directory of the webapp that is to use EJBs deployed onto OpenEJB
+* Add the _loader_ servlet definition to the WEB-INF/web.xml file of the webapp with a valid value for openejb.home init-param.
+{code}
+<servlet>
+    <servlet-name>loader</servlet-name>
+    <servlet-class>org.openejb.loader.LoaderServlet</servlet-class>
+    <init-param>
+      <param-name>openejb.loader</param-name>
+      <param-value>tomcat-webapp</param-value>
+    </init-param>
+    <init-param>
+      <param-name>openejb.home</param-name>
+      <param-value>...define OPENEJB_HOME here...</param-value>
+    </init-param>
+    <load-on-startup>0</load-on-startup>
+  </servlet>
+{code}
+
+
+Should you define other OpenEJB configuration settings use another <init-param> stanza. It's just for that. These parameters are directly passed to OpenEJB at initialization of the servlet. Think about the loader servlet as a bridge between OpenEJB's world (EJBs) and Tomcat's world (servlets, JSPs).
+
+At startup OpenEJB prints out all of the configuration settings to Tomcat logs:
+
+{code}
+INFO: Installing web application at context path /openejb from URL file:C:\webapps\openejb
+OpenEJB init-params:
+        param-name: openejb.home, param-value: c:\openejb
+        param-name: openejb.configuration, param-value: conf\openejb.cfg
+        param-name: openejb.base, param-value: c:\webapps\openejb\WEB-INF\openejb
+        param-name: openejb.loader, param-value: tomcat-webapp
+{code}
+
+
+* Start up Tomcat and have fun with the EJBs
+

Propchange: openejb/site/trunk/content/webapp-based-ejbs.cwiki
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openejb/site/trunk/content/webapp-based-ejbs.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/webapp-based-ejbs.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/webapp-based-ejbs.mdtext (added)
+++ openejb/site/trunk/content/webapp-based-ejbs.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,107 @@
+Title: Webapp-based EJBs
+{note:title=THIS PAGE WILL BE ARCHIVED AND REMOVED}
+Instructions on Webapp-based EJBs can be found at&nbsp; [Collapsed EAR](collapsed-ear.html)
+
+{note}
+<a name="Webapp-basedEJBs-Introduction"></a>
+# Introduction
+
+The basic idea of this approach is that your Servlets and EJBs are together
+in your war file as one app.
+
+      * No classloader boundries between Serlvets & EJBs
+
+      * EJBs and Servlets can share all third-party libraries (like
+Spring!), no ear required.
+
+      * Can put the web.xml and ejb-jar.xml in the same archive (the war
+file).
+
+      * EJBs can see Serlvet classes and vice versa.
+
+How is this done?  The support for running your EJBs (OpenEJB) is loaded
+into your webapp classloader and not visible to any other webapps.
+
+
+<a name="Webapp-basedEJBs-NotquiteJ2EE"></a>
+## Not quite J2EE
+
+This is very different than J2EE as defined by the spec as there aren't
+several levels of separation and heirarchy.  This is going to take some
+getting used to and it should be understood that this style of packaging
+isn't J2EE compliant.
+
+J2EE classloading rules:
+
+      * You cannot ever have ejbs and servlets in the same classloader.
+
+      * Three classloader minimum; a classloader for the ear, one for each
+ejb jar, and one for each war file.
+
+      * Servlets can see EJBs, but EJBs cannot see Servlets.
+
+  To pull that off, J2EE has to kill you on packaging:
+
+      * You cannot have EJB classes and Servlet classes in the same
+archive.
+
+      * You need at least three archives to combine servlets and ejbs;
+	1 ear containing 1 ejb jar and 1 servlet war.
+
+      * Shared libraries must go in the ear and be included in a
+	specially formatted 'Class-Path' entry in the ear's MANIFEST
+	file.
+
+Critically speaking, forcing more than one classloader on an application is
+where J2EE "jumps the shark" for a large majority of people's needs.
+
+<a name="Webapp-basedEJBs-Setup"></a>
+# Setup
+
+This is new feature for OpenEJB 1.0.
+
+Configure OpenEJB per webapp requires the following steps:
+* Copy the _openejb-loader-*.jar_ into the WEB-INF/lib directory of the
+webapp that is to use EJBs deployed onto OpenEJB
+* Add the _loader_ servlet definition to the WEB-INF/web.xml file of the
+webapp with a valid value for openejb.home init-param.
+
+    <servlet>
+        <servlet-name>loader</servlet-name>
+        <servlet-class>org.openejb.loader.LoaderServlet</servlet-class>
+        <init-param>
+          <param-name>openejb.loader</param-name>
+          <param-value>tomcat-webapp</param-value>
+        </init-param>
+        <init-param>
+          <param-name>openejb.home</param-name>
+          <param-value>...define OPENEJB_HOME here...</param-value>
+        </init-param>
+        <load-on-startup>0</load-on-startup>
+      </servlet>
+
+
+
+Should you define other OpenEJB configuration settings use another
+<init-param> stanza. It's just for that. These parameters are directly
+passed to OpenEJB at initialization of the servlet. Think about the loader
+servlet as a bridge between OpenEJB's world (EJBs) and Tomcat's world
+(servlets, JSPs).
+
+At startup OpenEJB prints out all of the configuration settings to Tomcat
+logs:
+
+
+    INFO: Installing web application at context path /openejb from URL
+file:C:\webapps\openejb
+    OpenEJB init-params:
+    	param-name: openejb.home, param-value: c:\openejb
+    	param-name: openejb.configuration, param-value: conf\openejb.cfg
+    	param-name: openejb.base, param-value:
+c:\webapps\openejb\WEB-INF\openejb
+    	param-name: openejb.loader, param-value: tomcat-webapp
+
+
+
+* Start up Tomcat and have fun with the EJBs
+

Added: openejb/site/trunk/content/wiki.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/wiki.cwiki?rev=1144778&view=auto
==============================================================================
    (empty)

Propchange: openejb/site/trunk/content/wiki.cwiki
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openejb/site/trunk/content/wiki.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/wiki.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/wiki.mdtext (added)
+++ openejb/site/trunk/content/wiki.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1 @@
+Title: Wiki