TOMEE-2316 Convert Markdown files to Asciidoc in the docs folder - 10
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/de7099c5 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/de7099c5 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/de7099c5 Branch: refs/heads/master Commit: de7099c54f139c45c373b593638e677594c6dd70 Parents: 388460f Author: Carlos Chacin <[email protected]> Authored: Wed Dec 5 22:07:26 2018 -0800 Committer: Carlos Chacin <[email protected]> Committed: Wed Dec 5 22:07:26 2018 -0800 ---------------------------------------------------------------------- docs/spring-and-openejb-3.0.adoc | 224 +++++++++++++++ docs/spring-and-openejb-3.0.md | 190 ------------- docs/spring-ejb-and-jpa.adoc | 195 +++++++++++++ docs/spring-ejb-and-jpa.md | 173 ------------ docs/spring.adoc | 139 ++++++++++ docs/spring.md | 124 --------- docs/ssh.adoc | 63 +++++ docs/ssh.md | 51 ---- docs/standalone-server.adoc | 24 ++ docs/standalone-server.md | 27 -- docs/startup.adoc | 267 ++++++++++++++++++ docs/startup.md | 296 -------------------- docs/statefulcontainer-config.adoc | 165 +++++++++++ docs/statefulcontainer-config.md | 160 ----------- docs/statelesscontainer-config.adoc | 441 +++++++++++++++++++++++++++++ docs/statelesscontainer-config.md | 461 ------------------------------- docs/system-properties-files.adoc | 25 ++ docs/system-properties-files.md | 22 -- docs/system-properties.adoc | 68 +++++ docs/system-properties.md | 68 ----- 20 files changed, 1611 insertions(+), 1572 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/spring-and-openejb-3.0.adoc ---------------------------------------------------------------------- diff --git a/docs/spring-and-openejb-3.0.adoc b/docs/spring-and-openejb-3.0.adoc new file mode 100644 index 0000000..ea2c24c --- /dev/null +++ b/docs/spring-and-openejb-3.0.adoc @@ -0,0 +1,224 @@ +:jbake-title: Spring and OpenEJB 3.0 +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + + +\{note}OpenEJB 3.1 and later users should refer to the [Spring] +page.\{note} # Bootstrapping OpenEJB in Spring + +If you wish to use OpenEJB inside Spring you can do so pretty easily. +Include OpenEJB and its dependencies in your classpath as you would in a +plain embedded scenario then add a custom factory like the following: + +.... +public class OpenEjbFactoryBean implements org.springframework.beans.factory.FactoryBean { + + private Properties properties = new Properties(); + + public OpenEjbFactoryBean() { + properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); + } + + public Properties getJndiEnvironment() { + return properties; + } + + public void setJndiEnvironment(Properties properties) { + this.properties.putAll(properties); + } + + public Object getObject() { + try { + return new InitialContext(properties); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public Class getObjectType(){ + return Context.class; + } + + boolean isSingleton() { + return true; + } +} +.... + +And include that at the top of your spring xml file as follows: + +.... +<bean id="OpenEjbContext" class="org.acme.OpenEjbFactoryBean"> + <property name="jndiEnvironment"> + <props> + <prop key="myDs">new://Resource?type=DataSource</prop> + <prop key="myDs.JdbcDriver">com.mysql.jdbc.Driver</prop> + <prop key="myDs.JdbcUrl">jdbc:mysql://localhost/midastest?createDatabaseIfNotExist=true</prop> + <prop key="myDs.UserName">root</prop> + <prop key="myDs.Password"></prop> + </props> + </property> +</bean> +.... + +The value of is meant to be illustrative of the kinds of properties you +can pass into OpenEJB. It's possible to create any number of +datasources, topics, queues, containers and more this way. + +Just as with Unit Testing, OpenEJB will find and automatically deploy +all the EJB beans it [finds in the classpath|Application discovery via +the classpath]. You can then expose any of these things to other Spring +components with custom factory beans. + +== Injecting OpenEJB-created resources into Spring components + +If you want to have any of the Topics, Queues, DataSources, +EntityManagers or more that OpenEJB creates injected into components +that Spring creates, here's one technique.... + +Let's say you have a persistence unit called "_OrangeUnit_" declared in +a persistence.xml file. One way to get the related _EntityManager_ +created by OpenEJB is to do as follows. Create an @Stateless bean with +an @PersistenceContext ref in it, then use a factory bean to look it up, +pull the EntityManager out and return it + +OrangeUnitBean.java + +.... +/* + * OpenEJB will automatically find this bean. Just put it in the same jar + * that your META-INF/persistence.xml file is located in and make sure that + * that same jar file also has a META-INF/ejb-jar.xml file. The ejb-jar.xml + * need only contain the text "<ejb-jar/>" at minimum. + */ +@Stateless +public class OrangeUnitBean implements OrangeUnitLocal { + + @PersistenceContext(unitName="OrangeUnit") + private EntityManager entityManager; + + public EntityManager getEntityManager() { + return entityManager; + } +} +.... + +OrangeUnitLocal.java + +.... +/** + * The local interface for the OrangeUnitBean + */ +public interface OrangeUnitLocal { + public EntityManager getEntityManager(); +} +.... + +OrangeUnitFactoryBean.java + +.... +/** + * This factory bean will lookup the OrangeUnitBean using the javax.naming.Context + * that is created via the OpenEjbFactoryBean above. It will simply grab the EntityManager + * from that bean and hand it over to Spring. Anyone in Spring-land can then easily get + * a reference to the EntityManager by simply referencing this factory bean. + */ +public class OrangeUnitFactoryBean implements org.springframework.beans.factory.FactoryBean { + private Context context; + + public Context getContext() { + return context; + } + + public void setContext(Context context) { + this.context = context; + } + + public Object getObject() { + try { + ResourceLocal bean = (ResourceLocal) context.lookup("OrangeUnitBeanLocal"); + return bean.getEntityManager(); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public Class getObjectType(){ + return EntityManager.class; + } + + boolean isSingleton() { + return true; + } +} +.... + +The factory bean would then be declared in your spring xml file as +follows: + +.... +<bean id="OrangeUnit" class="org.acme.OrangeUnitFactoryBean"> + <property name="context" ref="OpenEjbContext"> +</bean> +.... + +The EntityManager can then easily be consumed by a spring bean. + +.... +public class SomePojo { + + private EntityManager entityManager; + + public void setEntityManager(EntityManager entityManager) { + this.entityManager = entityManager; + } + + ... +} +.... + +In the spring xml + +.... +<bean id="SomePojo" class="org.acme.SomePojo"> + <property name="entityManager" ref="OrangeUnit"> +</bean> +.... + +Here's what all three declarations would look like together in your +spring xml: + +Spring bean definitions combined + +.... +<bean id="OpenEjbContext" class="org.acme.OpenEjbFactoryBean"> + <property name="jndiEnvironment"> + <props> + <prop key="myDs">new://Resource?type=DataSource</prop> + <prop key="myDs.JdbcDriver">com.mysql.jdbc.Driver</prop> + <prop key="myDs.JdbcUrl">jdbc:mysql://localhost/midastest?createDatabaseIfNotExist=true</prop> + <prop key="myDs.UserName">root</prop> + <prop key="myDs.Password"></prop> + </props> + </property> +</bean> + +<bean id="OrangeUnit" class="org.acme.OrangeUnitFactoryBean"> + <property name="context" ref="OpenEjbContext"> +</bean> + +<bean id="SomePojo" class="org.acme.SomePojo"> + <property name="entityManager" ref="OrangeUnit"> +</bean> +.... + +:jbake-title: Some more useful info.} Here is a bunch of links suggested +by a user. If anybody has time to go through them and write a doc, that +would be great. These links explain how to make available spring +components to openejb +http://twasink.net/blog/archives/2007/01/using_spring_wi.html +http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.html +http://wiki.netbeans.org/MavenSpringEJBsOnGlassfish + +\{info} http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/spring-and-openejb-3.0.md ---------------------------------------------------------------------- diff --git a/docs/spring-and-openejb-3.0.md b/docs/spring-and-openejb-3.0.md deleted file mode 100644 index 7ac4cce..0000000 --- a/docs/spring-and-openejb-3.0.md +++ /dev/null @@ -1,190 +0,0 @@ -title=Spring and OpenEJB 3.0 -type=page -status=published -~~~~~~ - -{note}OpenEJB 3.1 and later users should refer to the [Spring] page.{note} -# Bootstrapping OpenEJB in Spring - -If you wish to use OpenEJB inside Spring you can do so pretty easily. Include OpenEJB and its dependencies in your classpath as you would in a plain embedded scenario then add a custom factory like the following: - - public class OpenEjbFactoryBean implements org.springframework.beans.factory.FactoryBean { - - private Properties properties = new Properties(); - - public OpenEjbFactoryBean() { - properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - } - - public Properties getJndiEnvironment() { - return properties; - } - - public void setJndiEnvironment(Properties properties) { - this.properties.putAll(properties); - } - - public Object getObject() { - try { - return new InitialContext(properties); - } catch (NamingException e) { - throw new RuntimeException(e); - } - } - - public Class getObjectType(){ - return Context.class; - } - - boolean isSingleton() { - return true; - } - } - -And include that at the top of your spring xml file as follows: - - <bean id="OpenEjbContext" class="org.acme.OpenEjbFactoryBean"> - <property name="jndiEnvironment"> - <props> - <prop key="myDs">new://Resource?type=DataSource</prop> - <prop key="myDs.JdbcDriver">com.mysql.jdbc.Driver</prop> - <prop key="myDs.JdbcUrl">jdbc:mysql://localhost/midastest?createDatabaseIfNotExist=true</prop> - <prop key="myDs.UserName">root</prop> - <prop key="myDs.Password"></prop> - </props> - </property> - </bean> - -The value of <props> is meant to be illustrative of the kinds of properties you can pass into OpenEJB. It's possible to create any number of datasources, topics, queues, containers and more this way. - -Just as with Unit Testing, OpenEJB will find and automatically deploy all the EJB beans it [finds in the classpath|Application discovery via the classpath]. You can then expose any of these things to other Spring components with custom factory beans. - -# Injecting OpenEJB-created resources into Spring components - -If you want to have any of the Topics, Queues, DataSources, EntityManagers or more that OpenEJB creates injected into components that Spring creates, here's one technique.... - -Let's say you have a persistence unit called "*OrangeUnit*" declared in a persistence.xml file. One way to get the related *EntityManager* created by OpenEJB is to do as follows. Create an @Stateless bean with an @PersistenceContext ref in it, then use a factory bean to look it up, pull the EntityManager out and return it - -OrangeUnitBean.java - - /* - * OpenEJB will automatically find this bean. Just put it in the same jar - * that your META-INF/persistence.xml file is located in and make sure that - * that same jar file also has a META-INF/ejb-jar.xml file. The ejb-jar.xml - * need only contain the text "<ejb-jar/>" at minimum. - */ - @Stateless - public class OrangeUnitBean implements OrangeUnitLocal { - - @PersistenceContext(unitName="OrangeUnit") - private EntityManager entityManager; - - public EntityManager getEntityManager() { - return entityManager; - } - } - -OrangeUnitLocal.java - - /** - * The local interface for the OrangeUnitBean - */ - public interface OrangeUnitLocal { - public EntityManager getEntityManager(); - } - -OrangeUnitFactoryBean.java - - /** - * This factory bean will lookup the OrangeUnitBean using the javax.naming.Context - * that is created via the OpenEjbFactoryBean above. It will simply grab the EntityManager - * from that bean and hand it over to Spring. Anyone in Spring-land can then easily get - * a reference to the EntityManager by simply referencing this factory bean. - */ - public class OrangeUnitFactoryBean implements org.springframework.beans.factory.FactoryBean { - private Context context; - - public Context getContext() { - return context; - } - - public void setContext(Context context) { - this.context = context; - } - - public Object getObject() { - try { - ResourceLocal bean = (ResourceLocal) context.lookup("OrangeUnitBeanLocal"); - return bean.getEntityManager(); - } catch (NamingException e) { - throw new RuntimeException(e); - } - } - - public Class getObjectType(){ - return EntityManager.class; - } - - boolean isSingleton() { - return true; - } - } - -The factory bean would then be declared in your spring xml file as follows: - - - <bean id="OrangeUnit" class="org.acme.OrangeUnitFactoryBean"> - <property name="context" ref="OpenEjbContext"> - </bean> - -The EntityManager can then easily be consumed by a spring bean. - - public class SomePojo { - - private EntityManager entityManager; - - public void setEntityManager(EntityManager entityManager) { - this.entityManager = entityManager; - } - - ... - } - -In the spring xml - - <bean id="SomePojo" class="org.acme.SomePojo"> - <property name="entityManager" ref="OrangeUnit"> - </bean> - -Here's what all three declarations would look like together in your spring xml: - -Spring bean definitions combined - - <bean id="OpenEjbContext" class="org.acme.OpenEjbFactoryBean"> - <property name="jndiEnvironment"> - <props> - <prop key="myDs">new://Resource?type=DataSource</prop> - <prop key="myDs.JdbcDriver">com.mysql.jdbc.Driver</prop> - <prop key="myDs.JdbcUrl">jdbc:mysql://localhost/midastest?createDatabaseIfNotExist=true</prop> - <prop key="myDs.UserName">root</prop> - <prop key="myDs.Password"></prop> - </props> - </property> - </bean> - - <bean id="OrangeUnit" class="org.acme.OrangeUnitFactoryBean"> - <property name="context" ref="OpenEjbContext"> - </bean> - - <bean id="SomePojo" class="org.acme.SomePojo"> - <property name="entityManager" ref="OrangeUnit"> - </bean> - -{info:title=Some more useful info.} -Here is a bunch of links suggested by a user. If anybody has time to go through them and write a doc, that would be great. These links explain how to make available spring components to openejb -http://twasink.net/blog/archives/2007/01/using_spring_wi.html -http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.html -http://wiki.netbeans.org/MavenSpringEJBsOnGlassfish - -{info} - http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/spring-ejb-and-jpa.adoc ---------------------------------------------------------------------- diff --git a/docs/spring-ejb-and-jpa.adoc b/docs/spring-ejb-and-jpa.adoc new file mode 100644 index 0000000..416fa4e --- /dev/null +++ b/docs/spring-ejb-and-jpa.adoc @@ -0,0 +1,195 @@ +# Spring EJB and JPA +:index-group: Spring +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +\{note}OpenEJB 3.1 or later required\{note} This example shows +how to combine Spring, OpenEJB and Hibernate using the integration code +provided by OpenEJB. Here, OpenEJB is used as an embeddable EJB +container inside of Spring. See the link:spring.html[Spring] page for +details. + +We use the basic Movie example and expand it to include more objects to +demonstrate both Spring beans, EJB Session beans, and JPA persistent +objects in one application. The premise of the example is a Cineplex +that has a number of Theaters (viewing screens), each playing a number +of Movies. The basic object layout is as follows: + +Object + +Type + +Description + +http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/CineplexImpl.java[CineplexImpl] + +@Stateless + +Shows the use of @Resource to have Spring beans injected. Specifically, +the _Theaters_ Spring bean + +http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theaters.java[Theaters] + +Spring bean + +Simple wrapper object injected into _CineplexImpl_ + +http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theater.java[Theater] + +Spring bean + +Shows that EJBs can be injected into Spring beans. Uses both the +_Movies_ EJB and the _Movie_ JPA objects + +http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/MoviesImpl.java[MoviesImpl] + +@Stateful + +Wraps a JPA EntityManager and provides transactional access to the +persistent _Movie_ objects + +http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Movie.java[Movie] + +@Entity + +Basic JPA bean that is used both by Spring beans and EJBs. The same +_Movie_ object as in all the other persistence related examples. + +http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/AvailableMovies.java[AvailableMovies] + +Spring bean + +Simple object used as a clever way to seed the EntityManager (and +really, the database) with persistent _Movie_ objects + +# Required jars + +To setup the integration you'll need: + +[arabic] +. The standard OpenEJB 3.1 libraries +. The +https://repository.apache.org/content/groups/public/org/apache/openejb/openejb-spring/3.1.2/openejb-spring-3.1.2.jar[openejb-spring-3.1.jar] +or later +. Spring 2.5 or other (any version should work) + +In Maven2 this can be done by adding the following dependencies to your +pom.xml +\{snippet:id=required|url=openejb3/examples/spring-integration/pom.xml|lang=xml} +For other environments, you can simply link:downloads.html[download an +openejb-3.1.zip] or later and include all the jars under the lib/ +directory in your classpath. Then download and add the +[openejb-spring-3.1.jar|http://people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/openejb/openejb-spring/3.1/openejb-spring-3.1.jar] +along with your Spring jars. + +# The Spring xml + +Bootstrapping and Configuring OpenEJB is fairly simple. +\{snippet:id=bootstrapping|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} +As well, you can optionally declare any resources or containers. +Anything declarable as a or in the openejb.xml can instead be declared +in the Spring xml file as shown here. +\{snippet:id=resources|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} +And finally our Spring beans. +\{snippet:id=pojos|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} +:jbake-title: Don't forget} +\{snippet:id=annotations|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} +It allows various annotations to be detected in bean classes: Spring's +@Required and @Autowired, as well as JSR 250's @PostConstruct, +@PreDestroy and @Resource (if available), JAX-WS's @WebServiceRef (if +available), EJB3's @EJB (if available), and JPA's @PersistenceContext +and @PersistenceUnit (if available). Alternatively, you may choose to +activate the individual BeanPostProcessors for those annotations. +\{note} + +# The Code + +In efforts to keep the example page somewhat short, we'll show just +three beans, each demonstrating a particular relationship. + +The first is the CineplexImpl EJB which shows EJB -> Spring. +\{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/CineplexImpl.java|lang=java} + +The second is the Theater Spring bean which shows Spring -> EJB. +\{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/Theater.java|lang=java} + +The last is the AvailableMovies Spring bean which Shows Spring -> EJB -> +JPA +\{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/AvailableMovies.java|lang=java} + +# The TestCase + +The JUnit TestCase uses a ClassPathXmlApplicationContext to load the +Spring ApplicationContext. Anything that loads your Spring xml file +should work fine. The following code would work a plain java app as +well. + +\{snippet:id=code|url=openejb3/examples/spring-integration/src/test/java/org/superbiz/spring/MoviesTest.java|lang=java} + +# Running + +The source for this example can be downloaded from svn via: + +$ svn co +http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration + +Then, in the "spring-integration" directory, run: + +$ mvn clean install + +Which should create output like the following. + +.... +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running org.superbiz.spring.MoviesTest +log4j:WARN No appenders could be found for logger +.... + +(org.springframework.context.support.ClassPathXmlApplicationContext). +log4j:WARN Please initialize the log4j system properly. Apache OpenEJB +3.1 build: 20081009-03:31 http://tomee.apache.org/ INFO - openejb.home = +/Users/dblevins/work/openejb3/examples/spring-integration INFO - +openejb.base = /Users/dblevins/work/openejb3/examples/spring-integration +INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, +type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) INFO - +Configuring Service(id=MovieDatabase, type=Resource, provider-id=Default +JDBC Database) INFO - Configuring Service(id=MovieDatabaseUnmanaged, +type=Resource, provider-id=Default JDBC Database) INFO - Found EjbModule +in classpath: +/Users/dblevins/work/openejb3/examples/spring-integration/target/classes +INFO - Beginning load: +/Users/dblevins/work/openejb3/examples/spring-integration/target/classes +INFO - Configuring enterprise application: classpath.ear INFO - +Configuring Service(id=Default Stateless Container, type=Container, +provider-id=Default Stateless Container) INFO - Auto-creating a +container for bean CineplexImpl: Container(type=STATELESS, id=Default +Stateless Container) INFO - Auto-linking resource-ref +'org.superbiz.spring.CineplexImpl/theaters' in bean CineplexImpl to +Resource(id=theaters) INFO - Configuring Service(id=Default Stateful +Container, type=Container, provider-id=Default Stateful Container) INFO +- Auto-creating a container for bean Movies: Container(type=STATEFUL, +id=Default Stateful Container) INFO - Configuring +PersistenceUnit(name=movie-unit, +provider=org.hibernate.ejb.HibernatePersistence) INFO - Enterprise +application "classpath.ear" loaded. INFO - Assembling app: classpath.ear +INFO - PersistenceUnit(name=movie-unit, +provider=org.hibernate.ejb.HibernatePersistence) INFO - +Jndi(name=CineplexImplLocal) --> Ejb(deployment-id=CineplexImpl) INFO - +Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies) INFO - Created +Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful +Container) INFO - Created Ejb(deployment-id=CineplexImpl, +ejb-name=CineplexImpl, container=Default Stateless Container) INFO - +Deployed Application(path=classpath.ear) INFO - Exported EJB Movies with +interface org.superbiz.spring.Movies to Spring bean MoviesLocal INFO - +Exported EJB CineplexImpl with interface org.superbiz.spring.Cineplex to +Spring bean CineplexImplLocal Tests run: 1, Failures: 0, Errors: 0, +Skipped: 0, Time elapsed: 3.141 sec + +.... +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 +.... http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/spring-ejb-and-jpa.md ---------------------------------------------------------------------- diff --git a/docs/spring-ejb-and-jpa.md b/docs/spring-ejb-and-jpa.md deleted file mode 100644 index 8b1512b..0000000 --- a/docs/spring-ejb-and-jpa.md +++ /dev/null @@ -1,173 +0,0 @@ -index-group=Spring -type=page -status=published -title=Spring EJB and JPA -~~~~~~ -{note}OpenEJB 3.1 or later required{note} -This example shows how to combine Spring, OpenEJB and Hibernate using the -integration code provided by OpenEJB. Here, OpenEJB is used as an -embeddable EJB container inside of Spring. See the [Spring](spring.html) - page for details. - -We use the basic Movie example and expand it to include more objects to -demonstrate both Spring beans, EJB Session beans, and JPA persistent -objects in one application. The premise of the example is a Cineplex that -has a number of Theaters (viewing screens), each playing a number of -Movies. The basic object layout is as follows: - -<table class="mdtable"> -<tr><th> Object </th><th> Type </th><th> Description </th></tr> -<tr><td> [CineplexImpl](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/CineplexImpl.java) - </td><td> @Stateless </td><td> Shows the use of @Resource to have Spring beans injected. -Specifically, the _Theaters_ Spring bean </td></tr> -<tr><td> [Theaters](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theaters.java) - </td><td> Spring bean </td><td> Simple wrapper object injected into _CineplexImpl_ </td></tr> -<tr><td> [Theater](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theater.java) - </td><td> Spring bean </td><td> Shows that EJBs can be injected into Spring beans. Uses -both the _Movies_ EJB and the _Movie_ JPA objects </td></tr> -<tr><td> [MoviesImpl](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/MoviesImpl.java) - </td><td> @Stateful </td><td> Wraps a JPA EntityManager and provides transactional access -to the persistent _Movie_ objects </td></tr> -<tr><td> [Movie](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Movie.java) - </td><td> @Entity </td><td> Basic JPA bean that is used both by Spring beans and EJBs. -The same _Movie_ object as in all the other persistence related examples. </td></tr> -<tr><td> [AvailableMovies](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/AvailableMovies.java) - </td><td> Spring bean </td><td> Simple object used as a clever way to seed the -EntityManager (and really, the database) with persistent _Movie_ objects </td></tr> -</table> - -<a name="SpringEJBandJPA-Requiredjars"></a> -# Required jars - -To setup the integration you'll need: - -1. The standard OpenEJB 3.1 libraries -1. The [openejb-spring-3.1.jar](https://repository.apache.org/content/groups/public/org/apache/openejb/openejb-spring/3.1.2/openejb-spring-3.1.2.jar) - or later -1. Spring 2.5 or other (any version should work) - -In Maven2 this can be done by adding the following dependencies to your -pom.xml -{snippet:id=required|url=openejb3/examples/spring-integration/pom.xml|lang=xml} -For other environments, you can simply [download an openejb-3.1.zip](downloads.html) - or later and include all the jars under the lib/ directory in your -classpath. Then download and add the [openejb-spring-3.1.jar|http://people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/openejb/openejb-spring/3.1/openejb-spring-3.1.jar] - along with your Spring jars. - -<a name="SpringEJBandJPA-TheSpringxml"></a> -# The Spring xml - -Bootstrapping and Configuring OpenEJB is fairly simple. -{snippet:id=bootstrapping|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -As well, you can optionally declare any resources or containers. Anything -declarable as a <Resource> or <Container> in the openejb.xml can instead be -declared in the Spring xml file as shown here. -{snippet:id=resources|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -And finally our Spring beans. -{snippet:id=pojos|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -{note:title=Don't forget} -{snippet:id=annotations|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -It allows various annotations to be detected in bean classes: Spring's -@Required and @Autowired, as well as JSR 250's @PostConstruct, @PreDestroy -and @Resource (if available), JAX-WS's @WebServiceRef (if available), -EJB3's @EJB (if available), and JPA's @PersistenceContext and -@PersistenceUnit (if available). Alternatively, you may choose to activate -the individual BeanPostProcessors for those annotations. -{note} - -<a name="SpringEJBandJPA-TheCode"></a> -# The Code - -In efforts to keep the example page somewhat short, we'll show just three -beans, each demonstrating a particular relationship. - -The first is the CineplexImpl EJB which shows EJB \-> Spring. -{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/CineplexImpl.java|lang=java} - -The second is the Theater Spring bean which shows Spring \-> EJB. -{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/Theater.java|lang=java} - -The last is the AvailableMovies Spring bean which Shows Spring \-> EJB \-> -JPA -{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/AvailableMovies.java|lang=java} - -<a name="SpringEJBandJPA-TheTestCase"></a> -# The TestCase - -The JUnit TestCase uses a ClassPathXmlApplicationContext to load the Spring -ApplicationContext. Anything that loads your Spring xml file should work -fine. The following code would work a plain java app as well. - -{snippet:id=code|url=openejb3/examples/spring-integration/src/test/java/org/superbiz/spring/MoviesTest.java|lang=java} - -<a name="SpringEJBandJPA-Running"></a> -# Running - -The source for this example can be downloaded from svn via: - -$ svn co [http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration) - -Then, in the "spring-integration" directory, run: - -$ mvn clean install - -Which should create output like the following. - - - ------------------------------------------------------- - T E S T S - ------------------------------------------------------- - Running org.superbiz.spring.MoviesTest - log4j:WARN No appenders could be found for logger -(org.springframework.context.support.ClassPathXmlApplicationContext). - log4j:WARN Please initialize the log4j system properly. - Apache OpenEJB 3.1 build: 20081009-03:31 - http://tomee.apache.org/ - INFO - openejb.home = -/Users/dblevins/work/openejb3/examples/spring-integration - INFO - openejb.base = -/Users/dblevins/work/openejb3/examples/spring-integration - INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, -type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) - INFO - Configuring Service(id=MovieDatabase, type=Resource, -provider-id=Default JDBC Database) - INFO - Configuring Service(id=MovieDatabaseUnmanaged, type=Resource, -provider-id=Default JDBC Database) - INFO - Found EjbModule in classpath: -/Users/dblevins/work/openejb3/examples/spring-integration/target/classes - INFO - Beginning load: -/Users/dblevins/work/openejb3/examples/spring-integration/target/classes - INFO - Configuring enterprise application: classpath.ear - INFO - Configuring Service(id=Default Stateless Container, type=Container, -provider-id=Default Stateless Container) - INFO - Auto-creating a container for bean CineplexImpl: -Container(type=STATELESS, id=Default Stateless Container) - INFO - Auto-linking resource-ref -'org.superbiz.spring.CineplexImpl/theaters' in bean CineplexImpl to -Resource(id=theaters) - INFO - Configuring Service(id=Default Stateful Container, type=Container, -provider-id=Default Stateful Container) - INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, -id=Default Stateful Container) - INFO - Configuring PersistenceUnit(name=movie-unit, -provider=org.hibernate.ejb.HibernatePersistence) - INFO - Enterprise application "classpath.ear" loaded. - INFO - Assembling app: classpath.ear - INFO - PersistenceUnit(name=movie-unit, -provider=org.hibernate.ejb.HibernatePersistence) - INFO - Jndi(name=CineplexImplLocal) --> Ejb(deployment-id=CineplexImpl) - INFO - Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies) - INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default -Stateful Container) - INFO - Created Ejb(deployment-id=CineplexImpl, ejb-name=CineplexImpl, -container=Default Stateless Container) - INFO - Deployed Application(path=classpath.ear) - INFO - Exported EJB Movies with interface org.superbiz.spring.Movies to -Spring bean MoviesLocal - INFO - Exported EJB CineplexImpl with interface -org.superbiz.spring.Cineplex to Spring bean CineplexImplLocal - Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.141 sec - - Results : - - Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/spring.adoc ---------------------------------------------------------------------- diff --git a/docs/spring.adoc b/docs/spring.adoc new file mode 100644 index 0000000..7f2e5b3 --- /dev/null +++ b/docs/spring.adoc @@ -0,0 +1,139 @@ +# Spring +:index-group: Spring +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +\{note} This document and the related feature is considered a prototype +and will change based on user feedback. All comments suggestions +welcome. \{note} + +# Introduction + +The OpenEJB Spring integration makes all Spring defined beans injectable +to Java EE components, and all Java EE components can be injected to +Spring beans. The injection system supports arbitrarily complex nesting +(e.g., Spring bean injected into a Java EE component, which is then +injected into another Spring bean), including: + +* @Resouce injection of any Spring bean into EJB +* Injection of any Java EE resource into a Spring bean, including: ** +EJB 3.0 beans ** EJB 3.1 Singleton Bean ** JDBC Connector ** JMS +Connector ** JMS Queue and Topic ** Generic Java EE Connector (JCA) + +In addition, the OpenEJB Spring integration add support for discovery +and deployment of standard Java EE packages within a Spring context, +including: + +* EAR +* EJB Jar +* Persistence Unit +* RAR + +_Requirements:_ * OpenEJB 3.1+ * Spring X.X * Java 1.5 or 1.6 + +# Spring Beans + +The following beans are usable in any spring xml file. + +Class + +Description + +org.apache.openejb.spring.ClassPathApplication + +Scrapes the classpath for all EJB, RAR, and Persistence applications, +deploys them, and imports them into the current ApplicationContext. All +applications found are treated as one big EAR unless the +_classpathAsEar_ property is set to _false_ + +org.apache.openejb.spring.Application + +Scrapes an individual jar file for EJB, RAR, and Persistence +applications, deploys them, and imports them into the current +ApplicationContext. The 'jarFile' property is required. The application +is treated as it's own self-contained EAR, separate from other uses of +'Application' + +org.apache.openejb.spring.Resource + +Allows an OpenEJB to be declared in the Spring ApplicationContext + +org.apache.openejb.spring.OpenEJBResource + +A FactoryBean that imports a Resource from OpenEJB into the Spring +ApplicationContext. Has the following properties: _type_ such as +javax.sql.DataSource, and _resourceId_. In the future this bean will not +be required and all OpenEJB Resources will automatically be imported +into the Spring ApplicationContext + +org.apache.openejb.spring.BmpContainer + +Allows an OpenEJB BMP to be declared in the Spring ApplicationContext. +Has the following properties: _poolSize_ + +org.apache.openejb.spring.CmpContainer + +Allows an OpenEJB CMP to be declared in the Spring ApplicationContext. + +org.apache.openejb.spring.SingletonContainer + +Allows an OpenEJB Singleton to be declared in the Spring +ApplicationContext. Has the following properties: _accessTimeout_ + +org.apache.openejb.spring.StatefulContainer + +Allows an OpenEJB Stateful to be declared in the Spring +ApplicationContext. Has the following properties: _timeOut_ + +org.apache.openejb.spring.StatelessContainer + +Allows an OpenEJB Stateful to be declared in the Spring +ApplicationContext. Has the following properties: _timeOut_, _poolSize_, +and _strictPooling_ + +org.apache.openejb.spring.MdbContainer + +Allows an OpenEJB Message-Driven to be declared in the Spring +ApplicationContext. Has the following properties: _resourceAdapter_, +_messageListenerInterface_, _activationSpecClass_, and _instanceLimit_ + +org.apache.openejb.spring.EJB + +A FactoryBean that imports an EJB from OpenEJB into the Spring +ApplicationContext. One of these is automatically created for each +interface of each EJB, but explicit use can be nice if you desire to +import an EJB with a specific name. Has the following properties: +_deploymentId_, _interface_ + +# Examples + +See the link:spring-ejb-and-jpa.html[Spring EJB and JPA] page for +example code and a working Spring xml file. + +# \{anchor:problems} Problems? + +If you are having problems with the installation, please send a message +to the OpenEJB users link:mailing-lists.html[mailing list] containing +any error message(s) and the following information: + +* OpenEJB Version +* Spring Version +* Java Version (execute java -version) +* Operating System Type and Version + +# Limitations + +_JavaAgent_ - OpenEJB uses OpenJPA to provide JPA and CMP persistence, +and OpenJPA currently requires a JavaAgent to function properly in a +Java 1.5 environment. OpenJPA does not require a JavaAgent in Java 1.6. +Use Hibernate as your the provider in your persistence.xml files if you +wish to avoid this requirement. + +_EntityManager_ - Having an OpenEJB created EntityManager or +EntityManagerFactory injected into Spring beans is currently not +supported. This will be added to the next release. A small workaround +for this is to use an EJB as a factory by adding a 'getEntityManager' +method an using it as a +http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-class-instance-factory-method[Spring +instance factory method] . http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/spring.md ---------------------------------------------------------------------- diff --git a/docs/spring.md b/docs/spring.md deleted file mode 100644 index a815b74..0000000 --- a/docs/spring.md +++ /dev/null @@ -1,124 +0,0 @@ -index-group=Spring -type=page -status=published -title=Spring -~~~~~~ -{note} -This document and the related feature is considered a prototype and will -change based on user feedback. All comments suggestions welcome. -{note} - -<a name="Spring-Introduction"></a> -# Introduction - -The OpenEJB Spring integration makes all Spring defined beans injectable to -Java EE components, and all Java EE components can be injected to Spring beans. -The injection system supports arbitrarily complex nesting (e.g., Spring -bean injected into a Java EE component, which is then injected into another -Spring bean), including: - - * @Resouce injection of any Spring bean into EJB - * Injection of any Java EE resource into a Spring bean, including: - ** EJB 3.0 beans - ** EJB 3.1 Singleton Bean - ** JDBC Connector - ** JMS Connector - ** JMS Queue and Topic - ** Generic Java EE Connector (JCA) - -In addition, the OpenEJB Spring integration add support for discovery and -deployment of standard Java EE packages within a Spring context, including: - - * EAR - * EJB Jar - * Persistence Unit - * RAR - -*Requirements:* - * OpenEJB 3.1+ - * Spring X.X - * Java 1.5 or 1.6 - -<a name="Spring-SpringBeans"></a> -# Spring Beans - -The following beans are usable in any spring xml file. - -<table class="mdtable"> -<tr><th> Class </th><th> Description </th></tr> -<tr><td> org.apache.openejb.spring.ClassPathApplication </td><td> Scrapes the classpath -for all EJB, RAR, and Persistence applications, deploys them, and imports -them into the current ApplicationContext. All applications found are -treated as one big EAR unless the _classpathAsEar_ property is set to -_false_ </td></tr> -<tr><td> org.apache.openejb.spring.Application </td><td> Scrapes an individual jar file -for EJB, RAR, and Persistence applications, deploys them, and imports them -into the current ApplicationContext. The 'jarFile' property is required. -The application is treated as it's own self-contained EAR, separate from -other uses of 'Application' </td></tr> -<tr><td> org.apache.openejb.spring.Resource </td><td> Allows an OpenEJB <Resource> to be -declared in the Spring ApplicationContext </td></tr> -<tr><td> org.apache.openejb.spring.OpenEJBResource </td><td> A FactoryBean that imports a -Resource from OpenEJB into the Spring ApplicationContext. Has the -following properties: _type_ such as javax.sql.DataSource, and -_resourceId_. In the future this bean will not be required and all OpenEJB -Resources will automatically be imported into the Spring ApplicationContext -</td></tr> -<tr><td> org.apache.openejb.spring.BmpContainer </td><td> Allows an OpenEJB BMP -<Container> to be declared in the Spring ApplicationContext. Has the -following properties: _poolSize_ </td></tr> -<tr><td> org.apache.openejb.spring.CmpContainer </td><td> Allows an OpenEJB CMP -<Container> to be declared in the Spring ApplicationContext. </td></tr> -<tr><td> org.apache.openejb.spring.SingletonContainer </td><td> Allows an OpenEJB -Singleton <Container> to be declared in the Spring ApplicationContext. Has -the following properties: _accessTimeout_ </td></tr> -<tr><td> org.apache.openejb.spring.StatefulContainer </td><td> Allows an OpenEJB Stateful -<Container> to be declared in the Spring ApplicationContext. Has the -following properties: _timeOut_</td></tr> -<tr><td> org.apache.openejb.spring.StatelessContainer </td><td> Allows an OpenEJB Stateful -<Container> to be declared in the Spring ApplicationContext. Has the -following properties: _timeOut_, _poolSize_, and _strictPooling_ </td></tr> -<tr><td> org.apache.openejb.spring.MdbContainer </td><td> Allows an OpenEJB Message-Driven -<Container> to be declared in the Spring ApplicationContext. Has the -following properties: _resourceAdapter_, _messageListenerInterface_, -_activationSpecClass_, and _instanceLimit_ </td></tr> -<tr><td> org.apache.openejb.spring.EJB </td><td> A FactoryBean that imports an EJB from -OpenEJB into the Spring ApplicationContext. One of these is automatically -created for each interface of each EJB, but explicit use can be nice if you -desire to import an EJB with a specific name. Has the following -properties: _deploymentId_, _interface_ </td></tr> -</table> - -<a name="Spring-Examples"></a> -# Examples - -See the [Spring EJB and JPA](spring-ejb-and-jpa.html) - page for example code and a working Spring xml file. - -<a name="Spring-{anchor:problems}Problems?"></a> -# {anchor:problems} Problems? - -If you are having problems with the installation, please send a message to -the OpenEJB users [mailing list](mailing-lists.html) - containing any error message(s) and the following information: - -* OpenEJB Version -* Spring Version -* Java Version (execute java -version) -* Operating System Type and Version - -<a name="Spring-Limitations"></a> -# Limitations - - *JavaAgent* - OpenEJB uses OpenJPA to provide JPA and CMP persistence, and -OpenJPA currently requires a JavaAgent to function properly in a Java 1.5 -environment. OpenJPA does not require a JavaAgent in Java 1.6. Use -Hibernate as your the provider in your persistence.xml files if you wish to -avoid this requirement. - - *EntityManager* - Having an OpenEJB created EntityManager or -EntityManagerFactory injected into Spring beans is currently not supported. - This will be added to the next release. A small workaround for this is to -use an EJB as a factory by adding a 'getEntityManager' method an using it -as a [Spring instance factory method](http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-class-instance-factory-method) -. http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/ssh.adoc ---------------------------------------------------------------------- diff --git a/docs/ssh.adoc b/docs/ssh.adoc new file mode 100644 index 0000000..fd09c95 --- /dev/null +++ b/docs/ssh.adoc @@ -0,0 +1,63 @@ +# SSH +:index-group: Unrevised +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + + +== Connecting To OpenEJB or TomEE Through SSH + +=== Description + +It can be very useful to connect to the server to get some informations. + +=== Solution + +For such a case OpenEJB/TomEE proposes to start with the Java EE server +a SSH server. Currently the security is based on JAAS (see how to +configure JAAS for TomEE for more information about it). + +=== Installation + +Simply extract the openejb-ssh jar in the lib of tomee +(webapps/tomee/lib) or openejb libs (lib folder). Then simply connect +using your JAAS credential. + +Note: you can use the provisioning features of openejb to do this job! + +Then simply activate the service manage: it is done setting the system +property openejb.servicemanager.enabled to true. + +Note: it can be done through the conf/system.properties file. Note2: +please take care to not add space after true (not 'true ' for instance). + +=== OpenEJB SSH Shell + +Once you are connected you get some commands: + +* deploy : deploy an application +* undeploy : undeploy an application +* list: list deployed EJBs +* classloader : print the classloader tree of the app specified by the +id +* jmx : interact with JMX ** jmx list: list mbeans ** jmx get ** jmx set +** jmx invoke ([, ...) +* properties: print server configuration as properties +* script ++ ++ +: execute the following script code using the following language with +the JSR 223 +* script file ++ ++ +: execute the following script using the language (from the extension of +the file) with the JSR 223 +* ls []: list the file in path is specified or in the base of the server +if not +* cat : print a file +* part - : print the part of a file + +Note1: JSR 223 can need to add some jar to openejb/tomee lib folder +(groovy-all for instance to use groovy) Note2: ls, part, cat commands +have to use $home and $base properties to specified the path http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/ssh.md ---------------------------------------------------------------------- diff --git a/docs/ssh.md b/docs/ssh.md deleted file mode 100644 index 88788f4..0000000 --- a/docs/ssh.md +++ /dev/null @@ -1,51 +0,0 @@ -index-group=Unrevised -type=page -status=published -title=SSH -~~~~~~ - -# Connecting To OpenEJB or TomEE Through SSH -## Description - -It can be very useful to connect to the server to get some informations. - -## Solution - -For such a case OpenEJB/TomEE proposes to start with the Java EE server a SSH server. Currently the security -is based on JAAS (see how to configure JAAS for TomEE for more information about it). - -## Installation - -Simply extract the openejb-ssh jar in the lib of tomee (webapps/tomee/lib) or openejb libs (lib folder). -Then simply connect using your JAAS credential. - -Note: you can use the provisioning features of openejb to do this job! - -Then simply activate the service manage: it is done setting the system property -openejb.servicemanager.enabled to true. - -Note: it can be done through the conf/system.properties file. -Note2: please take care to not add space after true (not 'true ' for instance). - -## OpenEJB SSH Shell - -Once you are connected you get some commands: - -* deploy <path>: deploy an application -* undeploy <path>: undeploy an application -* list: list deployed EJBs -* classloader <app id>: print the classloader tree of the app specified by the id -* jmx <operation> <options>: interact with JMX -** jmx list: list mbeans -** jmx get <attribute> <objectname> -** jmx set <attribute> <objectname> <new value> -** jmx invoke <methodname>([<arg1>, ...) <objectname> -* properties: print server configuration as properties -* script <language> <script code>: execute the following script code using the following language with the JSR 223 -* script file <script file>: execute the following script using the language (from the extension of the file) with the JSR 223 -* ls [<path>]: list the file in path is specified or in the base of the server if not -* cat <path>: print a file -* part <start>-<end> <path>: print the part of a file - -Note1: JSR 223 can need to add some jar to openejb/tomee lib folder (groovy-all for instance to use groovy) -Note2: ls, part, cat commands have to use $home and $base properties to specified the path http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/standalone-server.adoc ---------------------------------------------------------------------- diff --git a/docs/standalone-server.adoc b/docs/standalone-server.adoc new file mode 100644 index 0000000..d9c0867 --- /dev/null +++ b/docs/standalone-server.adoc @@ -0,0 +1,24 @@ +:index-group: Unrevised +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + + +NOTE: Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. The +ASF licenses this file to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at . +http://www.apache.org/licenses/LICENSE-2.0 . Unless required by +applicable law or agreed to in writing, software distributed under the +License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for +the specific language governing permissions and limitations under the +License. + +#Links to guide you through OpenEJB-Standalone-Server + +* link:startup.html[Startup] +* link:deploy-tool.html[Deploy Tool] +* link:properties-tool.html[Properties Tool] http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/standalone-server.md ---------------------------------------------------------------------- diff --git a/docs/standalone-server.md b/docs/standalone-server.md deleted file mode 100644 index 4f8963a..0000000 --- a/docs/standalone-server.md +++ /dev/null @@ -1,27 +0,0 @@ -index-group=Unrevised -type=page -status=published -title= -~~~~~~ -Notice: Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - -#Links to guide you through OpenEJB-Standalone-Server - -- [Startup](startup.html) -- [Deploy Tool](deploy-tool.html) -- [Properties Tool](properties-tool.html) http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/startup.adoc ---------------------------------------------------------------------- diff --git a/docs/startup.adoc b/docs/startup.adoc new file mode 100644 index 0000000..8fa8c63 --- /dev/null +++ b/docs/startup.adoc @@ -0,0 +1,267 @@ +:index-group: OpenEJB +Standalone Server +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published +:jbake-title: Startup + +# NAME + +openejb start - OpenEJB Remote Server + +# SYNOPSIS + +openejb start link:#options.html[#options] + +# NOTE + +The OpenEJB Remote Server can be started by running the openejb.bat +script for windows and the openejb script for Linux and other Unix based +OSes. Before running these scripts you need to set the environment +variable _OPENEJB_HOME_ to the path of the directory where you unpacked +the OpenEJB installation. + +From now on we will refer to this directory as and assume that you +unpacked OpenEJB into the directory _C:-3.0_ The startup scripts are +present in the /bin directory. You can set this directory in the system +_PATH_ for starting openejb from the command shell. + +In Windows, the remote server can be executed as follows: + +_C:-3.0> binstart_ + +In UNIX, Linux, or Mac OS X, the deploy tool can be executed as follows: + +`\[user@host openejb-3.0]([email protected]) # ./bin/openejb start` + +Depending on your OpenEJB version, you may need to change execution bits +to make the scripts executable. You can do this with the following +command. + +`\[user@host openejb-3.0]([email protected]) # chmod 755 bin/openejb` + +From here on out, it will be assumed that you know how to execute the +right openejb script for your operating system and commands will appear +in shorthand as show below. + +_openejb start -help_ + +# DESCRIPTION + +Starts OpenEJB as an EJB Server that can be accessed by remote clients +via the OpenEJB Remote Server. + +ALWAYS check your openejb.log file for warnings immediately after +starting the Remote Server. + +OpenEJB issues warnings when it works around a potential problem, +encounters something it didn't expect, or when OpenEJB wants to let you +know something may not work as you expected it. + +OpenEJB itself is configured with the OpenEJB configuration file, which +is extremely simple and self-documenting. This file is located at +c:-3.0.xml. + +# OPTIONS + +| _-D=_ | Specifies a system property passed into OpenEJB at startup. | +| _--admin-bind _ | Sets the host to which the admin service should be +bound.| | _--admin-port _ | Sets the port to which the admin service +should be bound.| | _--conf _ | Sets the OpenEJB configuration to the +specified file. | | _--ejbd-bind _ | Sets the host to which the ejbd +service should be bound. | | _--ejbd-port _ | Sets the port to which the +ejbd service should be bound. | + +| _--examples_ | Show examples of how to use the options. | | -h, +--_help_ | Print this help message. | | _--hsql-bind _ | Sets the host +to which the hsql service should be bound.| | _--hsql-port _ | Sets the +port to which the hsql service should be bound.| | _--httpejbd-bind _ | +Sets the host to which the httpejbd service should be bound.| | +_--httpejbd-port _ | Sets the port to which the httpejbd service should +be bound.| | _--local-copy _ | Instructs the container system to marshal +(ie, copy) all calls between beans. | | _--telnet-bind _ | Sets the host +to which the telnet service should be bound.| | _--telnet-port _ | Sets +the port to which the telnet service should be bound.| | -v, --_version_ +| Print the version. | + +# EXAMPLES + +== Example: Simplest scenario + +_openejb start_ + +That's it. The ejbd will start up and bind to IP 127.0.0.1 and port +4201. + +The following properties would then be used to get an InitialContext +from the Remote Server. + +.... +java.naming.factory.initial = +.... + +org.apache.openejb.client.RemoteInitialContextFactory +java.naming.provider.url = ejbd://127.0.0.1:4201 +java.naming.security.principal = myuser java.naming.security.credentials += mypass + +== Example: --conf=file + +_openejb start --conf=C:-3.0.conf_ + +Sets the openejb.configuration system variable to the file _C:.conf_. +When the server starts up and initializes OpenEJB, this configuration +will be used to assemble the container system and load beans. + +== Example: --local-copy + +The local-copy option controls whether Remote interface arguments and +results are always copied. + +_openejb start --local-copy=true_ (default) + +Remote interface business method arguments and results are always copied +(via serialization), which is compliant with the EJB standard. + +_openejb start --local-copy=false_ + +Remote interface business method arguments and results are copied only +when the client is in a different JVM. Otherwise, they are passed by +reference - as if it were a Local interface. This is faster, of course, +but non-compliant with the EJB standard. + +Local interfaces are not affected; their arguments and results are +passed by reference and never copied. + +== CONFIG OVERRIDE EXAMPLES + +== Example: -D.bind= + +_openejb start -Dejbd.bind=10.45.67.8_ + +This is the most common way to use the EJBd Server Service. The service +will start up and bind to IP 10.45.67.8 and port 4201. The following +properties would then be used to get an InitialContext from the EJBd +Server Service. + +.... + java.naming.factory.initial = +.... + +org.apache.openejb.client.RemoteInitialContextFactory +java.naming.provider.url = ejbd://10.45.67.8:4201 +java.naming.security.principal = myuser java.naming.security.credentials += mypass + +DNS names can also be used. + +_openejb start -Dejbd.bind=myhost.foo.com_ + +The following properties would then be used to get an InitialContext +from the Remote Server. + +.... + java.naming.factory.initial = +.... + +org.apache.openejb.client.RemoteInitialContextFactory +java.naming.provider.url = ejbd://myhost.foo.com:4201 +java.naming.security.principal = myuser java.naming.security.credentials += mypass + +_openejb start -Dtelnet.bind=myhost.foo.com_ + +The following properties would then be used to log into the server via a +telnet client as such: + +_telnet myhost.foo.com 4202_ + +== Example: -D.port= + +_openejb start -Dejbd.port=8765_ + +The server will start up and bind to IP 127.0.0.1 and port 8765. + +The following properties would then be used to get an InitialContext +from the Remote Server. + +.... + java.naming.factory.initial = +.... + +org.apache.openejb.client.RemoteInitialContextFactory +java.naming.provider.url = ejbd://127.0.0.1:8765 +java.naming.security.principal = myuser java.naming.security.credentials += mypass + +_openejb start -Dhttpejbd.port=8888_ + +The server will start up and the EJB over HTTP service will bind to IP +127.0.0.1 and port 8888. + +The following properties would then be used to get an InitialContext +from the HTTP/Remote Server. + +.... + java.naming.factory.initial = +.... + +org.apache.openejb.client.RemoteInitialContextFactory +java.naming.provider.url = http://127.0.0.1:8888/openejb +java.naming.security.principal = myuser java.naming.security.credentials += mypass + +== Example: -D.only_from= + +_openejb start -Dadmin.only_from=192.168.1.12_ + +Adds 192.168.1.12 to the list of IP addresses that are authorized to +shutdown the server or access the server via a telnet client. The host +that this server was started on is always allowed to administer the +server. + +Multiple hosts can be given administrative access to this server by +listing all the host names separated by commas as such: + +_openejb start -Dadmin.only_from=192.168.1.12,joe.foo.com,robert_ + +The first host in the string names the host explicitly using an IP +address (192.168.1.12). + +The second host uses a DNS name (joe.foo.com) to refer to the hosts IP +address. The DNS name will be resolved and the IP will be added to the +admin list. + +The third address refers to a the host by a name (robert)that the +opperating system is able to resolve into a valid IP address. This is +usually done via a hosts file, interal DNS server, or Windows Domain +Server. + +== Example: -D.threads= + +_openejb start -Dejbd.threads=200_ + +Sets the max number of concurrent threads that can enter the EJBd Server +Service to 200. + +== Example: -D.disabled= + +_openejb start -Dtelnet.disabled=true_ + +Prevents the Telnet Server Service from starting when the OpenEJB Server +starts. + +# CONSOLE OUTPUT + +Once you start OpenEJB using the _openejb start_ command the following +output will be seen on the console + +.... +Apache OpenEJB 3.0 build: 20070825-01:10 +http://tomee.apache.org/ +OpenEJB ready. +[OPENEJB:init] +.... + +OpenEJB Remote Server ** Starting Services ** NAME IP PORT httpejbd +0.0.0.0 4204 telnet 0.0.0.0 4202 ejbd 0.0.0.0 4201 hsql 0.0.0.0 9001 +admin thread 0.0.0.0 4200 ------- Ready! http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/startup.md ---------------------------------------------------------------------- diff --git a/docs/startup.md b/docs/startup.md deleted file mode 100644 index c4a92ec..0000000 --- a/docs/startup.md +++ /dev/null @@ -1,296 +0,0 @@ -index-group=OpenEJB Standalone Server -type=page -status=published -title=Startup -~~~~~~ -<a name="Startup-NAME"></a> -# NAME - -openejb start - OpenEJB Remote Server - -<a name="Startup-SYNOPSIS"></a> -# SYNOPSIS - -openejb start [#options](#options.html) - -<a name="Startup-NOTE"></a> -# NOTE - -The OpenEJB Remote Server can be started by running the openejb.bat script -for windows and the openejb script for Linux and other Unix based OSes. -Before running these scripts you need to set the environment variable -_OPENEJB_HOME_ to the path of the directory where you unpacked the OpenEJB -installation. - -From now on we will refer to this directory as <OPENEJB_HOME> and assume -that you unpacked OpenEJB into the directory *C:\openejb-3.0* The startup -scripts are present in the <OPENEJB_HOME>/bin directory. You can set this -directory in the system _PATH_ for starting openejb from the command shell. - -In Windows, the remote server can be executed as follows: - -*C:\openejb-3.0> bin\openejb start* - -In UNIX, Linux, or Mac OS X, the deploy tool can be executed as follows: - -`\[user@host openejb-3.0]([email protected]) -# ./bin/openejb start` - -Depending on your OpenEJB version, you may need to change execution bits to -make the scripts executable. You can do this with the following command. - -`\[user@host openejb-3.0]([email protected]) -# chmod 755 bin/openejb` - -From here on out, it will be assumed that you know how to execute the right -openejb script for your operating system and commands will appear in -shorthand as show below. - -*openejb start -help* - -<a name="Startup-DESCRIPTION"></a> -# DESCRIPTION - -Starts OpenEJB as an EJB Server that can be accessed by remote clients via -the OpenEJB Remote Server. - -ALWAYS check your openejb.log file for warnings immediately after starting -the Remote Server. - -OpenEJB issues warnings when it works around a potential problem, -encounters something it didn't expect, or when OpenEJB wants to let you -know something may not work as you expected it. - -OpenEJB itself is configured with the OpenEJB configuration file, which is -extremely simple and self-documenting. This file is located at -c:\openejb-3.0\conf\openejb.xml. - -<a name="Startup-OPTIONS"></a> -# OPTIONS - - | _-D<name>=<value>_ | Specifies a system property passed -into OpenEJB at startup. | - | _--admin-bind <host>_ | Sets the host to which the admin -service should be bound.| - | _--admin-port <int>_ | Sets the port to which the admin -service should be bound.| - | _--conf <file>_ | Sets the OpenEJB configuration to -the specified file. | - | _--ejbd-bind <host>_ | Sets the host to which the ejbd -service should be bound. | - | _--ejbd-port <int>_ | Sets the port to which the ejbd -service should be bound. | - | _--examples_ | Show examples of how to use the -options. | - | -h, --_help_ | Print this help message. | - | _--hsql-bind <host>_ | Sets the host to which the hsql -service should be bound.| - | _--hsql-port <int>_ | Sets the port to which the hsql -service should be bound.| - | _--httpejbd-bind <host>_ | Sets the host to which the httpejbd -service should be bound.| - | _--httpejbd-port <int>_ | Sets the port to which the httpejbd -service should be bound.| - | _--local-copy <boolean>_ | Instructs the container system to -marshal (ie, copy) all calls between beans. | - | _--telnet-bind <host>_ | Sets the host to which the telnet -service should be bound.| - | _--telnet-port <int>_ | Sets the port to which the telnet -service should be bound.| - | -v, --_version_ | Print the version. | - -<a name="Startup-EXAMPLES"></a> -# EXAMPLES - -<a name="Startup-Example:Simplestscenario"></a> -## Example: Simplest scenario - -*openejb start* - -That's it. The ejbd will start up and bind to IP 127.0.0.1 and port 4201. - -The following properties would then be used to get an InitialContext from -the Remote Server. - - - java.naming.factory.initial = -org.apache.openejb.client.RemoteInitialContextFactory - java.naming.provider.url = ejbd://127.0.0.1:4201 - java.naming.security.principal = myuser - java.naming.security.credentials = mypass - - -<a name="Startup-Example:--conf=file"></a> -## Example: --conf=file - -*openejb start --conf=C:\openejb-3.0\conf\mytest.conf* - - Sets the openejb.configuration system variable to the file -*C:\openejb\conf\mytest.conf*. When the server starts up and initializes -OpenEJB, this configuration will be used to assemble the container system -and load beans. - -<a name="Startup-Example:--local-copy"></a> -## Example: --local-copy - -The local-copy option controls whether Remote interface arguments and -results are always copied. - -*openejb start --local-copy=true* (default) - -Remote interface business method arguments and results are always copied -(via serialization), which is compliant with the EJB standard. - -*openejb start --local-copy=false* - -Remote interface business method arguments and results are copied only when -the client is in a different JVM. Otherwise, they are passed by reference - -as if it were a Local interface. This is faster, of course, but -non-compliant with the EJB standard. - -Local interfaces are not affected; their arguments and results are passed -by reference and never copied. - -<a name="Startup-CONFIGOVERRIDEEXAMPLES"></a> -## CONFIG OVERRIDE EXAMPLES - -<a name="Startup-Example:-D<service>.bind=<address>"></a> -## Example: -D<service>.bind=<address> - - *openejb start -Dejbd.bind=10.45.67.8* - - This is the most common way to use the EJBd Server Service. The service -will start up and bind to IP 10.45.67.8 and port 4201. The following -properties would then be used to get an InitialContext from the EJBd Server -Service. - - - java.naming.factory.initial = -org.apache.openejb.client.RemoteInitialContextFactory - java.naming.provider.url = ejbd://10.45.67.8:4201 - java.naming.security.principal = myuser - java.naming.security.credentials = mypass - - - DNS names can also be used. - - *openejb start -Dejbd.bind=myhost.foo.com* - - The following properties would then be used to get an InitialContext from -the Remote Server. - - - java.naming.factory.initial = -org.apache.openejb.client.RemoteInitialContextFactory - java.naming.provider.url = ejbd://myhost.foo.com:4201 - java.naming.security.principal = myuser - java.naming.security.credentials = mypass - - - *openejb start -Dtelnet.bind=myhost.foo.com* - - The following properties would then be used to log into the server via a -telnet client as such: - - *telnet myhost.foo.com 4202* - - -<a name="Startup-Example:-D<service>.port=<port>"></a> -## Example: -D<service>.port=<port> - - *openejb start -Dejbd.port=8765* - - The server will start up and bind to IP 127.0.0.1 and port 8765. - - The following properties would then be used to get an InitialContext from -the Remote Server. - - - java.naming.factory.initial = -org.apache.openejb.client.RemoteInitialContextFactory - java.naming.provider.url = ejbd://127.0.0.1:8765 - java.naming.security.principal = myuser - java.naming.security.credentials = mypass - - - *openejb start -Dhttpejbd.port=8888* - - The server will start up and the EJB over HTTP service will bind to IP -127.0.0.1 and port 8888. - - The following properties would then be used to get an InitialContext from -the HTTP/Remote Server. - - - java.naming.factory.initial = -org.apache.openejb.client.RemoteInitialContextFactory - java.naming.provider.url = http://127.0.0.1:8888/openejb - java.naming.security.principal = myuser - java.naming.security.credentials = mypass - - -<a name="Startup-Example:-D<service>.only_from=<addresses>"></a> -## Example: -D<service>.only_from=<addresses> - - *openejb start -Dadmin.only_from=192.168.1.12* - - Adds 192.168.1.12 to the list of IP addresses that are authorized to -shutdown the server or access the server - via a telnet client. The host that this server was started on is always -allowed to administer the server. - - Multiple hosts can be given administrative access to this server by -listing all the host names separated - by commas as such: - - *openejb start -Dadmin.only_from=192.168.1.12,joe.foo.com,robert* - - The first host in the string names the host explicitly using an IP address -(192.168.1.12). - - The second host uses a DNS name (joe.foo.com) to refer to the hosts IP -address. The DNS name will be resolved and the IP will be added to the -admin list. - - The third address refers to a the host by a name (robert)that the -opperating system is able to resolve into a valid IP address. This is -usually done via a hosts file, interal DNS server, or Windows Domain -Server. - -<a name="Startup-Example:-D<service>.threads=<max>"></a> -## Example: -D<service>.threads=<max> - - *openejb start -Dejbd.threads=200* - - Sets the max number of concurrent threads that can enter the EJBd Server -Service to 200. - -<a name="Startup-Example:-D<service>.disabled=<true/false>"></a> -## Example: -D<service>.disabled=<true/false> - - *openejb start -Dtelnet.disabled=true* - - Prevents the Telnet Server Service from starting when the OpenEJB Server -starts. - -<a name="Startup-CONSOLEOUTPUT"></a> -# CONSOLE OUTPUT - -Once you start OpenEJB using the *openejb start* command the following -output will be seen on the console - - - Apache OpenEJB 3.0 build: 20070825-01:10 - http://tomee.apache.org/ - OpenEJB ready. - [OPENEJB:init] - OpenEJB Remote Server - ** Starting Services ** - NAME IP PORT - httpejbd 0.0.0.0 4204 - telnet 0.0.0.0 4202 - ejbd 0.0.0.0 4201 - hsql 0.0.0.0 9001 - admin thread 0.0.0.0 4200 - ------- - Ready! http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/statefulcontainer-config.adoc ---------------------------------------------------------------------- diff --git a/docs/statefulcontainer-config.adoc b/docs/statefulcontainer-config.adoc new file mode 100644 index 0000000..c54da1b --- /dev/null +++ b/docs/statefulcontainer-config.adoc @@ -0,0 +1,165 @@ +# StatefulContainer Configuration +:index-group: Unrevised +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + + +A StatefulContainer can be declared via xml in the +`<tomee-home>/conf/tomee.xml` file or in a `WEB-INF/resources.xml` file +using a declaration like the following. All properties in the element +body are optional. + +.... +<Container id="myStatefulContainer" type="STATEFUL"> + accessTimeout = 30 seconds + bulkPassivate = 100 + cache = org.apache.openejb.core.stateful.SimpleCache + capacity = 1000 + frequency = 60 + passivator = org.apache.openejb.core.stateful.SimplePassivater + timeOut = 20 +</Container> +.... + +Alternatively, a StatefulContainer can be declared via properties in the +`<tomee-home>/conf/system.properties` file or via Java VirtualMachine +`-D` properties. The properties can also be used when embedding TomEE +via the `javax.ejb.embeddable.EJBContainer` API or `InitialContext` + +.... +myStatefulContainer = new://Container?type=STATEFUL +myStatefulContainer.accessTimeout = 30 seconds +myStatefulContainer.bulkPassivate = 100 +myStatefulContainer.cache = org.apache.openejb.core.stateful.SimpleCache +myStatefulContainer.capacity = 1000 +myStatefulContainer.frequency = 60 +myStatefulContainer.passivator = org.apache.openejb.core.stateful.SimplePassivater +myStatefulContainer.timeOut = 20 +.... + +Properties and xml can be mixed. Properties will override the xml +allowing for easy configuration change without the need for $\{} style +variable substitution. Properties are not case sensitive. If a property +is specified that is not supported by the declared StatefulContainer a +warning will be logged. If a StatefulContainer is needed by the +application and one is not declared, TomEE will create one dynamically +using default settings. Multiple StatefulContainer declarations are +allowed. # Supported Properties + +Property + +Type + +Default + +Description + +accessTimeout + +time + +30Â seconds + +Specifies the maximum time an invocation could wait for the `@Stateful` +bean instance to become available before giving up. + +bulkPassivate + +int + +100 + +Property name that specifies the number of instances to passivate at one +time when doing bulk passivation. + +cache + +String + +org.apache.openejb.core.stateful.SimpleCache + +The cache is responsible for managing stateful bean instances. The cache +can page instances to disk as memory is filled and can destroy abandoned +instances. A different cache implementation can be used by setting this +property to the fully qualified class name of the Cache implementation. + +capacity + +int + +1000 + +Specifies the size of the bean pools for this stateful SessionBean +container. + +frequency + +int + +60 + +Specifies the frequency (in seconds) at which the bean cache is checked +for idle beans. + +passivator + +String + +org.apache.openejb.core.stateful.SimplePassivater + +The passivator is responsible for writing beans to disk at passivation +time. Different passivators can be used by setting this property to the +fully qualified class name of the `PassivationStrategy` implementation. +The passivator is not responsible for invoking any callbacks or other +processing, its only responsibly is to write the bean state to disk. + +timeOut + +time + +20 + +Specifies the time a bean can be idle before it is removed by the +container. + +== accessTimeout + +Specifies the maximum time an invocation could wait for the `@Stateful` +bean instance to become available before giving up. + +After the timeout is reached a +`javax.ejb.ConcurrentAccessTimeoutException` will be thrown. + +Usable time units: nanoseconds, microsecons, milliseconds, seconds, +minutes, hours, days. Or any combination such as "1 hour and 27 minutes +and 10 seconds" + +Any usage of the `javax.ejb.AccessTimeout` annotation will override this +setting for the bean or method where the annotation is used. + +== passivator + +The passivator is responsible for writing beans to disk at passivation +time. Different passivators can be used by setting this property to the +fully qualified class name of the `PassivationStrategy` implementation. +The passivator is not responsible for invoking any callbacks or other +processing, its only responsibly is to write the bean state to disk. + +Known implementations: + +* org.apache.openejb.core.stateful.RAFPassivater +* org.apache.openejb.core.stateful.SimplePassivater + +== timeOut + +Specifies the time a bean can be idle before it is removed by the +container. + +This value is measured in minutes. A value of 5 would result in a +time-out of 5 minutes between invocations. A value of -1 would mean no +timeout. A value of 0 would mean a bean can be immediately removed by +the container. + +Any usage of the `javax.ejb.StatefulTimeout` annotation will override +this setting for the bean where the annotation is used. http://git-wip-us.apache.org/repos/asf/tomee/blob/de7099c5/docs/statefulcontainer-config.md ---------------------------------------------------------------------- diff --git a/docs/statefulcontainer-config.md b/docs/statefulcontainer-config.md deleted file mode 100644 index ea2668e..0000000 --- a/docs/statefulcontainer-config.md +++ /dev/null @@ -1,160 +0,0 @@ -index-group=Unrevised -type=page -status=published -title=StatefulContainer Configuration -~~~~~~ - - -A StatefulContainer can be declared via xml in the `<tomee-home>/conf/tomee.xml` file or in a `WEB-INF/resources.xml` file using a declaration like the following. All properties in the element body are optional. - - <Container id="myStatefulContainer" type="STATEFUL"> - accessTimeout = 30 seconds - bulkPassivate = 100 - cache = org.apache.openejb.core.stateful.SimpleCache - capacity = 1000 - frequency = 60 - passivator = org.apache.openejb.core.stateful.SimplePassivater - timeOut = 20 - </Container> - -Alternatively, a StatefulContainer can be declared via properties in the `<tomee-home>/conf/system.properties` file or via Java VirtualMachine `-D` properties. The properties can also be used when embedding TomEE via the `javax.ejb.embeddable.EJBContainer` API or `InitialContext` - - myStatefulContainer = new://Container?type=STATEFUL - myStatefulContainer.accessTimeout = 30 seconds - myStatefulContainer.bulkPassivate = 100 - myStatefulContainer.cache = org.apache.openejb.core.stateful.SimpleCache - myStatefulContainer.capacity = 1000 - myStatefulContainer.frequency = 60 - myStatefulContainer.passivator = org.apache.openejb.core.stateful.SimplePassivater - myStatefulContainer.timeOut = 20 - -Properties and xml can be mixed. Properties will override the xml allowing for easy configuration change without the need for ${} style variable substitution. Properties are not case sensitive. If a property is specified that is not supported by the declared StatefulContainer a warning will be logged. If a StatefulContainer is needed by the application and one is not declared, TomEE will create one dynamically using default settings. Multiple StatefulContainer declarations are allowed. -# Supported Properties -<table class="mdtable"> -<tr> -<th>Property</th> -<th>Type</th> -<th>Default</th> -<th>Description</th> -</tr> -<tr> - <td><a href="#accessTimeout">accessTimeout</a></td> - <td><a href="configuring-durations.html">time</a></td> - <td>30 seconds</td> - <td> -Specifies the maximum time an invocation could wait for the -`@Stateful` bean instance to become available before giving up. -</td> -</tr> -<tr> - <td>bulkPassivate</td> - <td>int</td> - <td>100</td> - <td> -Property name that specifies the number of instances -to passivate at one time when doing bulk passivation. -</td> -</tr> -<tr> - <td>cache</td> - <td>String</td> - <td>org.apache.openejb.core.stateful.SimpleCache</td> - <td> -The cache is responsible for managing stateful bean -instances. The cache can page instances to disk as memory -is filled and can destroy abandoned instances. A different -cache implementation can be used by setting this property -to the fully qualified class name of the Cache implementation. -</td> -</tr> -<tr> - <td>capacity</td> - <td>int</td> - <td>1000</td> - <td> -Specifies the size of the bean pools for this -stateful SessionBean container. -</td> -</tr> -<tr> - <td>frequency</td> - <td>int</td> - <td>60</td> - <td> -Specifies the frequency (in seconds) at which the bean cache is checked for -idle beans. -</td> -</tr> -<tr> - <td><a href="#passivator">passivator</a></td> - <td>String</td> - <td>org.apache.openejb.core.stateful.SimplePassivater</td> - <td> -The passivator is responsible for writing beans to disk -at passivation time. Different passivators can be used -by setting this property to the fully qualified class name -of the `PassivationStrategy` implementation. The passivator -is not responsible for invoking any callbacks or other -processing, its only responsibly is to write the bean state -to disk. -</td> -</tr> -<tr> - <td><a href="#timeOut">timeOut</a></td> - <td><a href="configuring-durations.html">time</a></td> - <td>20</td> - <td> -Specifies the time a bean can be idle before it is removed by the container. -</td> -</tr> -</table> - - - -<a name="accessTimeout"></a> -## accessTimeout - -Specifies the maximum time an invocation could wait for the -`@Stateful` bean instance to become available before giving up. - -After the timeout is reached a `javax.ejb.ConcurrentAccessTimeoutException` -will be thrown. - -Usable time units: nanoseconds, microsecons, milliseconds, -seconds, minutes, hours, days. Or any combination such as -"1 hour and 27 minutes and 10 seconds" - -Any usage of the `javax.ejb.AccessTimeout` annotation will -override this setting for the bean or method where the -annotation is used. - - -<a name="passivator"></a> -## passivator - -The passivator is responsible for writing beans to disk -at passivation time. Different passivators can be used -by setting this property to the fully qualified class name -of the `PassivationStrategy` implementation. The passivator -is not responsible for invoking any callbacks or other -processing, its only responsibly is to write the bean state -to disk. - -Known implementations: - -- org.apache.openejb.core.stateful.RAFPassivater -- org.apache.openejb.core.stateful.SimplePassivater - - -<a name="timeOut"></a> -## timeOut - -Specifies the time a bean can be idle before it is removed by the container. - -This value is measured in minutes. A value of 5 would -result in a time-out of 5 minutes between invocations. -A value of -1 would mean no timeout. -A value of 0 would mean a bean can be immediately removed by the container. - -Any usage of the `javax.ejb.StatefulTimeout` annotation will -override this setting for the bean where the annotation is used.
