TOMEE-2316 Convert Markdown files to Asciidoc in the docs folder - 3
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/6972efbb Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/6972efbb Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/6972efbb Branch: refs/heads/master Commit: 6972efbb7428fe10c30e6f271226f902186055bd Parents: 388460f Author: Carlos Chacin <[email protected]> Authored: Wed Dec 5 22:07:19 2018 -0800 Committer: Carlos Chacin <[email protected]> Committed: Wed Dec 5 22:07:19 2018 -0800 ---------------------------------------------------------------------- docs/configuration.adoc | 147 ++++++ docs/configuration.md | 144 ------ docs/configuring-containers-in-tests.adoc | 29 ++ docs/configuring-containers-in-tests.md | 27 -- docs/configuring-datasources-in-tests.adoc | 65 +++ docs/configuring-datasources-in-tests.md | 60 --- docs/configuring-datasources.adoc | 190 ++++++++ docs/configuring-datasources.md | 170 ------- docs/configuring-durations.adoc | 69 +++ docs/configuring-durations.md | 67 --- docs/configuring-javamail.adoc | 42 ++ docs/configuring-javamail.md | 41 -- docs/configuring-logging-in-tests.adoc | 119 +++++ docs/configuring-logging-in-tests.md | 118 ----- docs/configuring-persistenceunits-in-tests.adoc | 157 ++++++ docs/configuring-persistenceunits-in-tests.md | 144 ------ docs/constructor-injection.adoc | 100 ++++ docs/constructor-injection.md | 98 ---- docs/containers-and-resources.adoc | 473 ++++++++++++++++++ docs/containers-and-resources.md | 483 ------------------- docs/contrib/debug/debug-intellij.adoc | 182 +++++++ docs/contrib/debug/debug-intellij.md | 133 ----- docs/custom-injection.adoc | 203 ++++++++ docs/custom-injection.md | 193 -------- 24 files changed, 1776 insertions(+), 1678 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuration.adoc ---------------------------------------------------------------------- diff --git a/docs/configuration.adoc b/docs/configuration.adoc new file mode 100644 index 0000000..2e8bd5a --- /dev/null +++ b/docs/configuration.adoc @@ -0,0 +1,147 @@ +# Configuration +:index-group: Unrevised +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +# Short Overview + +== Configuration Properties + +* _openejb.home_ - OpenEJB home (installation) directory path. All +relative paths are resolved against the property unless openejb.base is +set. Unless set, the value is assigned to the _user.dir_ Java property. +* _openejb.base_ - OpenEJB base directory path. If set, the directory +pointed by the property is searched for resources before openejb.home. +* _openejb.configuration_ - OpenEJB configuration file path. +* _openejb.loader_ - OpenEJB loader that's responsible for loading EJBs. +There are 3 different loader types: + +** _tomcat-webapp_ - set it when inside of Tomcat scoped at just the +webapp, aka. link:collapsed-ear.html[Collapsed EAR] ** _tomcat_ - set it +when inside of Tomcat scoped for all webapps to share ** _system_ (also: +bootstrap) ** _embedded_ (also: noload) +* _openejb.configurator_ (default: +_org.openejb.alt.config.ConfigurationFactory_ ) - a class that builds +org.openejb.alt.assembler.classic.OpenEjbConfiguration object; +implements the +org.openejb.alt.assembler.classic.OpenEjbConfigurationFactory interface +* _openejb.descriptors.output_ - possible values: true|false - When set +OpenEJB saves deployment descriptors - ejb-jar.xml and openejb-jar.xml + +== Configuration File + +Show a config file with the elements hyperlinked. + +.... +<?xml version="1.0"?> +<openejb> + <Container id="Default CMP Container" ctype="CMP_ENTITY"> + Global_TX_Database c:/my/app/conf/postgresql.cmp_global_database.xml + Local_TX_Database c:/my/app/conf/postgresql.cmp_local_database.xml + </Container> + <Connector id="Default JDBC Database"> + JdbcDriver org.postgresql.Driver + JdbcUrl jdbc:postgresql://localhost/mydb + UserName username + Password password + </Connector> + <SecurityService id="Default Security Service"/> + <TransactionService id="Default Transaction Manager"/> + <Deployments jar="c:/my/app/employee.jar"/> + <Deployments dir="beans/" /> +</openejb> +.... + +== Basic Layout + +Basically, openejb.base is the source for 100% of all configuration +information and third party config files (log4j, castor, instantdb, +whatever). This includes finding where the, possibly many, entries in +the openejb.conf point. The openejb.home is where the code loading +OpenEJB will look for all the OpenEJB libraries. Usually openejb.base is +not explicitly set and defaults to the value of openejb.home, so many +people are used to only dealing with openejb.home. + +The point of having and openejb.base and openejb.home was basically to +allow several independently configured instances of OpenEJB running on a +system (perhaps embedded in Swing apps, in Tomcat, running as a +standalone Server, or even in Groovy as Mr. Strachan did!) but without +the need to copy all the OpenEJB system libraries everywhere. + +_openejb.home_ * can be set explicitly via a system property. * if not +set it default's to user.dir, which is the current working directory. + +_openejb.base_ * can be set explicitly via a system property. * If not +set it default's to openejb.home. + +_openejb.configuration_ * can be set to explicitly point to the file +containing your configuration. * If set to a relative path, we first +look in user.dir/your-conf-file, then in openejb.base/your-conf-file * +If not set we check in openejb.base/conf/openejb.conf * If no conf file +is found, we create one in openejb.base/conf/openejb.conf + +_relative paths in openejb.conf_ * Deployment entries are resolved +relative to openejb.base. * Containers use openejb.base to resolve their +own config files. For example, Castor JDO to loads the database.xml and +all other files from the openejb.base directory. * Resource adapters +that are embedded usually have config files of their own and are also +loaded from the openeb.base. + +_log files_ * The log4.configuration file is resolved relative to +openejb.base. * The properties in the config file that point to files +are also resolved relative to openejb.base. + +_OpenEJB libraries_ * The jars in the lib and dist directories under +openejb.home are added to the classpath. + +=== Summary + +A summary of the above in a different notation: + +.... +openejb.home = user.dir (can be set explicitly) +openejb.base = openejb.home (can be set explicitly) +openejb.conf = openejb.base/conf/openejb.conf (can be set explicitly) +logging.conf = openejb.base/conf/logging.conf (can be set explicitly) +deployments = paths listed in openejb.conf (relative paths resolved from openejb.base) +Classpath includes openejb.home/lib and openejb.home/dist +.... + +=== Example layout + +In this one the openejb.home and openejb.base are set, everything else +is defaulted. The openejb.conf file as been updated to point to the ejb +jars by name (abc-ejbs.jar and xyz-ejbs.jar). + +An example layout: + +.... +/usr/local/openejb (openejb.home) +/usr/local/openejb/lib (in classpath) +/usr/local/openejb/dist (in classpath) +/home/jsmith/foo_app (openejb.base) +/home/jsmith/foo_app/conf/openejb.conf +/home/jsmith/foo_app/conf/logging.conf +/home/jsmith/foo_app/abc-ejbs.jar (Deployment entry in openejb.conf) +/home/jsmith/foo_app/xyz-ejbs.jar (Deployment entry in openejb.conf) +/home/jsmith/foo_app/logs/ +.... + +=== Another Example layout + +In this example openejb.home and openejb.base are setup as well as the +explicit paths for the openejb and log4j configuration files. + +An example layout: + +.... +/usr/local/openejb (openejb.home) +/usr/local/openejb/lib (in classpath) +/usr/local/openejb/dist (in classpath) +/home/jsmith/foo_app (openejb.base) +/home/jsmith/foo_app/openejb.xml (openejb.configuration) +/home/jsmith/foo_app/abc-ejbs.jar (Deployment entry in openejb.xml) +/home/jsmith/foo_app/xyz-ejbs.jar (Deployment entry in openejb.xml) +/home/jsmith/foo_app/log4j.conf (log4j.configuration) +/home/jsmith/foo_app/mylogs/ (logging dir as defined in log4j.conf) +.... http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuration.md ---------------------------------------------------------------------- diff --git a/docs/configuration.md b/docs/configuration.md deleted file mode 100644 index ff78f5f..0000000 --- a/docs/configuration.md +++ /dev/null @@ -1,144 +0,0 @@ -index-group=Unrevised -type=page -status=published -title=Configuration -~~~~~~ -<a name="Configuration-ShortOverview"></a> -# Short Overview - -<a name="Configuration-ConfigurationProperties"></a> -## Configuration Properties - -* _openejb.home_ - OpenEJB home (installation) directory path. All relative paths are resolved against the property unless openejb.base is set. Unless set, the value is assigned to the _user.dir_ Java property. -* _openejb.base_ - OpenEJB base directory path. If set, the directory pointed by the property is searched for resources before openejb.home. -* _openejb.configuration_ - OpenEJB configuration file path. -* _openejb.loader_ - OpenEJB loader that's responsible for loading EJBs. There are 3 different loader types: -** _tomcat-webapp_ - set it when inside of Tomcat scoped at just the webapp, aka. [Collapsed EAR](collapsed-ear.html) -** _tomcat_ - set it when inside of Tomcat scoped for all webapps to share -** _system_ (also: bootstrap) -** _embedded_ (also: noload) -* _openejb.configurator_ (default: _org.openejb.alt.config.ConfigurationFactory_ ) - a class that builds org.openejb.alt.assembler.classic.OpenEjbConfiguration object; implements the org.openejb.alt.assembler.classic.OpenEjbConfigurationFactory interface -* _openejb.descriptors.output_ - possible values: true|false - When set OpenEJB saves deployment descriptors - ejb-jar.xml and openejb-jar.xml - -<a name="Configuration-ConfigurationFile"></a> -## Configuration File - -Show a config file with the elements hyperlinked. - - <?xml version="1.0"?> - <openejb> - <Container id="Default CMP Container" ctype="CMP_ENTITY"> - Global_TX_Database c:/my/app/conf/postgresql.cmp_global_database.xml - Local_TX_Database c:/my/app/conf/postgresql.cmp_local_database.xml - </Container> - <Connector id="Default JDBC Database"> - JdbcDriver org.postgresql.Driver - JdbcUrl jdbc:postgresql://localhost/mydb - UserName username - Password password - </Connector> - <SecurityService id="Default Security Service"/> - <TransactionService id="Default Transaction Manager"/> - <Deployments jar="c:/my/app/employee.jar"/> - <Deployments dir="beans/" /> - </openejb> - - -# Basic Layout - -Basically, openejb.base is the source for 100% of all configuration -information and third party config files (log4j, castor, instantdb, -whatever). This includes finding where the, possibly many, <Deployment> -entries in the openejb.conf point. The openejb.home is where the code -loading OpenEJB will look for all the OpenEJB libraries. Usually -openejb.base is not explicitly set and defaults to the value of -openejb.home, so many people are used to only dealing with openejb.home. - -The point of having and openejb.base and openejb.home was basically to -allow several independently configured instances of OpenEJB running on a -system (perhaps embedded in Swing apps, in Tomcat, running as a standalone -Server, or even in Groovy as Mr. Strachan did!) but without the need to -copy all the OpenEJB system libraries everywhere. - - *openejb.home* - * can be set explicitly via a system property. - * if not set it default's to user.dir, which is the current working - directory. - - *openejb.base* - * can be set explicitly via a system property. - * If not set it default's to openejb.home. - - *openejb.configuration* - * can be set to explicitly point to the file containing your - configuration. - * If set to a relative path, we first look in user.dir/your-conf-file, - then in openejb.base/your-conf-file - * If not set we check in openejb.base/conf/openejb.conf - * If no conf file is found, we create one in - openejb.base/conf/openejb.conf - - - *relative paths in openejb.conf* - * Deployment entries are resolved relative to openejb.base. - * Containers use openejb.base to resolve their own config files. For - example, Castor JDO to loads the database.xml and all other files from the - openejb.base directory. - * Resource adapters that are embedded usually have config files of their - own and are also loaded from the openeb.base. - - *log files* - * The log4.configuration file is resolved relative to openejb.base. - * The properties in the config file that point to files are also resolved - relative to openejb.base. - - *OpenEJB libraries* - * The jars in the lib and dist directories under openejb.home are added -to the classpath. - -## Summary - -A summary of the above in a different notation: - - openejb.home = user.dir (can be set explicitly) - openejb.base = openejb.home (can be set explicitly) - openejb.conf = openejb.base/conf/openejb.conf (can be set explicitly) - logging.conf = openejb.base/conf/logging.conf (can be set explicitly) - deployments = paths listed in openejb.conf (relative paths resolved from openejb.base) - Classpath includes openejb.home/lib and openejb.home/dist - -## Example layout - -In this one the openejb.home and openejb.base are set, everything else is -defaulted. The openejb.conf file as been updated to point to the ejb jars -by name (abc-ejbs.jar and xyz-ejbs.jar). - -An example layout: - - /usr/local/openejb (openejb.home) - /usr/local/openejb/lib (in classpath) - /usr/local/openejb/dist (in classpath) - /home/jsmith/foo_app (openejb.base) - /home/jsmith/foo_app/conf/openejb.conf - /home/jsmith/foo_app/conf/logging.conf - /home/jsmith/foo_app/abc-ejbs.jar (Deployment entry in openejb.conf) - /home/jsmith/foo_app/xyz-ejbs.jar (Deployment entry in openejb.conf) - /home/jsmith/foo_app/logs/ - - -## Another Example layout - -In this example openejb.home and openejb.base are setup as well as the -explicit paths for the openejb and log4j configuration files. - -An example layout: - - /usr/local/openejb (openejb.home) - /usr/local/openejb/lib (in classpath) - /usr/local/openejb/dist (in classpath) - /home/jsmith/foo_app (openejb.base) - /home/jsmith/foo_app/openejb.xml (openejb.configuration) - /home/jsmith/foo_app/abc-ejbs.jar (Deployment entry in openejb.xml) - /home/jsmith/foo_app/xyz-ejbs.jar (Deployment entry in openejb.xml) - /home/jsmith/foo_app/log4j.conf (log4j.configuration) - /home/jsmith/foo_app/mylogs/ (logging dir as defined in log4j.conf) http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-containers-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-containers-in-tests.adoc b/docs/configuring-containers-in-tests.adoc new file mode 100644 index 0000000..b288c81 --- /dev/null +++ b/docs/configuring-containers-in-tests.adoc @@ -0,0 +1,29 @@ +# Configuring Containers in Tests +:index-group: Testing Techniques +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +Like Resources, Containers +can also be declared via InitialContext properties as well. The most +useful is to declare a Stateful SessionBean container so that it's +guaranteed to passivate and activate on each call to the bean, allowing +you to test your callbacks behave as you need them to. + +.... +Properties p = new Properties(); +p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + +p.put("myStatefulContainer", "new://Container?type=STATEFUL"); +p.put("myStatefulContainer.PoolSize", "0"); +p.put("myStatefulContainer.BulkPassivate", "1"); + +Context context = new InitialContext(p); +.... + +Note, this only works when using the LocalInitialContextFactory to embed +OpenEJB into the vm. Once embedded, further configuration properties are +ignored. + +See link:containers-and-resources.html[Containers and Resources] for a +full list of supported Resource types and their properties. http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-containers-in-tests.md ---------------------------------------------------------------------- diff --git a/docs/configuring-containers-in-tests.md b/docs/configuring-containers-in-tests.md deleted file mode 100644 index dc1c56c..0000000 --- a/docs/configuring-containers-in-tests.md +++ /dev/null @@ -1,27 +0,0 @@ -index-group=Testing Techniques -type=page -status=published -title=Configuring Containers in Tests -~~~~~~ -Like Resources, Containers can also be declared via InitialContext -properties as well. The most useful is to declare a Stateful SessionBean -container so that it's guaranteed to passivate and activate on each call to -the bean, allowing you to test your callbacks behave as you need them to. - - - Properties p = new Properties(); - p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); - - p.put("myStatefulContainer", "new://Container?type=STATEFUL"); - p.put("myStatefulContainer.PoolSize", "0"); - p.put("myStatefulContainer.BulkPassivate", "1"); - - Context context = new InitialContext(p); - - -Note, this only works when using the LocalInitialContextFactory to embed -OpenEJB into the vm. Once embedded, further configuration properties are -ignored. - -See [Containers and Resources](containers-and-resources.html) - for a full list of supported Resource types and their properties. http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-datasources-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-datasources-in-tests.adoc b/docs/configuring-datasources-in-tests.adoc new file mode 100644 index 0000000..45210e4 --- /dev/null +++ b/docs/configuring-datasources-in-tests.adoc @@ -0,0 +1,65 @@ +# Configuring DataSources in Tests +:index-group: Testing Techniques +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +# InitialContext +properties + +You can configure data sources from within your test case (avoiding the +need for an `openejb.xml` entirely) like so: + +.... +Properties p = new Properties(); +p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + +p.put("myDataSource", "new://Resource?type=DataSource"); +p.put("myDataSource.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); +p.put("myDataSource.JdbcUrl", "jdbc:derby:derbyDB;create=true"); +p.put("myDataSource.JtaManaged", "true"); + +Context context = new InitialContext(p); +.... + +Under certain circumstances it may be necessary to load two versions of +the same driver. This is possible by definition of a classpath for the +resource which points to the specific driver files required for the +DataSource: + +.... +p.put("myDataSourceOne", "new://Resource?type=DataSource&classpath=/path/to/driverVersionOne.jar"); +p.put("myDataSourceOne.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); +p.put("myDataSource.JdbcUrl", "jdbc:derby:myDatabaseOne;create=true"); +.... +p.put("myDataSourceTwo", "new://Resource?type=DataSource&classpath=/path/to/driverVersionTwo.jar"); +p.put("myDataSourceTwo.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); +p.put("myDataSource.JdbcUrl", "jdbc:derby:myDatabaseTwo;create=true"); +.... + +This will allow an application to communicate through legacy drivers to +the same JDBC provider. + +See link:embedded-configuration.html[Embedded Configuration] for further +details on properties and overrides. + +See link:containers-and-resources.html[Containers and Resources] for a +full list of supported Resource types and their properties. + +== Note on <jta-data-source> and <non-jta-data-source> + +When configuring DataSources to be used by persistence.xml files, the +DataSource supplied for `<jta-data-source>` is typically identical to +the `<non-jta-data-source>`, but with the `JtaManaged` property set +differently. Keeping with our philosophy to free you up from redundant +configuration, we will happily auto-create a missing jta-data-source or +non-jta-data-source based upon the supplied DataSource. + +In the example above, a new DataSource would be generated as an exact +copy but with the name "myDataSourceUnmanaged" and its `JtaManaged` flag +set to `false`. If the supplied DataSource was not `JtaManaged`, then +the generated DataSource would be called "myDataSourceJta" and have its +`JtaManaged` flag set to `true`. + +When relying on this functionality it is not necessary to specify the +name of the generated DataSource in the `persistence.xml` file. http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-datasources-in-tests.md ---------------------------------------------------------------------- diff --git a/docs/configuring-datasources-in-tests.md b/docs/configuring-datasources-in-tests.md deleted file mode 100644 index 0a45c54..0000000 --- a/docs/configuring-datasources-in-tests.md +++ /dev/null @@ -1,60 +0,0 @@ -index-group=Testing Techniques -type=page -status=published -title=Configuring DataSources in Tests -~~~~~~ -<a name="ConfiguringDataSourcesinTests-InitialContextproperties"></a> -# InitialContext properties - -You can configure data sources from within your test case (avoiding the -need for an `openejb.xml` entirely) like so: - - - Properties p = new Properties(); - p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); - - p.put("myDataSource", "new://Resource?type=DataSource"); - p.put("myDataSource.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); - p.put("myDataSource.JdbcUrl", "jdbc:derby:derbyDB;create=true"); - p.put("myDataSource.JtaManaged", "true"); - - Context context = new InitialContext(p); - -Under certain circumstances it may be necessary to load two versions of the same driver. -This is possible by definition of a classpath for the resource which points to the -specific driver files required for the DataSource: - - p.put("myDataSourceOne", "new://Resource?type=DataSource&classpath=/path/to/driverVersionOne.jar"); - p.put("myDataSourceOne.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); - p.put("myDataSource.JdbcUrl", "jdbc:derby:myDatabaseOne;create=true"); - .... - p.put("myDataSourceTwo", "new://Resource?type=DataSource&classpath=/path/to/driverVersionTwo.jar"); - p.put("myDataSourceTwo.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); - p.put("myDataSource.JdbcUrl", "jdbc:derby:myDatabaseTwo;create=true"); - -This will allow an application to communicate through legacy drivers to the same JDBC provider. - -See [Embedded Configuration](embedded-configuration.html) - for further details on properties and overrides. - -See [Containers and Resources](containers-and-resources.html) - for a full list of supported Resource types and their properties. - -<a name="ConfiguringDataSourcesinTests-Noteon<jta-data-source>and<non-jta-data-source>"></a> -## Note on <jta-data-source> and <non-jta-data-source> - -When configuring DataSources to be used by persistence.xml files, the -DataSource supplied for `<jta-data-source>` is typically identical to the -`<non-jta-data-source>`, but with the `JtaManaged` property set differently. -Keeping with our philosophy to free you up from redundant configuration, we -will happily auto-create a missing jta-data-source or non-jta-data-source -based upon the supplied DataSource. - -In the example above, a new DataSource would be generated as an exact copy -but with the name "myDataSourceUnmanaged" and its `JtaManaged` flag set to -`false`. If the supplied DataSource was not `JtaManaged`, then the generated -DataSource would be called "myDataSourceJta" and have its `JtaManaged` flag -set to `true`. - -When relying on this functionality it is not necessary to specify the name -of the generated DataSource in the `persistence.xml` file. http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-datasources.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-datasources.adoc b/docs/configuring-datasources.adoc new file mode 100644 index 0000000..d490067 --- /dev/null +++ b/docs/configuring-datasources.adoc @@ -0,0 +1,190 @@ +# Configuring DataSources in tomee.xml +:index-group: Configuration +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + + +The __ element is used to configure a _javax.sql.DataSource_. It is also +used to configure other resources like Timers, Topics, Queues. We will +see some examples of using to configure a DataSource. + +The element is designed after @Resource annotation and has similar +attributes. + +For example, this annotation in your bean: + +.... +@Resource(name = "myDerbyDatasource", type = javax.sql.DataSource.class) +.... + +Would map to a Resource declared in your openejb.xml as follows: + +.... +<Resource id="myDerbyDatasource" type="javax.sql.DataSource"> + . . . . +<Resource> +.... + +Note that in the xml element, the _type_ value of _javax.sql.DataSource_ +can abbreviated to just _DataSource_ as follows: + +.... +<Resource id="myDerbyDatasource" type="DataSource"> + . . . . +<Resource> +.... + +It is also possible to specify the path to the driver jar file using a +classpath attribute like so: + +.... +<Resource id="myDerbyDatasource" type="DataSource" classpath="/path/to/driver.jar"> + . . . . +<Resource> +.... + +...Or in a http://maven.apache.org/[Maven] environment like so: + +.... +<Resource id="myDerbyDatasource" type="DataSource" classpath="mvn:org.apache.derby:derby:10.10.1.1"> + . . . . +<Resource> +.... + +See link:containers-and-resources.html[Containers and Resources] for a +complete list of supported DataSource properties. + +See link:datasource-password-encryption.html[DataSource Password +Encryption] for information on specifying non-plain-text database +passwords in your openejb.xml file. + +See link:common-datasource-configurations.html[Common DataSource +Configurations] for a list of the commonly used databases and their +driver configurations. + +See link:datasource-configuration-by-creator.html[DataSource +Configuration by Creator] for a list of the different properties +supported for each data source creator. + +You may also need data partitioning per customer or depending on any +other business criteria. That's also an available feature. See +link:dynamic-datasource.html[Dynamic Datasource] for more details. + +== JNDI names for configured DataSources + +=== Example 1 + +.... +<Resource id="Default JDBC Database" type="DataSource"> + . . . . . +</Resource> +.... + +The global jndi name would be _java:openejb/Resource/Default JDBC +Database_ + +=== Example 2 + +.... +<Resource id="Derby Database" type="DataSource"> + . . . . . +</Resource> +.... + +The global jndi name would be _java:openejb/Resource/Derby Database_ + +== Obtaining a DataSource + +DataSource references in your ejb should get automatically mapped to the +Resource you declare. The shortest and easiest rule is that _if your +reference name matches a Resource in your openejb.xml, that's the one +you get_. Essentially, the rules for mapping are as follows. + +[arabic] +. Name Attribute Match - @Resource with a name attribute matching the +resource name gets that resource injected +. Injected Name Match - variable name matching the resource name gets +that resource injected +. No Match - nothing matches a resource name, so the first resource +available gets injected + +There are various ways one could obtain a DataSource now. Lets take an +example of Derby. + +With a Resource declaration in your openejb.xml like this: + +.... +<Resource id="myDerbyDatabase" type="DataSource"> + . . . . . +</Resource> +.... + +There are several possible ways to refer to it, as follows. + +_BY matching variable name to resource name_ + +.... +@Stateless +public class FooBean { + @Resource DataSource myDerbyDatabase; +} +.... + +_OR BY matching name_ + +.... +@Stateless +public class FooBean { + @Resource(name="myDerbyDatabase") + DataSource dataSource; +} +.... + +_OR BY JNDI lookup_ + +.... +@Resource(name="myDerbyDatabase", type=javax.sql.DataSource.class) +@Stateless +public class FooBean { + + public void setSessionContext(SessionContext sessionContext) { + DataSource dataSource = (DataSource) + sessionContext.lookup("myDerbyDatabase"); + } + + public void someOtherMethod() throws Exception { + InitialContext initialContext = new InitialContext(); + DataSource dataSource = (DataSource) + initialContext.lookup("java:comp/env/myDerbyDatabase"); + } +} +.... + +_OR_ + +.... +<resource-ref> + <res-ref-name>myDerbyDatabase</res-ref-name> + <res-type>javax.sql.DataSource</res-type> +</resource-ref> +.... + +_OR_ + +.... +<resource-ref> + <res-ref-name>jdbc/myDerbyDatabase</res-ref-name> + <res-type>javax.sql.DataSource</res-type> +</resource-ref> +.... + +_OR_ + +.... +<resource-ref> + <res-ref-name>someOtherName</res-ref-name> + <res-type>javax.sql.DataSource</res-type> + <mapped-name>myDerbyDatabase</mapped-name> +</resource-ref> +.... http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-datasources.md ---------------------------------------------------------------------- diff --git a/docs/configuring-datasources.md b/docs/configuring-datasources.md deleted file mode 100644 index a63ab85..0000000 --- a/docs/configuring-datasources.md +++ /dev/null @@ -1,170 +0,0 @@ -index-group=Configuration -type=page -status=published -title=Configuring DataSources in tomee.xml -~~~~~~ - -<a name="ConfiguringDataSources-ConfiguringDataSourcesinopenejb.xml"></a> - - -The *<Resource>* element is used to configure a *javax.sql.DataSource*. It -is also used to configure other resources like Timers, Topics, Queues. We -will see some examples of using <Resource> to configure a DataSource. - -The <Resource> element is designed after @Resource annotation and has -similar attributes. - -For example, this annotation in your bean: - - @Resource(name = "myDerbyDatasource", type = javax.sql.DataSource.class) - - -Would map to a Resource declared in your openejb.xml as follows: - - <Resource id="myDerbyDatasource" type="javax.sql.DataSource"> - . . . . - <Resource> - - -Note that in the xml element, the _type_ value of _javax.sql.DataSource_ -can abbreviated to just _DataSource_ as follows: - - <Resource id="myDerbyDatasource" type="DataSource"> - . . . . - <Resource> - -It is also possible to specify the path to the driver jar file using a classpath attribute like so: - - <Resource id="myDerbyDatasource" type="DataSource" classpath="/path/to/driver.jar"> - . . . . - <Resource> - -...Or in a [Maven](http://maven.apache.org/) environment like so: - - <Resource id="myDerbyDatasource" type="DataSource" classpath="mvn:org.apache.derby:derby:10.10.1.1"> - . . . . - <Resource> - -See [Containers and Resources](containers-and-resources.html) - for a complete list of supported DataSource properties. - -See [DataSource Password Encryption](datasource-password-encryption.html) - for information on specifying non-plain-text database passwords in your openejb.xml file. - -See [Common DataSource Configurations](common-datasource-configurations.html) - for a list of the commonly used databases and their driver configurations. - -See [DataSource Configuration by Creator](datasource-configuration-by-creator.html) - for a list of the different properties supported for each data source creator. - -You may also need data partitioning per customer or depending on any other -business criteria. That's also an available feature. See [Dynamic Datasource](dynamic-datasource.html) for more details. - -<a name="ConfiguringDataSources-JNDInamesforconfiguredDataSources"></a> -## JNDI names for configured DataSources - -<a name="ConfiguringDataSources-Example1"></a> -### Example 1 - - - <Resource id="Default JDBC Database" type="DataSource"> - . . . . . - </Resource> - -The global jndi name would be *java:openejb/Resource/Default JDBC Database* - -<a name="ConfiguringDataSources-Example2"></a> -### Example 2 - - - <Resource id="Derby Database" type="DataSource"> - . . . . . - </Resource> - -The global jndi name would be *java:openejb/Resource/Derby Database* - -<a name="ConfiguringDataSources-ObtainingaDataSource"></a> -## Obtaining a DataSource - -DataSource references in your ejb should get automatically mapped to the -Resource you declare. The shortest and easiest rule is that *if your -reference name matches a Resource in your openejb.xml, that's the one you -get*. Essentially, the rules for mapping are as follows. - -1. Name Attribute Match - @Resource with a name attribute matching the -resource name gets that resource injected -1. Injected Name Match - variable name matching the resource name gets that -resource injected -1. No Match - nothing matches a resource name, so the first resource -available gets injected - - -There are various ways one could obtain a DataSource now. Lets take an -example of Derby. - -With a Resource declaration in your openejb.xml like this: - - - <Resource id="myDerbyDatabase" type="DataSource"> - . . . . . - </Resource> - -There are several possible ways to refer to it, as follows. - - -*BY matching variable name to resource name* - - @Stateless - public class FooBean { - @Resource DataSource myDerbyDatabase; - } - - -*OR BY matching name* - - @Stateless - public class FooBean { - @Resource(name="myDerbyDatabase") - DataSource dataSource; - } - - -*OR BY JNDI lookup* - - @Resource(name="myDerbyDatabase", type=javax.sql.DataSource.class) - @Stateless - public class FooBean { - - public void setSessionContext(SessionContext sessionContext) { - DataSource dataSource = (DataSource) - sessionContext.lookup("myDerbyDatabase"); - } - - public void someOtherMethod() throws Exception { - InitialContext initialContext = new InitialContext(); - DataSource dataSource = (DataSource) - initialContext.lookup("java:comp/env/myDerbyDatabase"); - } - } - -*OR* - - <resource-ref> - <res-ref-name>myDerbyDatabase</res-ref-name> - <res-type>javax.sql.DataSource</res-type> - </resource-ref> - -*OR* - - <resource-ref> - <res-ref-name>jdbc/myDerbyDatabase</res-ref-name> - <res-type>javax.sql.DataSource</res-type> - </resource-ref> - -*OR* - - <resource-ref> - <res-ref-name>someOtherName</res-ref-name> - <res-type>javax.sql.DataSource</res-type> - <mapped-name>myDerbyDatabase</mapped-name> - </resource-ref> http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-durations.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-durations.adoc b/docs/configuring-durations.adoc new file mode 100644 index 0000000..cacfb7a --- /dev/null +++ b/docs/configuring-durations.adoc @@ -0,0 +1,69 @@ +# Configuring Durations +:index-group: Unrevised +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +The time based configuration properties of containers +and beans support plain english, such as: + +* "1 hour" +* "27 minutes" +* "10 seconds" + +For convenience it is possible to specify a _compound_ form, such as: + +* "3 days and 2 hours" +* "1 hour, 45 minutes" +* "15 minutes, 23 seconds, and 10 milliseconds" + +Spaces are also optional between the number and the time unit, which can +be nice when using the abbreviated forms: + +* "1hr" +* "27m" +* "10s" +* "3d and 2hr" +* "1hr, 45min" +* "15m, 23s, and 10ms" + +Abbreviations are accepted as follows: + +.... + if (u.equalsIgnoreCase("NANOSECONDS")) return TimeUnit.NANOSECONDS; + if (u.equalsIgnoreCase("NANOSECOND")) return TimeUnit.NANOSECONDS; + if (u.equalsIgnoreCase("NANOS")) return TimeUnit.NANOSECONDS; + if (u.equalsIgnoreCase("NANO")) return TimeUnit.NANOSECONDS; + if (u.equalsIgnoreCase("NS")) return TimeUnit.NANOSECONDS; + + if (u.equalsIgnoreCase("MICROSECONDS")) return TimeUnit.MICROSECONDS; + if (u.equalsIgnoreCase("MICROSECOND")) return TimeUnit.MICROSECONDS; + if (u.equalsIgnoreCase("MICROS")) return TimeUnit.MICROSECONDS; + if (u.equalsIgnoreCase("MICRO")) return TimeUnit.MICROSECONDS; + + if (u.equalsIgnoreCase("MILLISECONDS")) return TimeUnit.MILLISECONDS; + if (u.equalsIgnoreCase("MILLISECOND")) return TimeUnit.MILLISECONDS; + if (u.equalsIgnoreCase("MILLIS")) return TimeUnit.MILLISECONDS; + if (u.equalsIgnoreCase("MILLI")) return TimeUnit.MILLISECONDS; + if (u.equalsIgnoreCase("MS")) return TimeUnit.MILLISECONDS; + + if (u.equalsIgnoreCase("SECONDS")) return TimeUnit.SECONDS; + if (u.equalsIgnoreCase("SECOND")) return TimeUnit.SECONDS; + if (u.equalsIgnoreCase("SEC")) return TimeUnit.SECONDS; + if (u.equalsIgnoreCase("S")) return TimeUnit.SECONDS; + + if (u.equalsIgnoreCase("MINUTES")) return TimeUnit.MINUTES; + if (u.equalsIgnoreCase("MINUTE")) return TimeUnit.MINUTES; + if (u.equalsIgnoreCase("MIN")) return TimeUnit.MINUTES; + if (u.equalsIgnoreCase("M")) return TimeUnit.MINUTES; + + if (u.equalsIgnoreCase("HOURS")) return TimeUnit.HOURS; + if (u.equalsIgnoreCase("HOUR")) return TimeUnit.HOURS; + if (u.equalsIgnoreCase("HRS")) return TimeUnit.HOURS; + if (u.equalsIgnoreCase("HR")) return TimeUnit.HOURS; + if (u.equalsIgnoreCase("H")) return TimeUnit.HOURS; + + if (u.equalsIgnoreCase("DAYS")) return TimeUnit.DAYS; + if (u.equalsIgnoreCase("DAY")) return TimeUnit.DAYS; + if (u.equalsIgnoreCase("D")) return TimeUnit.DAYS; +.... http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-durations.md ---------------------------------------------------------------------- diff --git a/docs/configuring-durations.md b/docs/configuring-durations.md deleted file mode 100644 index 8c93e66..0000000 --- a/docs/configuring-durations.md +++ /dev/null @@ -1,67 +0,0 @@ -index-group=Unrevised -type=page -status=published -title=Configuring Durations -~~~~~~ -The time based configuration properties of containers and beans support -plain english, such as: - - - "1 hour" - - "27 minutes" - - "10 seconds" - -For convenience it is possible to specify a _compound_ form, such as: - - - "3 days and 2 hours" - - "1 hour, 45 minutes" - - "15 minutes, 23 seconds, and 10 milliseconds" - -Spaces are also optional between the number and the time unit, which can be nice when using the abbreviated forms: - - - "1hr" - - "27m" - - "10s" - - "3d and 2hr" - - "1hr, 45min" - - "15m, 23s, and 10ms" - - -Abbreviations are accepted as follows: - - - if (u.equalsIgnoreCase("NANOSECONDS")) return TimeUnit.NANOSECONDS; - if (u.equalsIgnoreCase("NANOSECOND")) return TimeUnit.NANOSECONDS; - if (u.equalsIgnoreCase("NANOS")) return TimeUnit.NANOSECONDS; - if (u.equalsIgnoreCase("NANO")) return TimeUnit.NANOSECONDS; - if (u.equalsIgnoreCase("NS")) return TimeUnit.NANOSECONDS; - - if (u.equalsIgnoreCase("MICROSECONDS")) return TimeUnit.MICROSECONDS; - if (u.equalsIgnoreCase("MICROSECOND")) return TimeUnit.MICROSECONDS; - if (u.equalsIgnoreCase("MICROS")) return TimeUnit.MICROSECONDS; - if (u.equalsIgnoreCase("MICRO")) return TimeUnit.MICROSECONDS; - - if (u.equalsIgnoreCase("MILLISECONDS")) return TimeUnit.MILLISECONDS; - if (u.equalsIgnoreCase("MILLISECOND")) return TimeUnit.MILLISECONDS; - if (u.equalsIgnoreCase("MILLIS")) return TimeUnit.MILLISECONDS; - if (u.equalsIgnoreCase("MILLI")) return TimeUnit.MILLISECONDS; - if (u.equalsIgnoreCase("MS")) return TimeUnit.MILLISECONDS; - - if (u.equalsIgnoreCase("SECONDS")) return TimeUnit.SECONDS; - if (u.equalsIgnoreCase("SECOND")) return TimeUnit.SECONDS; - if (u.equalsIgnoreCase("SEC")) return TimeUnit.SECONDS; - if (u.equalsIgnoreCase("S")) return TimeUnit.SECONDS; - - if (u.equalsIgnoreCase("MINUTES")) return TimeUnit.MINUTES; - if (u.equalsIgnoreCase("MINUTE")) return TimeUnit.MINUTES; - if (u.equalsIgnoreCase("MIN")) return TimeUnit.MINUTES; - if (u.equalsIgnoreCase("M")) return TimeUnit.MINUTES; - - if (u.equalsIgnoreCase("HOURS")) return TimeUnit.HOURS; - if (u.equalsIgnoreCase("HOUR")) return TimeUnit.HOURS; - if (u.equalsIgnoreCase("HRS")) return TimeUnit.HOURS; - if (u.equalsIgnoreCase("HR")) return TimeUnit.HOURS; - if (u.equalsIgnoreCase("H")) return TimeUnit.HOURS; - - if (u.equalsIgnoreCase("DAYS")) return TimeUnit.DAYS; - if (u.equalsIgnoreCase("DAY")) return TimeUnit.DAYS; - if (u.equalsIgnoreCase("D")) return TimeUnit.DAYS; http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-javamail.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-javamail.adoc b/docs/configuring-javamail.adoc new file mode 100644 index 0000000..c924b2c --- /dev/null +++ b/docs/configuring-javamail.adoc @@ -0,0 +1,42 @@ +# Configuring JavaMail +:index-group: Configuration +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +# Declaring a JavaMail Resource + +The basics are that any properties listed in the element are given +directly to the javamail provider via +javax.mail.Session.getDefaultInstance(Properties props). + +Here might be some example properties. + +.... +<Resource id="SuperbizMail" type="javax.mail.Session"> + mail.smtp.host=mail.superbiz.org + mail.smtp.port=25 + mail.transport.protocol=smtp + mail.smtp.auth=true + mail.smtp.user=someuser + password=mypassword +</Resource> +.... + +You can create as many entries like this as you wish, they just have to +have a unique 'id'. + +Careful not to add whitespace at the end of your property values. A +java.util.Properties object will leave those in the property values and +they will be passed to the JavaMail provider with the whitespace on the +end which may cause issues if the provider does not actively trim the +values before attempting to use them. + +== Overriding + +If you wanted to do a System property or InitialContext property +override of the above example mail session, you could do so like this: + +.... +java ... -DSuperbizMail.mail.smtp.host=localhost +.... http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-javamail.md ---------------------------------------------------------------------- diff --git a/docs/configuring-javamail.md b/docs/configuring-javamail.md deleted file mode 100644 index e0de1f5..0000000 --- a/docs/configuring-javamail.md +++ /dev/null @@ -1,41 +0,0 @@ -index-group=Configuration -type=page -status=published -title=Configuring JavaMail -~~~~~~ -<a name="ConfiguringJavaMail-DeclaringaJavaMailResource"></a> -# Declaring a JavaMail Resource - -The basics are that any properties listed in the <Resource> element are -given directly to the javamail provider via -javax.mail.Session.getDefaultInstance(Properties props). - -Here might be some example properties. - - <Resource id="SuperbizMail" type="javax.mail.Session"> - mail.smtp.host=mail.superbiz.org - mail.smtp.port=25 - mail.transport.protocol=smtp - mail.smtp.auth=true - mail.smtp.user=someuser - password=mypassword - </Resource> - - -You can create as many <Resource> entries like this as you wish, they just -have to have a unique 'id'. - -Careful not to add whitespace at the end of your property values. A -java.util.Properties object will leave those in the property values and -they will be passed to the JavaMail provider with the whitespace on the end -which may cause issues if the provider does not actively trim the values -before attempting to use them. - -# Overriding - -If you wanted to do a System property or InitialContext property override -of the above example mail session, you could do so like this: - - java ... -DSuperbizMail.mail.smtp.host=localhost - - http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-logging-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-logging-in-tests.adoc b/docs/configuring-logging-in-tests.adoc new file mode 100644 index 0000000..6a3461a --- /dev/null +++ b/docs/configuring-logging-in-tests.adoc @@ -0,0 +1,119 @@ +# Configuring Logging in Tests +:index-group: Testing Techniques +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +# embedded.logging.properties + +When in embedded mode OpenEJB uses an embedded.logging.properties file +packed in our openejb-core jar which use to configure the logging. This +logging configuration is a bit lighter than the conf/logging.properties +file created in a full standalone OpenEJB setup. + +When searching for any config file in the classpath, multiple files with +the same name may exist. OpenEJB will always attempt to favor the one +closest to the openejb.base variable. This variable is set by default to +the current directory where your vm is executing, which is more than +likely the directory of your current module. So simply adding a file +named embedded.logging.properties to your module may be all that you +need to specify a new logging configuration for your tests. + +Alternatively, you can set "openejb.logger.external" to "true" as a +system property (will not work as an InitialContext property). Then +OpenEJB will not attempt to configure logging at all and you can +configure logging with Log4j directly using any of its APIs; xml, +properties, or code. + +There are a couple good reasons for _not_ replacing the +embedded.logging.properties file. + +[arabic] +. If you want to just change 5% of the logging settings, why take +control over the other 95% as well. +. We do occasionally add new logging categories. If you are not +replacing the embedded.logging.properties you will pick these up +automatically when you upgrade. + +# Overriding (recommended) + +As mentioned in link:embedded-configuration.html[Embedded Configuration] +much can be done with simple overriding. The default +embedded.logging.properties is quite good and there is really no need to +replace it completely if all you want to do is tweak a few values. + +You can also put logging tweaks right in your InitialContext properties +like so: + +.... +Properties p = new Properties(); +p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + +p.put("log4j.rootLogger", "fatal,C"); +p.put("log4j.category.OpenEJB", "warn"); +p.put("log4j.category.OpenEJB.options", "info"); +p.put("log4j.category.OpenEJB.server", "info"); +p.put("log4j.category.OpenEJB.startup", "info"); +p.put("log4j.category.OpenEJB.startup.service", "warn"); +p.put("log4j.category.OpenEJB.startup.config", "info"); +p.put("log4j.category.OpenEJB.hsql", "info"); +p.put("log4j.category.CORBA-Adapter", "info"); +p.put("log4j.category.Transaction", "warn"); +p.put("log4j.category.org.apache.activemq", "error"); +p.put("log4j.category.org.apache.geronimo", "error"); +p.put("log4j.category.openjpa", "error"); +p.put("log4j.appender.C", "org.apache.log4j.ConsoleAppender"); +p.put("log4j.appender.C.layout", "org.apache.log4j.SimpleLayout"); + +Context context = new InitialContext(p); +.... + +Essentially, everything starting with "log4j." gets applied as overrides +on top of the embedded.logging.properties we find in the classpath. This +makes it possible to easily tweak the log levels while debugging a +particular test. + +Note, that InitialContext properties can also be supplied in a +jndi.properties file in the classpath or via system properties. The +overriding order is as follows: 1 = highest, 4 = lowest. + +[arabic] +. InitialContext properties +. jndi.properties in classpath +. system propertes +. embedded.logging.properties in classpath + +By default there are no logging settings in 1-3, so #4 is the only +source of logging information. + +# Default embedded.logging.properties contents + +For your purposes, here are the contents of the default +embedded.logging.properties file contained in OpenEJB 3.1.1 + +.... +log4j.rootLogger = fatal,C +log4j.category.OpenEJB = warn +log4j.category.OpenEJB.server = info +log4j.category.OpenEJB.startup = info +log4j.category.OpenEJB.startup.service = warn +log4j.category.OpenEJB.startup.config = info +log4j.category.OpenEJB.hsql = info +log4j.category.CORBA-Adapter = info +log4j.category.Transaction = warn +log4j.category.org.apache.activemq = error +log4j.category.org.apache.geronimo = error +log4j.category.openjpa = error + +log4j.appender.C = org.apache.log4j.ConsoleAppender +log4j.appender.C.layout = org.apache.log4j.SimpleLayout +.... + +Here is that file's location in svn as well as all of the previous +versions. Future versions will follow the same pattern. + +* http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/container/openejb-core/src/main/resources/embedded.logging.properties +* http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/container/openejb-core/src/main/resources/embedded.logging.properties +* http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0/container/openejb-core/src/main/resources/embedded.logging.properties +* http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0-beta-2/container/openejb-core/src/main/resources/embedded.logging.properties +* http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0-beta-1/container/openejb-core/src/main/resources/embedded.logging.properties http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-logging-in-tests.md ---------------------------------------------------------------------- diff --git a/docs/configuring-logging-in-tests.md b/docs/configuring-logging-in-tests.md deleted file mode 100644 index 3ae519f..0000000 --- a/docs/configuring-logging-in-tests.md +++ /dev/null @@ -1,118 +0,0 @@ -index-group=Testing Techniques -type=page -status=published -title=Configuring Logging in Tests -~~~~~~ -<a name="ConfiguringLogginginTests-embedded.logging.properties"></a> -# embedded.logging.properties - -When in embedded mode OpenEJB uses an embedded.logging.properties file -packed in our openejb-core jar which use to configure the logging. This -logging configuration is a bit lighter than the conf/logging.properties -file created in a full standalone OpenEJB setup. - -When searching for any config file in the classpath, multiple files with -the same name may exist. OpenEJB will always attempt to favor the one -closest to the openejb.base variable. This variable is set by default to -the current directory where your vm is executing, which is more than likely -the directory of your current module. So simply adding a file named -embedded.logging.properties to your module may be all that you need to -specify a new logging configuration for your tests. - -Alternatively, you can set "openejb.logger.external" to "true" as a system -property (will not work as an InitialContext property). Then OpenEJB will -not attempt to configure logging at all and you can configure logging with -Log4j directly using any of its APIs; xml, properties, or code. - -There are a couple good reasons for *not* replacing the -embedded.logging.properties file. - -1. If you want to just change 5% of the logging settings, why take control -over the other 95% as well. -1. We do occasionally add new logging categories. If you are not replacing -the embedded.logging.properties you will pick these up automatically when -you upgrade. - -<a name="ConfiguringLogginginTests-Overriding(recommended)"></a> -# Overriding (recommended) - -As mentioned in [Embedded Configuration](embedded-configuration.html) - much can be done with simple overriding. The default -embedded.logging.properties is quite good and there is really no need to -replace it completely if all you want to do is tweak a few values. - -You can also put logging tweaks right in your InitialContext properties -like so: - - - Properties p = new Properties(); - p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); - - p.put("log4j.rootLogger", "fatal,C"); - p.put("log4j.category.OpenEJB", "warn"); - p.put("log4j.category.OpenEJB.options", "info"); - p.put("log4j.category.OpenEJB.server", "info"); - p.put("log4j.category.OpenEJB.startup", "info"); - p.put("log4j.category.OpenEJB.startup.service", "warn"); - p.put("log4j.category.OpenEJB.startup.config", "info"); - p.put("log4j.category.OpenEJB.hsql", "info"); - p.put("log4j.category.CORBA-Adapter", "info"); - p.put("log4j.category.Transaction", "warn"); - p.put("log4j.category.org.apache.activemq", "error"); - p.put("log4j.category.org.apache.geronimo", "error"); - p.put("log4j.category.openjpa", "error"); - p.put("log4j.appender.C", "org.apache.log4j.ConsoleAppender"); - p.put("log4j.appender.C.layout", "org.apache.log4j.SimpleLayout"); - - Context context = new InitialContext(p); - - -Essentially, everything starting with "log4j." gets applied as overrides on -top of the embedded.logging.properties we find in the classpath. This -makes it possible to easily tweak the log levels while debugging a -particular test. - -Note, that InitialContext properties can also be supplied in a -jndi.properties file in the classpath or via system properties. The -overriding order is as follows: 1 = highest, 4 = lowest. - -1. InitialContext properties -1. jndi.properties in classpath -1. system propertes -1. embedded.logging.properties in classpath - -By default there are no logging settings in 1-3, so #4 is the only source -of logging information. - -<a name="ConfiguringLogginginTests-Defaultembedded.logging.propertiescontents"></a> -# Default embedded.logging.properties contents - -For your purposes, here are the contents of the default -embedded.logging.properties file contained in OpenEJB 3.1.1 - - - log4j.rootLogger = fatal,C - log4j.category.OpenEJB = warn - log4j.category.OpenEJB.server = info - log4j.category.OpenEJB.startup = info - log4j.category.OpenEJB.startup.service = warn - log4j.category.OpenEJB.startup.config = info - log4j.category.OpenEJB.hsql = info - log4j.category.CORBA-Adapter = info - log4j.category.Transaction = warn - log4j.category.org.apache.activemq = error - log4j.category.org.apache.geronimo = error - log4j.category.openjpa = error - - log4j.appender.C = org.apache.log4j.ConsoleAppender - log4j.appender.C.layout = org.apache.log4j.SimpleLayout - - -Here is that file's location in svn as well as all of the previous -versions. Future versions will follow the same pattern. - -- [http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/container/openejb-core/src/main/resources/embedded.logging.properties](http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/container/openejb-core/src/main/resources/embedded.logging.properties) -- [http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/container/openejb-core/src/main/resources/embedded.logging.properties](http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/container/openejb-core/src/main/resources/embedded.logging.properties) -- [http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0/container/openejb-core/src/main/resources/embedded.logging.properties](http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0/container/openejb-core/src/main/resources/embedded.logging.properties) -- [http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0-beta-2/container/openejb-core/src/main/resources/embedded.logging.properties](http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0-beta-2/container/openejb-core/src/main/resources/embedded.logging.properties) -- [http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0-beta-1/container/openejb-core/src/main/resources/embedded.logging.properties](http://svn.apache.org/repos/asf/openejb/tags/openejb-3.0-beta-1/container/openejb-core/src/main/resources/embedded.logging.properties) http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-persistenceunits-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-persistenceunits-in-tests.adoc b/docs/configuring-persistenceunits-in-tests.adoc new file mode 100644 index 0000000..f499814 --- /dev/null +++ b/docs/configuring-persistenceunits-in-tests.adoc @@ -0,0 +1,157 @@ +# Configuring PersistenceUnits in Tests +:index-group: Testing Techniques +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +# Overriding the +persistence.xml + +The most common situation in EJB related testing by far is the need to +alter your persistence.xml for a test environment. + +== Overriding the jta-data-source and non-jta-data-source + +OpenEJB will automatically use the DataSources you have setup in your +test environment, we're pretty good at guessing the right DataSources +you intend even if the names don't match exactly -- or in some cases at +all. If there is only one DataSource configured, it's very easy for us +to guess the DataSource to use. + +This allows you to keep your persistence.xml configured for your +production environment and helps eliminate the need for a "test" +persistence.xml (though we do have that functionality). A log line will +be printed saying if we had to adjust the DataSources of your +persistence.xml. + +== Overriding the persistence-unit properties + +You can override any property in your test setup via either system +properties or the initial context properties. The format is: + +`<unit-name>.<property>=<value>` + +So for example with the following persistence.xml: + +.... +<persistence> + <persistence-unit name="movie-unit"> + <provider>org.hibernate.ejb.HibernatePersistence</provider> + <jta-data-source>movieDatabase</jta-data-source> + <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source> + <properties> + <property name="hibernate.hbm2ddl.auto" value="create-drop"/> + <property name="hibernate.max_fetch_depth" value="3"/> + </properties> + </persistence-unit> +</persistence> +.... + +You can override and add persistence unit properties in your test case. +There are currently no facilities for removing them (if you have a need +for that let us know -- it hasn't really come up so far). + +.... +Properties p = new Properties(); +p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.LocalInitialContextFactory"); + +p.put("movie-unit.hibernate.hbm2ddl.auto", "update"); +p.put("movie-unit.hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); + +context = new InitialContext(p); +.... + +The overriding order is as follows: 1 = highest, 4 = lowest. + +[arabic] +. InitialContext properties +. jndi.properties from the classpath +. System properties +. persistence.xml properties + +By default there are no overrides in 1-3, so #4 is the only source of +information. + +In the above example there would be exactly three properties for the +"movie-unit" persistence unit: + +* hibernate.hbm2ddl.auto = update +* hibernate.max_fetch_depth = 3 +* hibernate.dialect = org.hibernate.dialect.HSQLDialect + +These properties would be passed by OpenEJB directly to the persistence +provider (in this case Hibernate). With one exception OpenEJB does not +understand or modify these properties. Details on that one exception +below. + +== Common mistakes + +Note that you *must* use the *unit name* as the prefix. This will not +work: + +.... + Properties p = new Properties(); + p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.LocalInitialContextFactory"); + + p.put("hibernate.hbm2ddl.auto", "update"); + p.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); + + context = new InitialContext(p); +.... + +Currently, only properties that start with the unit name are search and +applied. + +== No need to specify a "transaction lookup" property + +All vendors have such a property for getting a reference to the +container's TransactionManager and nothing works if this is not set +correctly to the OpenEJB specific class. To make the lives of users +easier, OpenEJB will take the liberty of setting it for you. + +Here are the persistence provider classes we understand and the defaults +we will set for you: + +=== Provider org.hibernate.ejb.HibernatePersistence + +When using this provider, the +_hibernate.transaction.manager_lookup_class_ will be automatically set +by OpenEJB to _org.apache.openejb.hibernate.TransactionManagerLookup_. +If the property is already set in the persistence unit it will be +overwritten if it starts with the standard "org.hibernate.transaction." +prefix. + +Custom lookup implementations will never be overwritten automatically. + +=== Provider oracle.toplink.essentials.PersistenceProvider + +Or _oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider_. + +When using this provider, the _toplink.target-server_ will be +automatically set by OpenEJB to +_org.apache.openejb.toplink.JTATransactionController_. If the property +is already set in the persistence unit it will be overwritten if it +starts with the standard "oracle.toplink.transaction." prefix. + +Custom transaction controller implementations will never be overwritten +automatically. + +=== Provider org.eclipse.persistence.jpa.PersistenceProvider + +Or _org.eclipse.persistence.jpa.osgi.PersistenceProvider_. + +When using this provider, the _eclipselink.target-server_ will be +automatically set by OpenEJB to +_org.apache.openejb.eclipselink.JTATransactionController_. If the +property is already set in the persistence unit it will be overwritten +if it starts with the standard "org.eclipse.persistence.transaction." +prefix. + +Custom transaction controller implementations will never be overwritten +automatically. + +=== Provider org.apache.openjpa.persistence.PersistenceProviderImpl + +OpenJPA is capable of discovering the correct method for locating the +TransactionManager without the need for users to specify the specific +strategy. Therefore no specific "magic" is required. http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/configuring-persistenceunits-in-tests.md ---------------------------------------------------------------------- diff --git a/docs/configuring-persistenceunits-in-tests.md b/docs/configuring-persistenceunits-in-tests.md deleted file mode 100644 index a8e9777..0000000 --- a/docs/configuring-persistenceunits-in-tests.md +++ /dev/null @@ -1,144 +0,0 @@ -index-group=Testing Techniques -type=page -status=published -title=Configuring PersistenceUnits in Tests -~~~~~~ -<a name="ConfiguringPersistenceUnitsinTests-Overridingthepersistence.xml"></a> -# Overriding the persistence.xml - -The most common situation in EJB related testing by far is the need to -alter your persistence.xml for a test environment. - -<a name="ConfiguringPersistenceUnitsinTests-Overridingthe<jta-data-source>and<non-jta-data-source>"></a> -## Overriding the jta-data-source and non-jta-data-source - -OpenEJB will automatically use the DataSources you have setup in your test -environment, we're pretty good at guessing the right DataSources you intend -even if the names don't match exactly -- or in some cases at all. If there -is only one DataSource configured, it's very easy for us to guess the -DataSource to use. - -This allows you to keep your persistence.xml configured for your production -environment and helps eliminate the need for a "test" persistence.xml -(though we do have that functionality). A log line will be printed saying -if we had to adjust the DataSources of your persistence.xml. - -<a name="ConfiguringPersistenceUnitsinTests-Overridingthepersistence-unit<properties>"></a> -## Overriding the persistence-unit properties - -You can override any property in your test setup via either system -properties or the initial context properties. The format is: - -`<unit-name>.<property>=<value>` - -So for example with the following persistence.xml: - - <persistence> - <persistence-unit name="movie-unit"> - <provider>org.hibernate.ejb.HibernatePersistence</provider> - <jta-data-source>movieDatabase</jta-data-source> - <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source> - <properties> - <property name="hibernate.hbm2ddl.auto" value="create-drop"/> - <property name="hibernate.max_fetch_depth" value="3"/> - </properties> - </persistence-unit> - </persistence> - - -You can override and add persistence unit properties in your test case. -There are currently no facilities for removing them (if you have a need for -that let us know -- it hasn't really come up so far). - - Properties p = new Properties(); - p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.LocalInitialContextFactory"); - - p.put("movie-unit.hibernate.hbm2ddl.auto", "update"); - p.put("movie-unit.hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); - - context = new InitialContext(p); - -The overriding order is as follows: 1 = highest, 4 = lowest. - -1. InitialContext properties -1. jndi.properties from the classpath -1. System properties -1. persistence.xml properties - -By default there are no overrides in 1-3, so #4 is the only source of -information. - -In the above example there would be exactly three properties for the "movie-unit" persistence unit: - - - hibernate.hbm2ddl.auto = update - - hibernate.max_fetch_depth = 3 - - hibernate.dialect = org.hibernate.dialect.HSQLDialect - -These properties would be passed by OpenEJB directly to the persistence -provider (in this case Hibernate). With one exception OpenEJB does not -understand or modify these properties. Details on that one exception -below. - -### Common mistakes - -Note that you **must** use the **unit name** as the prefix. This will not work: - - Properties p = new Properties(); - p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.LocalInitialContextFactory"); - - p.put("hibernate.hbm2ddl.auto", "update"); - p.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); - - context = new InitialContext(p); - -Currently, only properties that start with the unit name are search and applied. - -### No need to specify a "transaction lookup" property - -All vendors have such a property for getting a reference to the container's -TransactionManager and nothing works if this is not set correctly to the -OpenEJB specific class. To make the lives of users easier, OpenEJB will -take the liberty of setting it for you. - -Here are the persistence provider classes we understand and the defaults we -will set for you: - -#### Provider org.hibernate.ejb.HibernatePersistence - -When using this provider, the *hibernate.transaction.manager_lookup_class* -will be automatically set by OpenEJB to -_org.apache.openejb.hibernate.TransactionManagerLookup_. If the property -is already set in the persistence unit it will be overwritten if it starts -with the standard "org.hibernate.transaction." prefix. - -Custom lookup implementations will never be overwritten automatically. - -#### Provider oracle.toplink.essentials.PersistenceProvider - -Or _oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider_. - -When using this provider, the *toplink.target-server* will be automatically -set by OpenEJB to _org.apache.openejb.toplink.JTATransactionController_. -If the property is already set in the persistence unit it will be -overwritten if it starts with the standard "oracle.toplink.transaction." -prefix. - -Custom transaction controller implementations will never be overwritten automatically. - -#### Provider org.eclipse.persistence.jpa.PersistenceProvider - -Or _org.eclipse.persistence.jpa.osgi.PersistenceProvider_. - -When using this provider, the *eclipselink.target-server* will be -automatically set by OpenEJB to -_org.apache.openejb.eclipselink.JTATransactionController_. If the property -is already set in the persistence unit it will be overwritten if it starts -with the standard "org.eclipse.persistence.transaction." prefix. - -Custom transaction controller implementations will never be overwritten automatically. - -#### Provider org.apache.openjpa.persistence.PersistenceProviderImpl - -OpenJPA is capable of discovering the correct method for locating the -TransactionManager without the need for users to specify the specific -strategy. Therefore no specific "magic" is required. http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/constructor-injection.adoc ---------------------------------------------------------------------- diff --git a/docs/constructor-injection.adoc b/docs/constructor-injection.adoc new file mode 100644 index 0000000..abe0531 --- /dev/null +++ b/docs/constructor-injection.adoc @@ -0,0 +1,100 @@ +# Constructor Injection +:index-group: Unrevised +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + +For those of you who would like to use final fields, +wish to avoid numerous setters, or dislike private field injection and +would like nothing more than to just use plan old java constructors, +your wish has come true. This is a feature we intended to add to OpenEJB +3.0 but didn't have time for. We're happy to bring it to the OpenEJB 3.1 +release and with a bit of luck and support from people like yourself, +we'll see this as an EJB 3.1 feature as well. + +.... +@Stateless +public class WidgetBean implements Widget { + + @EJB(beanName = "FooBean") + private final Foo foo; + + @Resource(name = "count") + private final int count; + + @Resource + private final DataSource ds; + + public WidgetBean(Integer count, Foo foo, DataSource ds) { + this.count = count; + this.foo = foo; + this.ds = ds; + } + + public int getCount() { + return count; + } + + public Foo getFoo() { + return foo; + } +} +.... + +The @EJB, @Resource, @PersistenceUnit, and @PersistenceContext +annotations can be placed at the class-level instead such as: + +.... +@Stateless +@EJB(name = "foo", beanInterface = Foo.class, beanName = "FooBean") +@Resource(name = "count", type = int.class) +@Resource(name = "ds", type = DataSource.class) +public class WidgetBean implements Widget { + + public WidgetBean(Integer count, Foo foo, DataSource ds) { + // do something + } + + public int getCount() { + return count; + } + + public Foo getFoo() { + return foo; + } +} +.... + +Currently this functionality relies on classes being compiled with debug +symbols (the default compile setting for javac) as we use the debug +table in the byte code to discover the constructor arg names. +Additionally, you must not have a no-arg constructor. If a no-arg +constructor is present, that constructor will be used instead. + +Ideally, we would like the annotations to be used on the parameters +directly as shown below. Unfortunately, this does not work as the Java +EE annotation classes do not permit usage on parameters. If you'd like +to see that change as much as we do, definitely voice your support by +sending note to +mailto:[email protected][[email protected]] + +Not yet possible + +.... +@Stateless + +public class WidgetBean implements Widget { + + public WidgetBean(@Resource(name = "count") Integer count, @EJB Foo foo, @Resource DataSource ds) { + // do something + } + + public int getCount() { + return count; + } + + public Foo getFoo() { + return foo; + } +} +.... http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/constructor-injection.md ---------------------------------------------------------------------- diff --git a/docs/constructor-injection.md b/docs/constructor-injection.md deleted file mode 100644 index c0a5b4c..0000000 --- a/docs/constructor-injection.md +++ /dev/null @@ -1,98 +0,0 @@ -index-group=Unrevised -type=page -status=published -title=Constructor Injection -~~~~~~ -For those of you who would like to use final fields, wish to avoid numerous -setters, or dislike private field injection and would like nothing more -than to just use plan old java constructors, your wish has come true. This -is a feature we intended to add to OpenEJB 3.0 but didn't have time for. -We're happy to bring it to the OpenEJB 3.1 release and with a bit of luck -and support from people like yourself, we'll see this as an EJB 3.1 feature -as well. - - - @Stateless - public class WidgetBean implements Widget { - - @EJB(beanName = "FooBean") - private final Foo foo; - - @Resource(name = "count") - private final int count; - - @Resource - private final DataSource ds; - - public WidgetBean(Integer count, Foo foo, DataSource ds) { - this.count = count; - this.foo = foo; - this.ds = ds; - } - - public int getCount() { - return count; - } - - public Foo getFoo() { - return foo; - } - } - - -The @EJB, @Resource, @PersistenceUnit, and @PersistenceContext annotations -can be placed at the class-level instead such as: - - - @Stateless - @EJB(name = "foo", beanInterface = Foo.class, beanName = "FooBean") - @Resource(name = "count", type = int.class) - @Resource(name = "ds", type = DataSource.class) - public class WidgetBean implements Widget { - - public WidgetBean(Integer count, Foo foo, DataSource ds) { - // do something - } - - public int getCount() { - return count; - } - - public Foo getFoo() { - return foo; - } - } - - - -Currently this functionality relies on classes being compiled with debug -symbols (the default compile setting for javac) as we use the debug table -in the byte code to discover the constructor arg names. Additionally, you -must not have a no-arg constructor. If a no-arg constructor is present, -that constructor will be used instead. - -Ideally, we would like the annotations to be used on the parameters -directly as shown below. Unfortunately, this does not work as the Java EE -annotation classes do not permit usage on parameters. If you'd like to see -that change as much as we do, definitely voice your support by sending note -to [[email protected]](mailto:[email protected]) - - -Not yet possible - - @Stateless - - public class WidgetBean implements Widget { - - public WidgetBean(@Resource(name = "count") Integer count, @EJB Foo foo, @Resource DataSource ds) { - // do something - } - - public int getCount() { - return count; - } - - public Foo getFoo() { - return foo; - } - } http://git-wip-us.apache.org/repos/asf/tomee/blob/6972efbb/docs/containers-and-resources.adoc ---------------------------------------------------------------------- diff --git a/docs/containers-and-resources.adoc b/docs/containers-and-resources.adoc new file mode 100644 index 0000000..1bb00d7 --- /dev/null +++ b/docs/containers-and-resources.adoc @@ -0,0 +1,473 @@ +# Containers and Resources +:index-group: Configuration +:jbake-date: 2018-12-05 +:jbake-type: page +:jbake-status: published + + +.... + <p><a name="ContainersandResources-containers"></a></p> +.... + +CMP_ENTITY + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Container?type=CMP_ENTITY + +Supports the following properties + +Property Name + +Description + +CmpEngineFactory + +Default value is org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory. + +TransactionManager + +Declarable in tomee.xml via + +Supports the following properties + +Property Name + +Description + +defaultTransactionTimeoutSeconds + +Default value is 10 minutes. + +BMP_ENTITY + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Container?type=BMP_ENTITY + +Supports the following properties + +Property Name + +Description + +PoolSize + +Specifies the size of the bean pools for this bmp entity container. +Default value is 10. + +STATELESS + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Container?type=STATELESS + +Supports the following properties + +Property Name + +Description + +TimeOut + +Specifies the time to wait between invocations. This value is measured +in milliseconds. A value of 5 would result in a time-out of 5 +milliseconds between invocations. A value of zero would mean no timeout. +Default value is 0. + +PoolSize + +Specifies the size of the bean pools for this stateless SessionBean +container. Default value is 10. + +StrictPooling + +StrictPooling tells the container what to do when the pool reaches it's +maximum size and there are incoming requests that need instances. With +strict pooling, requests will have to wait for instances to become +available. The pool size will never grow beyond the the set PoolSize +value. Without strict pooling, the container will create temporary +instances to meet demand. The instances will last for just one method +invocation and then are removed. Default value is true. + +STATEFUL + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Container?type=STATEFUL + +Supports the following properties + +Property Name + +Description + +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 Default value is +org.apache.openejb.core.stateful.SimplePassivater. + +TimeOut + +Specifies the time to wait between invocations. This value is measured +in minutes. A value of 5 would result in a time-out of 5 minutes between +invocations. A value of zero would mean no timeout. Default value is 20. + +PoolSize + +Specifies the size of the bean pools for this stateful SessionBean +container. Default value is 1000. + +BulkPassivate + +Property name that specifies the number of instances to passivate at one +time when doing bulk passivation. Default value is 100. + +MESSAGE + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Container?type=MESSAGE + +Supports the following properties + +Property Name + +Description + +ResourceAdapter + +The resource adapter delivers messages to the container Default value is +Default JMS Resource Adapter. + +MessageListenerInterface + +Specifies the message listener interface handled by this container +Default value is javax.jms.MessageListener. + +ActivationSpecClass + +Specifies the activation spec class Default value is +org.apache.activemq.ra.ActiveMQActivationSpec. + +InstanceLimit + +Specifies the maximum number of bean instances that are allowed to exist +for each MDB deployment. Default value is 10. + +Resources + +javax.sql.DataSource + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Resource?type=javax.sql.DataSource + +Supports the following properties + +Property Name + +Description + +JtaManaged + +Determines wether or not this data source should be JTA managed or user +managed.  If set to 'true' it will automatically be enrolled in any +ongoing transactions.  Calling begin/commit/rollback or setAutoCommit on +the datasource or connection will not be allowed.  If you need to +perform these functions yourself, set JtaManaged to 'false' In terms of +JPA persistence.xml: "JtaManaged=true" can be used as a +'jta-data-source' "JtaManaged=false" can be used as a +'non-jta-data-source' Default value is true. + +JdbcDriver + +Driver class name Default value is org.hsqldb.jdbcDriver. + +JdbcUrl + +Url for creating connections Default value is +jdbc:hsqldb:file:data/hsqldb/hsqldb. + +UserName + +Default user name Default value is sa. + +Password + +Default password + +ConnectionProperties + +The connection properties that will be sent to the JDBC driver when +establishing new connections Format of the string must be +[propertyName=property;]* NOTE - The "user" and "password" properties +will be passed explicitly, so they do not need to be included here. + +DefaultAutoCommit + +The default auto-commit state of new connections Default value is true. + +DefaultReadOnly + +The default read-only state of new connections If not set then the +setReadOnly method will not be called. (Some drivers don't support read +only mode, ex: Informix) + +DefaultTransactionIsolation + +The default TransactionIsolation state of new connections If not set +then the setTransactionIsolation method will not be called. The allowed +values for this property are:    NONE    READ_COMMITTED    +READ_UNCOMMITTED    REPEATABLE_READ    SERIALIZABLE Note: Most JDBC +drivers do not support all isolation levels + +InitialSize + +The initial number of connections that are created when the pool is +started Default value is 0. + +MaxActive + +The maximum number of active connections that can be allocated from this +pool at the same time, or a negative number for no limit. Default value +is 20. + +MaxIdle + +The maximum number of connections that can remain idle in the pool, +without extra ones being released, or a negative number for no limit. +Default value is 20. + +MinIdle + +The minimum number of connections that can remain idle in the pool, +without extra ones being created, or zero to create none. Default value +is 0. + +MaxWait + +The maximum number of milliseconds that the pool will wait (when there +are no available connections) for a connection to be returned before +throwing an exception, or -1 to wait indefinitely. Default value is -1. + +ValidationQuery + +The SQL query that will be used to validate connections from this pool +before returning them to the caller. If specified, this query MUST be an +SQL SELECT statement that returns at least one row. + +TestOnBorrow + +If true connections will be validated before being borrowed from the +pool. If the validation fails, the connection is destroyed, and a new +conection will be retrieved from the pool (and validated). NOTE - for a +true value to have any effect, the ValidationQuery parameter must be +set. Default value is true. + +TestOnReturn + +If true connections will be validated before being returned to the +pool.  If the validation fails, the connection is destroyed instead of +being returned to the pool. NOTE - for a true value to have any effect, +the ValidationQuery parameter must be set. Default value is false. + +TestWhileIdle + +If true connections will be validated by the idle connection evictor (if +any). If the validation fails, the connection is destroyed and removed +from the pool NOTE - for a true value to have any effect, the +timeBetweenEvictionRunsMillis property must be a positive number and the +ValidationQuery parameter must be set. Default value is false. + +TimeBetweenEvictionRunsMillis + +The number of milliseconds to sleep between runs of the idle connection +evictor thread. When set to a negative number, no idle connection +evictor thread will be run. Default value is -1. + +NumTestsPerEvictionRun + +The number of connectionss to examine during each run of the idle +connection evictor thread (if any). Default value is 3. + +MinEvictableIdleTimeMillis + +The minimum amount of time a connection may sit idle in the pool before +it is eligable for eviction by the idle connection evictor (if any). +Default value is 1800000. + +PoolPreparedStatements + +If true, a statement pool is created for each Connection and +PreparedStatements created by one of the following methods are +pooled:    public PreparedStatement prepareStatement(String +sql);    public PreparedStatement prepareStatement(String +sql,            int resultSetType,            int resultSetConcurrency) +Default value is false. + +MaxOpenPreparedStatements + +The maximum number of open statements that can be allocated from the +statement pool at the same time, or zero for no limit. NOTE - Some +drivers have limits on the number of open statements, so make sure there +are some resources left for the other (non-prepared) statements. Default +value is 0. + +AccessToUnderlyingConnectionAllowed + +If true the raw physical connection to the database can be accessed +using the following construct:    Connection conn = +ds.getConnection();    Connection rawConn = ((DelegatingConnection) +conn).getInnermostDelegate();    ...    conn.close() Default is false, +because misbehaving programs can do harmfull things to the raw +connection shuch as closing the raw connection or continuing to use the +raw connection after it has been assigned to another logical +connection.  Be carefull and only use when you need direct access to +driver specific extentions. NOTE: Do NOT close the underlying +connection, only the original logical connection wrapper. Default value +is false. + +ActiveMQResourceAdapter + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Resource?type=ActiveMQResourceAdapter + +Supports the following properties + +Property Name + +Description + +BrokerXmlConfig + +Broker configuration Default value is +broker:(tcp://localhost:61616)?useJmx=false. + +ServerUrl + +Broker address Default value is vm://localhost?async=true. + +DataSource + +DataSource for persistence messages Default value is Default Unmanaged +JDBC Database. + +javax.jms.ConnectionFactory + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Resource?type=javax.jms.ConnectionFactory + +Supports the following properties + +Property Name + +Description + +ResourceAdapter + +Default value is Default JMS Resource Adapter. + +TransactionSupport + +Specifies if the connection is enrolled in global transaction allowed +values: xa, local or none Default value is xa. + +PoolMaxSize + +Maximum number of physical connection to the ActiveMQ broker Default +value is 10. + +PoolMinSize + +Minimum number of physical connection to the ActiveMQ broker Default +value is 0. + +ConnectionMaxWaitMilliseconds + +Maximum amount of time to wait for a connection Default value is 5000. + +ConnectionMaxIdleMinutes + +Maximum amount of time a connection can be idle before being reclaimed +Default value is 15. + +javax.jms.Queue + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Resource?type=javax.jms.Queue + +Supports the following properties + +Property Name + +Description + +destination + +Specifies the name of the queue + +javax.jms.Topic + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Resource?type=javax.jms.Topic + +Supports the following properties + +Property Name + +Description + +destination + +Specifies the name of the topic + +org.omg.CORBA.ORB + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Resource?type=org.omg.CORBA.ORB + +No properties. + +javax.mail.Session + +Declarable in tomee.xml via + +Declarable in properties via + +Foo = new://Resource?type=javax.mail.Session + +No properties.
