Update codeblock style so we have syntax highlighting
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/66e0d661 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/66e0d661 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/66e0d661 Branch: refs/heads/master Commit: 66e0d661093646256dd037c93ca05391ce29e3cf Parents: 22f7ae2 Author: David Blevins <[email protected]> Authored: Fri Dec 7 17:33:09 2018 -0800 Committer: David Blevins <[email protected]> Committed: Fri Dec 7 17:33:09 2018 -0800 ---------------------------------------------------------------------- docs/Configuring-in-tomee.adoc | 10 ++- docs/activemqresourceadapter-config.adoc | 10 ++- docs/admin/configuration/resources.adoc | 2 - docs/admin/index.adoc | 2 +- docs/advanced/client/jndi.adoc | 2 - docs/advanced/index.adoc | 2 +- docs/advanced/setup/index.adoc | 1 - docs/alternate-descriptors.adoc | 15 ++-- docs/annotations,-xml-and-defaults.adoc | 10 ++- docs/application-composer/advanced.adoc | 20 +++-- docs/application-composer/getting-started.adoc | 45 ++++++----- docs/application-deployment-solutions.adoc | 10 ++- ...application-discovery-via-the-classpath.adoc | 20 +++-- docs/application-resources.adoc | 65 +++++++++------- docs/arquillian-available-adapters.adoc | 40 ++++++---- docs/basics---security.adoc | 5 +- docs/bmpentitycontainer-config.adoc | 10 ++- docs/bouncy-castle.adoc | 5 +- docs/built-in-type-converters.adoc | 15 ++-- docs/callbacks.adoc | 20 +++-- docs/changing-jms-implementations.adoc | 15 ++-- docs/clients.adoc | 30 +++++--- docs/cmpentitycontainer-config.adoc | 10 ++- docs/common-datasource-configurations.adoc | 35 +++++---- docs/common-persistenceprovider-properties.adoc | 15 ++-- docs/configuration.adoc | 20 +++-- docs/configuring-containers-in-tests.adoc | 5 +- docs/configuring-datasources-in-tests.adoc | 13 ++-- docs/configuring-datasources.adoc | 70 ++++++++++------- docs/configuring-durations.adoc | 5 +- docs/configuring-javamail.adoc | 10 ++- docs/configuring-logging-in-tests.adoc | 10 ++- docs/configuring-persistenceunits-in-tests.adoc | 15 ++-- docs/constructor-injection.adoc | 15 ++-- docs/containers-and-resources.adoc | 5 +- docs/custom-injection.adoc | 30 +++++--- docs/datasource-config.adoc | 40 ++++++---- docs/datasource-password-encryption.adoc | 45 ++++++----- docs/declaring-references.adoc | 1 - docs/deploy-tool.adoc | 5 +- docs/deployment-id.adoc | 25 +++--- docs/deployments.adoc | 35 +++++---- docs/details-on-openejb-jar.adoc | 20 +++-- docs/developer/classloading/index.adoc | 1 - docs/developer/ide/index.adoc | 2 - docs/developer/index.adoc | 2 +- docs/developer/json/index.adoc | 1 - docs/docs.adoc | 2 +- docs/dynamic-datasource.adoc | 25 +++--- docs/ejb-local-ref.adoc | 10 ++- docs/ejb-over-ssl.adoc | 25 +++--- docs/ejb-ref.adoc | 10 ++- docs/ejb-refs.adoc | 45 ++++++----- docs/ejb-request-logging.adoc | 15 ++-- docs/ejbd-transport.adoc | 35 +++++---- docs/embedded-and-remotable.adoc | 10 ++- docs/failover-logging.adoc | 25 +++--- docs/faq.adoc | 15 ++-- docs/features.adoc | 1 - ...esting-with-openejb,-jetty-and-selenium.adoc | 30 +++++--- docs/generating-ejb-3-annotations.adoc | 10 ++- docs/getting-started.adoc | 40 ++++++---- docs/hello-world.adoc | 80 ++++++++++++-------- docs/hibernate.adoc | 10 ++- docs/initialcontext-config.adoc | 10 ++- docs/installation-drop-in-war.adoc | 5 +- docs/installing-tomee.adoc | 20 +++-- docs/javaagent-with-maven-surefire.adoc | 15 ++-- docs/javaagent.adoc | 10 ++- docs/javamailsession-config.adoc | 10 ++- docs/jms-resources-and-mdb-container.adoc | 30 +++++--- docs/jmsconnectionfactory-config.adoc | 10 ++- docs/jndi-names.adoc | 55 ++++++++------ docs/jpa-concepts.adoc | 20 +++-- docs/local-client-injection.adoc | 5 +- docs/lookup-of-other-ejbs-example.adoc | 10 ++- docs/managedcontainer-config.adoc | 10 ++- docs/manual-installation.adoc | 15 ++-- docs/maven.adoc | 10 ++- docs/maven/index.adoc | 15 ++-- docs/messagedrivencontainer-config.adoc | 10 ++- docs/multicast-discovery.adoc | 15 ++-- docs/multiple-business-interface-hazzards.adoc | 45 ++++++----- docs/multipoint-discovery.adoc | 15 ++-- docs/multipoint-recommendations.adoc | 5 +- docs/multipulse-discovery.adoc | 20 +++-- docs/new-in-openejb-3.0.adoc | 15 ++-- docs/openejb-binaries.adoc | 10 ++- docs/openejb.xml.adoc | 15 ++-- docs/openjpa.adoc | 35 +++++---- docs/orb-config.adoc | 10 ++- docs/persistence-context.adoc | 10 ++- docs/persistence-unit-ref.adoc | 20 +++-- docs/properties-tool.adoc | 5 +- docs/provisioning.adoc | 30 +++++--- docs/proxyfactory-config.adoc | 10 ++- docs/queue-config.adoc | 10 ++- docs/remote-server.adoc | 15 ++-- docs/resource-injection.adoc | 40 ++++++---- docs/resource-ref-for-datasource.adoc | 10 ++- docs/securing-a-web-service.adoc | 25 +++--- docs/security-annotations.adoc | 45 ++++++----- docs/security.adoc | 5 +- docs/securityservice-config.adoc | 10 ++- docs/service-locator.adoc | 45 ++++++----- docs/singleton-beans.adoc | 20 +++-- docs/singletoncontainer-config.adoc | 10 ++- docs/spring-and-openejb-3.0.adoc | 45 ++++++----- docs/spring-ejb-and-jpa.adoc | 10 ++- docs/startup.adoc | 30 +++++--- docs/statefulcontainer-config.adoc | 10 ++- docs/statelesscontainer-config.adoc | 20 +++-- docs/system-properties.adoc | 15 ++-- docs/telnet-console.adoc | 35 +++++---- docs/tip-concurrency.adoc | 10 ++- docs/tip-jersey-client.adoc | 10 ++- docs/tip-weblogic.adoc | 5 +- docs/tomee-and-eclipse.adoc | 10 ++- docs/tomee-and-hibernate.adoc | 15 ++-- docs/tomee-and-security.adoc | 10 ++- docs/tomee-jaas.adoc | 25 +++--- docs/tomee-logging-in-eclipse.adoc | 5 +- docs/tomee-maven-plugin.adoc | 15 ++-- docs/tomee-mp-getting-started.adoc | 30 +++++--- docs/tomee-webapp.adoc | 10 ++- docs/topic-config.adoc | 10 ++- docs/transaction-annotations.adoc | 20 +++-- docs/transactionmanager-config.adoc | 10 ++- docs/understanding-callbacks.adoc | 15 ++-- docs/understanding-the-directory-layout.adoc | 10 ++- docs/unix-daemon.adoc | 55 ++++++++------ docs/validation-tool.adoc | 5 +- 132 files changed, 1413 insertions(+), 954 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/Configuring-in-tomee.adoc ---------------------------------------------------------------------- diff --git a/docs/Configuring-in-tomee.adoc b/docs/Configuring-in-tomee.adoc index bc26314..4e3ebb2 100644 --- a/docs/Configuring-in-tomee.adoc +++ b/docs/Configuring-in-tomee.adoc @@ -26,13 +26,15 @@ License. For example, -.... +[source,java] +---- @Resource DataSource moviesDatabase -.... +---- is injected with the following resource: -.... +[source,java] +---- <Resource id="moviesDatabase" type="DataSource"> JdbcDriver org.hsqldb.jdbcDriver JdbcUrl jdbc:mysql:localhost:3306/moviesdb @@ -40,7 +42,7 @@ UserName sa Password secret JtaManaged true </Resource> -.... +---- For more on how to configure, read through link:/configuring-datasources.html[configuring-datasources], http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/activemqresourceadapter-config.adoc ---------------------------------------------------------------------- diff --git a/docs/activemqresourceadapter-config.adoc b/docs/activemqresourceadapter-config.adoc index 1402427..aeb9b02 100644 --- a/docs/activemqresourceadapter-config.adoc +++ b/docs/activemqresourceadapter-config.adoc @@ -10,14 +10,15 @@ A ActiveMQResourceAdapter can be declared via xml in the using a declaration like the following. All properties in the element body are optional. -.... +[source,java] +---- <Resource id="myActiveMQResourceAdapter" type="ActiveMQResourceAdapter"> brokerXmlConfig = broker:(tcp://localhost:61616)?useJmx=false dataSource = Default Unmanaged JDBC Database serverUrl = vm://localhost?waitForStart=20000&async=true startupTimeout = 10 seconds </Resource> -.... +---- Alternatively, a ActiveMQResourceAdapter can be declared via properties in the `<tomee-home>/conf/system.properties` file or via Java @@ -25,13 +26,14 @@ VirtualMachine `-D` properties. The properties can also be used when embedding TomEE via the `javax.ejb.embeddable.EJBContainer` API or `InitialContext` -.... +[source,java] +---- myActiveMQResourceAdapter = new://Resource?type=ActiveMQResourceAdapter myActiveMQResourceAdapter.brokerXmlConfig = broker:(tcp://localhost:61616)?useJmx=false myActiveMQResourceAdapter.dataSource = Default Unmanaged JDBC Database myActiveMQResourceAdapter.serverUrl = vm://localhost?waitForStart=20000&async=true myActiveMQResourceAdapter.startupTimeout = 10 seconds -.... +---- Properties and xml can be mixed. Properties will override the xml allowing for easy configuration change without the need for $\{} style http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/admin/configuration/resources.adoc ---------------------------------------------------------------------- diff --git a/docs/admin/configuration/resources.adoc b/docs/admin/configuration/resources.adoc index dc8d84a..30398f5 100644 --- a/docs/admin/configuration/resources.adoc +++ b/docs/admin/configuration/resources.adoc @@ -568,5 +568,3 @@ Declarable in properties via ---- Foo = new://Resource?type=ContextService ---- - - http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/admin/index.adoc ---------------------------------------------------------------------- diff --git a/docs/admin/index.adoc b/docs/admin/index.adoc index 9c10d63..57239ad 100644 --- a/docs/admin/index.adoc +++ b/docs/admin/index.adoc @@ -4,4 +4,4 @@ :jbake-status: published :jbake-tomeepdf: -Click link:../docs.html[here] to find the documentation for administrators. \ No newline at end of file +Click link:../docs.html[here] to find the documentation for administrators. http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/advanced/client/jndi.adoc ---------------------------------------------------------------------- diff --git a/docs/advanced/client/jndi.adoc b/docs/advanced/client/jndi.adoc index 0d1b975..09ea035 100644 --- a/docs/advanced/client/jndi.adoc +++ b/docs/advanced/client/jndi.adoc @@ -111,5 +111,3 @@ Finally if you don't use `Authorization` header you can change the used header s NOTE: `authorization`, `authorizationHeader`, `basic.username`, and `basic.password` are removed from the URL before opening the connection and therefore not logged in the remote server access log since version 7.0.3. - - http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/advanced/index.adoc ---------------------------------------------------------------------- diff --git a/docs/advanced/index.adoc b/docs/advanced/index.adoc index 7928b61..28c1b23 100644 --- a/docs/advanced/index.adoc +++ b/docs/advanced/index.adoc @@ -4,4 +4,4 @@ :jbake-status: published :jbake-tomeepdf: -Click link:../docs.html[here] to find advanced documentation. \ No newline at end of file +Click link:../docs.html[here] to find advanced documentation. http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/advanced/setup/index.adoc ---------------------------------------------------------------------- diff --git a/docs/advanced/setup/index.adoc b/docs/advanced/setup/index.adoc index 4fe684d..2dd1695 100644 --- a/docs/advanced/setup/index.adoc +++ b/docs/advanced/setup/index.adoc @@ -139,4 +139,3 @@ source "$proc_script_base/bin/setenv.sh" # we support parameters like timeout and force, typically we would call it this way: ./shutdown 1200 -force "$CATALINA_HOME/bin/shutdown.sh" "$@" ---- - http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/alternate-descriptors.adoc ---------------------------------------------------------------------- diff --git a/docs/alternate-descriptors.adoc b/docs/alternate-descriptors.adoc index 8818a72..65c6822 100644 --- a/docs/alternate-descriptors.adoc +++ b/docs/alternate-descriptors.adoc @@ -40,14 +40,15 @@ app like this: Just initialize your test case like so: -.... +[source,java] +---- Properties properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); properties.setProperty("openejb.altdd.prefix", "test"); InitialContext initialContext = new InitialContext(properties); -.... +---- The logical result will be the prefixed file replacing the non-prefixed file as the active descriptor: @@ -85,12 +86,13 @@ both have their own ejb-jar.xml files: The "foo" test case could set the _openejb.altdd.prefix_ as follows: -.... +[source,java] +---- //... properties.setProperty("openejb.altdd.prefix", "footest, test"); InitialContext initialContext = new InitialContext(properties); -.... +---- Resulting the following logical view of the app: @@ -100,12 +102,13 @@ Resulting the following logical view of the app: And the "bar" test case could set the _openejb.altdd.prefix_ as follows: -.... +[source,java] +---- //... properties.setProperty("openejb.altdd.prefix", "footest, test"); InitialContext initialContext = new InitialContext(properties); -.... +---- Resulting the following logical view of the app: http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/annotations,-xml-and-defaults.adoc ---------------------------------------------------------------------- diff --git a/docs/annotations,-xml-and-defaults.adoc b/docs/annotations,-xml-and-defaults.adoc index 8849c9d..b0b2204 100644 --- a/docs/annotations,-xml-and-defaults.adoc +++ b/docs/annotations,-xml-and-defaults.adoc @@ -5,9 +5,10 @@ :jbake-status: published -.... +[source,java] +---- <p>The following is a list of all annotations and their attributes, the xml tags that correspond to them (for overriding), and what the default values are when left unspecified.</p> -.... +---- Annotation @@ -15,6 +16,7 @@ xml element(s) default value -.... +[source,java] +---- </div> -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/application-composer/advanced.adoc ---------------------------------------------------------------------- diff --git a/docs/application-composer/advanced.adoc b/docs/application-composer/advanced.adoc index 1ce9b66..ceff0c7 100644 --- a/docs/application-composer/advanced.adoc +++ b/docs/application-composer/advanced.adoc @@ -8,13 +8,14 @@ of inputs but you caneven go further. You can reuse existing file descriptors using `@Descriptors`. The name is the file name and the path either a classpath path or a file path: -.... +[source,java] +---- // runner if needed etc... @Descriptors(@Descriptor(name = "persistence.xml", path = "META-INF/persistence.xml")) public class MyTest { //... } -.... +---- Note: this can be put in a `@Module` method as well. @@ -25,13 +26,14 @@ services. To do so just add the needed dependency and use `@EnableServices`: -.... +[source,java] +---- // runner if needed etc... @EnableService("jaxrs") // jaxws supported as well public class MyTest { //... } -.... +---- === Random port @@ -43,13 +45,14 @@ To shortcut all the needed logic you can use `@RandomPort`. It is simply an injection giving you either the port (`int`) or the root context (`URL`): -.... +[source,java] +---- // runner, services if needed etc... public class MyTest { @RandomPort("http") private int port; } -.... +---- Note: you can generate this way multiple ports. The value is the name of the service it will apply on (being said http is an alias for httpejbd @@ -69,14 +72,15 @@ JAXRS provider you want to use. `@Jars` allows you to add dependencies (scanned) to your application automatically (like CDI libraries): -.... +[source,java] +---- @Module @Classes(cdi = true, value = { C1.class, C2.class, E1.class }) @Jars("deltaspike-") public WebApp app() { return new WebApp(); } -.... +---- === @Default http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/application-composer/getting-started.adoc ---------------------------------------------------------------------- diff --git a/docs/application-composer/getting-started.adoc b/docs/application-composer/getting-started.adoc index 9465c97..5f336e0 100644 --- a/docs/application-composer/getting-started.adoc +++ b/docs/application-composer/getting-started.adoc @@ -10,35 +10,38 @@ To start using ApplicationComposer you need to add some dependencies. The minimum required one is `openejb-core`: -.... +[source,java] +---- <dependency> <groupId>org.apache.openejb</groupId> <artifactId>openejb-core</artifactId> <version>${openejb.version></version> </dependency> -.... +---- If you need JAXRS services you'll add (or replace thanks to transitivity of maven) `openejb-cxf-rs`: -.... +[source,java] +---- <dependency> <groupId>org.apache.openejb</groupId> <artifactId>openejb-cxf-rs</artifactId> <version>${openejb.version></version> </dependency> -.... +---- If you need JAXWS services you'll add (or replace thanks to transitivity of maven) `openejb-cxf`: -.... +[source,java] +---- <dependency> <groupId>org.apache.openejb</groupId> <artifactId>openejb-cxf</artifactId> <version>${openejb.version></version> </dependency> -.... +---- etc... @@ -77,13 +80,14 @@ module and some scanned classes. For instance the following snippet will create a web application with classes C1, C2 as CDI beans and E1 as an EJB automatically: -.... +[source,java] +---- @Module @Classes(cdi = true, value = { C1.class, C2.class, E1.class }) public WebApp app() { return new WebApp(); } -.... +---- ==== @Configuration @@ -99,7 +103,8 @@ resources. Here is a sample: -.... +[source,java] +---- @Configuration public Properties configuration() { return new PropertiesBuilder() @@ -107,12 +112,13 @@ public Properties configuration() { .p("db.JdbcUrld", "jdbc:hsqldb:mem:test") .build(); } -.... +---- Since TomEE 2.x you can also put properties on ApplicationComposer class using `@ContainerProperties` API: -.... +[source,java] +---- @ContainerProperties({ @ContainerProperties.Property(name = "db", value = "new://Resource?type=DataSource"), @ContainerProperties.Property(name = "db.JdbcUrl", value = "jdbc:hsqldb:mem:test") @@ -120,7 +126,7 @@ using `@ContainerProperties` API: public class MyAppComposer() { // ... } -.... +---- ==== @Component @@ -135,12 +141,13 @@ Components in TomEE are stored in a container Map and the key needs to be a `Class`. This one is deduced from the returned type of the `@Component` method: -.... +[source,java] +---- @Component public SecurityService mockSecurity() { return new MySecurityService(); } -.... +---- === How to run it? @@ -183,7 +190,8 @@ if the test class was a managed bean! Since TomEE 2.x you can also use `ApplicationComposers` to directly run you ApplicationComposer model as a standalone application: -.... +[source,java] +---- public class MyApp { public static void main(String[] args) { ApplicationComposers.run(MyApp.class, args); @@ -191,7 +199,7 @@ public class MyApp { // @Module, @Configuration etc... } -.... +---- Tip: if `MyApp` has `@PostConstruct` methods they will be respected and if `MyApp` has a constructor taking an array of String it will be @@ -201,7 +209,8 @@ depending it!) === JUnit Sample -.... +[source,java] +---- @Classes(cdi = true, value = { MyService.class, MyOtherService.class }) @ContainerProperties(@ContainerProperties.Property(name = "myDb", value = "new://Resource?type=DataSource")) @RunWith(ApplicationComposer.class) @@ -217,7 +226,7 @@ public class MyTest { // do test using injections } } -.... +---- === Going further http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/application-deployment-solutions.adoc ---------------------------------------------------------------------- diff --git a/docs/application-deployment-solutions.adoc b/docs/application-deployment-solutions.adoc index 68a06f8..ef36bd5 100644 --- a/docs/application-deployment-solutions.adoc +++ b/docs/application-deployment-solutions.adoc @@ -51,15 +51,17 @@ pom you have access to the following configuration: Then simply run -.... +[source,java] +---- mvn tomee:deploy <path> -.... +---- or -.... +[source,java] +---- mvn tomee:undeploy <path> -.... +---- ===== The Deployer through TomEE Webapp http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/application-discovery-via-the-classpath.adoc ---------------------------------------------------------------------- diff --git a/docs/application-discovery-via-the-classpath.adoc b/docs/application-discovery-via-the-classpath.adoc index 8984c24..9934d5b 100644 --- a/docs/application-discovery-via-the-classpath.adoc +++ b/docs/application-discovery-via-the-classpath.adoc @@ -13,9 +13,10 @@ like deployed while in an embedded mode. Simplify the issue of searching for annotated applications by adding an ejb-jar.xml like this to your app: -.... +[source,java] +---- <ejb-jar/> -.... +---- OpenEJB will find the app in the classpath and deploy it along with any annotated beans it may contain. @@ -67,23 +68,25 @@ _openejb.exclude-include.order_ properties if you wish to work in the opposite direction or change the processing order. The default values for the properties are as follows: -.... +[source,java] +---- openejb.exclude-include.order=include-exclude //Defines the processing order openejb.deployments.classpath.include="" //Include nothing openejb.deployments.classpath.exclude=".*" //Exclude everything -.... +---- The exclude and the include are applied separately and the results of each are combined together to create the list of paths OpenEJB will scrape for annotations. -.... +[source,java] +---- *Note:* by default these settings will only affect which jars OpenEJB will scan for annotated components when no descriptor is found. If you would like to use these settings to also filter out jars that do contain descriptors, set the *openejb.deployments.classpath.filter.descriptors* property to _true_. The default is _false_. -.... +---- == Troubleshooting @@ -97,11 +100,12 @@ for your ejb module is in the classpath, a little debug code like this in your test setup will help you see what OpenEJB sees (which may be nothing): -.... +[source,java] +---- Enumeration<URL> ejbJars = this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml"); while (ejbJars.hasMoreElements()) { URL url = ejbJars.nextElement(); System.out.println("app = " + url); } -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/application-resources.adoc ---------------------------------------------------------------------- diff --git a/docs/application-resources.adoc b/docs/application-resources.adoc index ac85da5..37f5366 100644 --- a/docs/application-resources.adoc +++ b/docs/application-resources.adoc @@ -18,11 +18,12 @@ available server-wide, whereas defining the resource within a As a simple example, a JMS queue can be defined within `tomee.xml` with the following configuration. -.... +[source,java] +---- <tomee> <Resource id="MyQueue" type="javax.jms.Queue"/> </tomee> -.... +---- Once the resource has been defined, the server will create an instance of the resource during startup, and it will be available to be injected @@ -30,7 +31,8 @@ into managed components using the `@Resource` annotation, as shown below. The `name` attribute on the `@Resource` annotation should match the `id` attribute on the `Resource` tag. -.... +[source,java] +---- public class JmsClient { @Resource(name="MyQueue") @@ -41,14 +43,15 @@ public class JmsClient { } } -.... +---- As an alternative to defining a resource in XML, resources can also be defined using system properties: -.... +[source,java] +---- MyQueue = new://Resource?type=javax.jms.Queue -.... +---- Resources, or attributes for resources specified using system properties will override definitions specified in `tomee.xml`. Server-wide @@ -66,14 +69,15 @@ and password to be able to connect to a database. That would be configured with the following syntax. Notice the key/value pair syntax for the properties within the `<Resource>` tag. -.... +[source,java] +---- <Resource id="DB" type="DataSource"> JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost/test UserName test Password password </Resource> -.... +---- Specifying the key/value pairs specific to a Resource can also be done when defining the resource via system properties. This is done be @@ -81,13 +85,14 @@ specifying an additional property for each key/value pair, using the resource ID as a prefix: `<resourceId>.<propertyName>=<value>`. The system properties equivalent of the resource above is: -.... +[source,java] +---- p.setProperty("DB", "new://Resource?type=DataSource"); p.setProperty("DB.JdbcDriver", "com.mysql.jdbc.Driver"); p.setProperty("DB,JdbcUrl", "jdbc:mysql://localhost/test"); p.setProperty("DB.UserName", "test"); p.setProperty("DB.Password", "password"); -.... +---- The `<Resource>` tag has a number of attributes which control the way that the resource get created. @@ -131,7 +136,8 @@ known resource types are. So the following simple resource -.... +[source,java] +---- public class Configuration { private String url; @@ -140,18 +146,19 @@ public class Configuration { // getters and setters } -.... +---- Can be defined in `tomee.xml` using the following configuration (note the `class-name` attribute): -.... +[source,java] +---- <Resource id="config" class-name="org.superbiz.Configuration"> url http://localhost username tomee poolSize 20 </Resource> -.... +---- This resource must be available in TomEE's system classpath - i.e. it must be defined in a .jar within the `lib/` directory. @@ -167,7 +174,8 @@ below, and this will have any used properties from the resource configuration set added to it. So as an alternative to the above code, you could do: -.... +[source,java] +---- public class Configuration { private Properties properties; @@ -181,17 +189,18 @@ public class Configuration { } } -.... +---- Using the same resource definition: -.... +[source,java] +---- <Resource id="config" class-name="org.superbiz.Configuration"> url http://localhost username tomee poolSize 20 </Resource> -.... +---- the url, username and poolSize values will now be available in the properties field, so for example, the username property could be @@ -208,7 +217,8 @@ The format of `resources.xml` uses the same `<Resource>` tag as `tomee.xml`. One key difference is the root element of the XML is `<resources>` and not `<tomee>`. -.... +[source,java] +---- <resources> <Resource id="config" class-name="org.superbiz.Configuration"> url http://localhost @@ -216,7 +226,7 @@ The format of `resources.xml` uses the same `<Resource>` tag as poolSize 20 </Resource> </resources> -.... +---- This mechanism allows you to package your custom resources within your application, alongside your application code, rather than requiring a @@ -271,13 +281,14 @@ specified on the `Resource`, TomEE will instantiate the resource using its no-arg constructor. If you wish to pass constructor arguments, specify the arguments as a comma separated list: -.... +[source,java] +---- <Resource id="config" class-name="org.superbiz.Configuration" constructor="id, poolSize"> url http://localhost username tomee poolSize 20 </Resource> -.... +---- === factory-name method @@ -290,7 +301,8 @@ no argument method that returns an object on the class specified in the For example: -.... +[source,java] +---- public class Factory { private Properties properties; @@ -318,7 +330,7 @@ public class Factory { UserName tomee </Resource> </resources> -.... +---- === @PostConstruct / @PreDestroy @@ -331,7 +343,8 @@ destroyed. Using @PostConstruct will effectively force a lazily loaded resource to be instantiated when the application is starting - in the same way that the `InitializeAfterDeployment` property does. -.... +[source,java] +---- public class MyClass { private Properties properties; @@ -351,7 +364,7 @@ public class MyClass { } } -.... +---- == Examples http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/arquillian-available-adapters.adoc ---------------------------------------------------------------------- diff --git a/docs/arquillian-available-adapters.adoc b/docs/arquillian-available-adapters.adoc index dd9c074..23ddf58 100644 --- a/docs/arquillian-available-adapters.adoc +++ b/docs/arquillian-available-adapters.adoc @@ -11,7 +11,8 @@ if you are not at all familiar with Arquillian. All the Arquillian Adapters for TomEE support the following configuration options in the *src/test/resources/arquillian.xml*: -.... +[source,java] +---- <container qualifier="tomee" default="true"> <configuration> <property name="httpPort">-1</property> @@ -27,12 +28,13 @@ configuration options in the *src/test/resources/arquillian.xml*: --> </configuration> </container> -.... +---- The above can also be set as system properties rather than via the *src/test/resources/arquillian.xml* file. -.... +[source,java] +---- <build> <plugins> <plugin> @@ -47,7 +49,7 @@ The above can also be set as system properties rather than via the </plugin> </plugins> </build> -.... +---- When a port is set to -1, a random port will be chosen. This is key to avoiding port conflicts on CI systems or for just plain clean testing. @@ -56,21 +58,23 @@ The TomEE Arquillian adapters will export the actual port chosen back as a system property using the same name. The test case can use the property to retrieve the port and contact the server. -.... +[source,java] +---- URL url = new URL("http://localhost:" + System.getProperty("tomee.httpPort"); // use the URL to connect to the server -.... +---- If that property returns null When you are actually using a test on the client side, you can use instead -.... +[source,java] +---- import org.jboss.arquillian.test.api.ArquillianResource; ... @ArquillianResource private URL url; -.... +---- The URL will get injected by Arquillian. Be careful, that injection only works if your are on the client side (it does not make sense in the @@ -89,7 +93,8 @@ Adapter. To use the TomEE Embedded Arquillian Adapter, simply add these Maven dependencies to your Maven pom.xml: -.... +[source,java] +---- <dependency> <groupId>org.apache.openejb</groupId> <artifactId>arquillian-tomee-embedded</artifactId> @@ -111,7 +116,7 @@ dependencies to your Maven pom.xml: <artifactId>tomee-jaxrs</artifactId> <version>1.7.1</version> </dependency> -.... +---- As mentioned above the Embedded Adapter has the following properties which can be specified in the *src/test/resources/arquillian.xml* file: @@ -142,16 +147,18 @@ the production system environment. On a local machine clients can get the remote server port using the following System property: -.... +[source,java] +---- final String port = System.getProperty("server.http.port"); -.... +---- The following shows a typical configuration for testing against TomEE (webprofile version). The same can be done against TomEE+ by changing `<tomee.classifier>webprofile</tomee.classifier>` to `<tomee.classifier>plus</tomee.classifier>` -.... +[source,java] +---- <properties> <tomee.version>1.7.1</tomee.version> <tomee.classifier>webprofile</tomee.classifier> @@ -184,7 +191,7 @@ The following shows a typical configuration for testing against TomEE <type>zip</type> </dependency> </dependencies> -.... +---- The Remote Adapter has the following properties which can be specified in the *src/test/resources/arquillian.xml* file: @@ -218,7 +225,8 @@ Setting up both adapters is quite easy via Maven profiles. Here the default adapter is the Embedded Adapter, the Remote Adapter will run with `-Ptomee-webprofile-remote` specified as a `mvn` command argument. -.... +[source,java] +---- <profiles> <profile> @@ -308,4 +316,4 @@ with `-Ptomee-webprofile-remote` specified as a `mvn` command argument. </profile> </profiles> -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/basics---security.adoc ---------------------------------------------------------------------- diff --git a/docs/basics---security.adoc b/docs/basics---security.adoc index 56b5ec6..970da63 100644 --- a/docs/basics---security.adoc +++ b/docs/basics---security.adoc @@ -38,7 +38,8 @@ For example, here is an EJB that returns another bean, through a remote method call. In this case, the _OtherBean_ instance, will have the same security as _MyBean_, including the principal (username), roles, etc. -.... +[source,java] +---- import javax.ejb.EJB; import javax.naming.InitialContext; @@ -51,4 +52,4 @@ public class MyBean return (IOtherBean) context.lookup("java:comp/env/otherBean"); } } -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/bmpentitycontainer-config.adoc ---------------------------------------------------------------------- diff --git a/docs/bmpentitycontainer-config.adoc b/docs/bmpentitycontainer-config.adoc index 977b873..918e14d 100644 --- a/docs/bmpentitycontainer-config.adoc +++ b/docs/bmpentitycontainer-config.adoc @@ -10,11 +10,12 @@ A BmpEntityContainer can be declared via xml in the using a declaration like the following. All properties in the element body are optional. -.... +[source,java] +---- <Container id="myBmpEntityContainer" type="BMP_ENTITY"> poolSize = 10 </Container> -.... +---- Alternatively, a BmpEntityContainer can be declared via properties in the `<tomee-home>/conf/system.properties` file or via Java @@ -22,10 +23,11 @@ VirtualMachine `-D` properties. The properties can also be used when embedding TomEE via the `javax.ejb.embeddable.EJBContainer` API or `InitialContext` -.... +[source,java] +---- myBmpEntityContainer = new://Container?type=BMP_ENTITY myBmpEntityContainer.poolSize = 10 -.... +---- Properties and xml can be mixed. Properties will override the xml allowing for easy configuration change without the need for $\{} style http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/bouncy-castle.adoc ---------------------------------------------------------------------- diff --git a/docs/bouncy-castle.adoc b/docs/bouncy-castle.adoc index f8288d0..631832e 100644 --- a/docs/bouncy-castle.adoc +++ b/docs/bouncy-castle.adoc @@ -28,9 +28,10 @@ directory The entry to `java.security` will look something like the following: -.... +[source,java] +---- security.provider.N=org.bouncycastle.jce.provider.BouncyCastleProvider -.... +---- Replace `N` with the order of precedence you would like to give Bouncy Castle in comparison to the other providers in the file. *Recommended* http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/built-in-type-converters.adoc ---------------------------------------------------------------------- diff --git a/docs/built-in-type-converters.adoc b/docs/built-in-type-converters.adoc index b8ab7c5..0a2228d 100644 --- a/docs/built-in-type-converters.adoc +++ b/docs/built-in-type-converters.adoc @@ -60,7 +60,8 @@ To use an OpenEJB additional type in xml, simply declare it as java.lang.String and it will be converted on the fly to the field/setter type used by the bean class. For example: -.... +[source,java] +---- package org.superbiz.foo; import java.util.Date; @@ -71,11 +72,12 @@ public class MyBean { @Resource private Date myDate; } -.... +---- Works with an ejb-jar.xml as follows: -.... +[source,java] +---- <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0" metadata-complete="false"> <enterprise-beans> @@ -89,10 +91,11 @@ metadata-complete="false"> </session> </enterprise-beans> </ejb-jar> -.... +---- Or with an env-entries.properties file as follows: -.... +[source,java] +---- org.superbiz.foo.MyBean/myDate = 2008-04-19 -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/callbacks.adoc ---------------------------------------------------------------------- diff --git a/docs/callbacks.adoc b/docs/callbacks.adoc index 0e227b6..46e691a 100644 --- a/docs/callbacks.adoc +++ b/docs/callbacks.adoc @@ -28,7 +28,8 @@ throws Exception == Stateless -.... +[source,java] +---- import javax.ejb.Stateless; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; @@ -53,11 +54,12 @@ public class MyStatelessBean implements MyBusinessInterface { return invocationContext.proceed(); } } -.... +---- == Stateful -.... +[source,java] +---- import javax.ejb.Stateful; import javax.ejb.PostActivate; import javax.ejb.PrePassivate; @@ -94,11 +96,12 @@ public class MyStatefulBean implements MyBusinessInterface { } } -.... +---- == MessageDriven -.... +[source,java] +---- import javax.ejb.MessageDriven; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; @@ -123,11 +126,12 @@ public class MyMessageDrivenBean implements MyListenerInterface { return invocationContext.proceed(); } } -.... +---- == Interceptor -.... +[source,java] +---- import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.interceptor.InvocationContext; @@ -162,4 +166,4 @@ public class MyInterceptor { } } -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/changing-jms-implementations.adoc ---------------------------------------------------------------------- diff --git a/docs/changing-jms-implementations.adoc b/docs/changing-jms-implementations.adoc index b1dde18..220612a 100644 --- a/docs/changing-jms-implementations.adoc +++ b/docs/changing-jms-implementations.adoc @@ -48,7 +48,8 @@ These values can be overridden in the `tomee.xml` or `openejb.xml` Let's say that the following file lives in the jar at `META-INF/org.superbiz/service-jar.xml` -.... +[source,java] +---- <?xml version="1.0" encoding="UTF-8"?> <ServiceJar> <ServiceProvider @@ -115,7 +116,7 @@ Let's say that the following file lives in the jar at TopicClassName </ServiceProvider> </ServiceJar> -.... +---- It is strongly recommended to not leave the values in the service-jar.xml file blank as shown above. It is possible to setup @@ -127,21 +128,23 @@ Once this file is packed in a jar and added to the `<tomee.home>/lib` or "instances" of these things in your `tomee.xml` or `openejb.xml` config file as follows: -.... +[source,java] +---- <Resource id="My Generic Adapter" type="GenericJMSRA" provider="org.superbiz:genericra"> AdapterProperty1 PropertyValue1 AdapterProperty2 PropertyValue2 ... </Resource> -.... +---- Or in properties like so: -.... +[source,java] +---- myGenericAdapter = new://Resource?type=GenericJMSRA&provider=org.superbiz:genericra myGenericAdapter.AdapterProperty1 = PropertyValue1 myGenericAdapter.AdapterProperty2 = PropertyValue2 -.... +---- This is basically the same as all configuration in TomEE/OpenEJB, but with the addition that you must specify the `provider` attribute so the http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/clients.adoc ---------------------------------------------------------------------- diff --git a/docs/clients.adoc b/docs/clients.adoc index 48571ce..f31a34d 100644 --- a/docs/clients.adoc +++ b/docs/clients.adoc @@ -7,20 +7,22 @@ === Local Client (embedded container) -.... +[source,java] +---- Properties p = new Properties(); p.put("java.naming.factory.initial", "org.apache.openejb.client.LocalInitialContextFactory"); InitialContext ctx = new InitialContext(p); MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote"); -.... +---- === Local Client (non-default realm name) === Login configuration file (conf/login.config) -.... +[source,java] +---- PropertiesLogin { org.apache.openejb.core.security.jaas.PropertiesLoginModule required Debug=true @@ -33,11 +35,12 @@ MyApp { userSelect="SELECT username, password FROM users WHERE username=?" groupSelect="SELECT username, grp FROM users WHERE username=?"; }; -.... +---- === Code -.... +[source,java] +---- Properties p = new Properties(); p.put("java.naming.factory.initial", "org.apache.openejb.client.LocalInitialContextFactory"); p.put("openejb.authentication.realmName", "MyApp"); @@ -45,11 +48,12 @@ p.put("openejb.authentication.realmName", "MyApp"); InitialContext ctx = new InitialContext(p); MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote"); -.... +---- === Remote Client (openejb standalone) -.... +[source,java] +---- Properties p = new Properties(); p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); p.put("java.naming.provider.url", "ejbd://localhost:4201"); @@ -60,11 +64,12 @@ p.put("java.naming.security.credentials", "mypass"); InitialContext ctx = new InitialContext(p); MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote"); -.... +---- === Remote Client with HTTP (openejb standalone) -.... +[source,java] +---- Properties p = new Properties(); p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); p.put("java.naming.provider.url", "http://localhost:4204/ejb"); @@ -75,11 +80,12 @@ p.put("java.naming.security.credentials", "mypass"); InitialContext ctx = new InitialContext(p); MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote"); -.... +---- === Remote Client with HTTP (in TomEE) -.... +[source,java] +---- Properties p = new Properties(); p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); p.put("java.naming.provider.url", "http://127.0.0.1:8080/tomee/ejb"); @@ -90,6 +96,6 @@ p.put("java.naming.security.credentials", "mypass"); InitialContext ctx = new InitialContext(p); MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote"); -.... +---- === Remote Client using @EJB Injection see here: ejb-refs http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/cmpentitycontainer-config.adoc ---------------------------------------------------------------------- diff --git a/docs/cmpentitycontainer-config.adoc b/docs/cmpentitycontainer-config.adoc index c3aa59a..cfdeddd 100644 --- a/docs/cmpentitycontainer-config.adoc +++ b/docs/cmpentitycontainer-config.adoc @@ -10,11 +10,12 @@ A CmpEntityContainer can be declared via xml in the using a declaration like the following. All properties in the element body are optional. -.... +[source,java] +---- <Container id="myCmpEntityContainer" type="CMP_ENTITY"> cmpEngineFactory = org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory </Container> -.... +---- Alternatively, a CmpEntityContainer can be declared via properties in the `<tomee-home>/conf/system.properties` file or via Java @@ -22,10 +23,11 @@ VirtualMachine `-D` properties. The properties can also be used when embedding TomEE via the `javax.ejb.embeddable.EJBContainer` API or `InitialContext` -.... +[source,java] +---- myCmpEntityContainer = new://Container?type=CMP_ENTITY myCmpEntityContainer.cmpEngineFactory = org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory -.... +---- Properties and xml can be mixed. Properties will override the xml allowing for easy configuration change without the need for $\{} style http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/common-datasource-configurations.adoc ---------------------------------------------------------------------- diff --git a/docs/common-datasource-configurations.adoc b/docs/common-datasource-configurations.adoc index 872b9cd..f453e92 100644 --- a/docs/common-datasource-configurations.adoc +++ b/docs/common-datasource-configurations.adoc @@ -13,18 +13,20 @@ details on all configuration options for DataSources. The drivers are included with OpenEJB 3.0 and HSQLDB is the default database. -.... +[source,java] +---- <Resource id="HSQLDB Database" type="DataSource"> JdbcDriver org.hsqldb.jdbcDriver JdbcUrl jdbc:hsqldb:file:hsqldb UserName sa Password </Resource> -.... +---- == Derby (Embedded) -.... +[source,java] +---- <Resource id="Derby Database" type="DataSource"> #Embedded Derby example @@ -33,11 +35,12 @@ database. UserName admin Password pass </Resource> -.... +---- == MySQL -.... +[source,java] +---- <Resource id="MySQL Database" type="DataSource"> # MySQL example # @@ -48,11 +51,12 @@ database. JdbcUrl jdbc:mysql://localhost/test UserName test </Resource> -.... +---- == Oracle -.... +[source,java] +---- <Resource id="Oracle Database" type="DataSource"> # Oracle example # @@ -63,11 +67,12 @@ database. UserName scott Password tiger </Resource> -.... +---- == OracleXA -.... +[source,java] +---- <Resource id="OracleXA Database" type="DataSource"> # OracleXA example # @@ -78,11 +83,12 @@ database. UserName scott Password tiger </Resource> -.... +---- == PosgreSQL -.... +[source,java] +---- <Resource id="PostgreSQL Database" type="DataSource"> # PostgreSQL example # @@ -93,11 +99,12 @@ database. UserName postgres Password pass </Resource> -.... +---- == InstantDB -.... +[source,java] +---- <Resource id="InstantDB Database" type="DataSource"> # InstantDB example # @@ -106,7 +113,7 @@ database. UserName Admin Password pass </Resource> -.... +---- Internally, from TomEE 1.5.0, JDBC pools are managed via Tomcat-pool. You can still switch back to Apache Commons DBCP by adding the following http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/common-persistenceprovider-properties.adoc ---------------------------------------------------------------------- diff --git a/docs/common-persistenceprovider-properties.adoc b/docs/common-persistenceprovider-properties.adoc index 53d0145..cd4936c 100644 --- a/docs/common-persistenceprovider-properties.adoc +++ b/docs/common-persistenceprovider-properties.adoc @@ -10,7 +10,8 @@ various persistence providers out there. # TopLink -.... +[source,java] +---- <properties> <!--http://www.oracle.com/technology/products/ias/toplink/JPA/essentials/toplink-jpa-extensions.html--> @@ -19,11 +20,12 @@ various persistence providers out there. <property name="toplink.ddl-generation.output-mode" value="both"/> <property name="toplink.target-server" value="pl.zsk.samples.ejbservice.OpenEJBServerPlatform"/> </properties> -.... +---- # OpenJPA -.... +[source,java] +---- <properties> <!--http://openjpa.apache.org/faq.html--> <!-- does not create foreign keys, creates schema and deletes content of a database @@ -35,13 +37,14 @@ various persistence providers out there. <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/> <property name="openjpa.Log" value="DefaultLevel=TRACE,SQL=TRACE" /> </properties> -.... +---- # Hibernate -.... +[source,java] +---- <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.transaction.manager_lookup_class" value="org.apache.openejb.hibernate.TransactionManagerLookup"/> </properties> -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/configuration.adoc ---------------------------------------------------------------------- diff --git a/docs/configuration.adoc b/docs/configuration.adoc index 2e8bd5a..371fa14 100644 --- a/docs/configuration.adoc +++ b/docs/configuration.adoc @@ -32,7 +32,8 @@ OpenEJB saves deployment descriptors - ejb-jar.xml and openejb-jar.xml Show a config file with the elements hyperlinked. -.... +[source,java] +---- <?xml version="1.0"?> <openejb> <Container id="Default CMP Container" ctype="CMP_ENTITY"> @@ -50,7 +51,7 @@ Show a config file with the elements hyperlinked. <Deployments jar="c:/my/app/employee.jar"/> <Deployments dir="beans/" /> </openejb> -.... +---- == Basic Layout @@ -98,14 +99,15 @@ openejb.home are added to the classpath. A summary of the above in a different notation: -.... +[source,java] +---- 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 @@ -115,7 +117,8 @@ jars by name (abc-ejbs.jar and xyz-ejbs.jar). An example layout: -.... +[source,java] +---- /usr/local/openejb (openejb.home) /usr/local/openejb/lib (in classpath) /usr/local/openejb/dist (in classpath) @@ -125,7 +128,7 @@ An example layout: /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 @@ -134,7 +137,8 @@ explicit paths for the openejb and log4j configuration files. An example layout: -.... +[source,java] +---- /usr/local/openejb (openejb.home) /usr/local/openejb/lib (in classpath) /usr/local/openejb/dist (in classpath) @@ -144,4 +148,4 @@ An example layout: /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/66e0d661/docs/configuring-containers-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-containers-in-tests.adoc b/docs/configuring-containers-in-tests.adoc index b288c81..02542fa 100644 --- a/docs/configuring-containers-in-tests.adoc +++ b/docs/configuring-containers-in-tests.adoc @@ -10,7 +10,8 @@ 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. -.... +[source,java] +---- Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); @@ -19,7 +20,7 @@ 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 http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/configuring-datasources-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-datasources-in-tests.adoc b/docs/configuring-datasources-in-tests.adoc index 45210e4..a1aa375 100644 --- a/docs/configuring-datasources-in-tests.adoc +++ b/docs/configuring-datasources-in-tests.adoc @@ -10,7 +10,8 @@ properties You can configure data sources from within your test case (avoiding the need for an `openejb.xml` entirely) like so: -.... +[source,java] +---- Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); @@ -20,22 +21,24 @@ 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: -.... +[source,java] +---- 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"); -.... +[source,java] +---- This will allow an application to communicate through legacy drivers to the same JDBC provider. http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/configuring-datasources.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-datasources.adoc b/docs/configuring-datasources.adoc index d490067..8d1ec8a 100644 --- a/docs/configuring-datasources.adoc +++ b/docs/configuring-datasources.adoc @@ -14,43 +14,48 @@ attributes. For example, this annotation in your bean: -.... +[source,java] +---- @Resource(name = "myDerbyDatasource", type = javax.sql.DataSource.class) -.... +---- Would map to a Resource declared in your openejb.xml as follows: -.... +[source,java] +---- <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: -.... +[source,java] +---- <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: -.... +[source,java] +---- <Resource id="myDerbyDatasource" type="DataSource" classpath="/path/to/driver.jar"> . . . . <Resource> -.... +---- ...Or in a http://maven.apache.org/[Maven] environment like so: -.... +[source,java] +---- <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. @@ -75,22 +80,24 @@ link:dynamic-datasource.html[Dynamic Datasource] for more details. === Example 1 -.... +[source,java] +---- <Resource id="Default JDBC Database" type="DataSource"> . . . . . </Resource> -.... +---- The global jndi name would be _java:openejb/Resource/Default JDBC Database_ === Example 2 -.... +[source,java] +---- <Resource id="Derby Database" type="DataSource"> . . . . . </Resource> -.... +---- The global jndi name would be _java:openejb/Resource/Derby Database_ @@ -114,36 +121,40 @@ example of Derby. With a Resource declaration in your openejb.xml like this: -.... +[source,java] +---- <Resource id="myDerbyDatabase" type="DataSource"> . . . . . </Resource> -.... +---- There are several possible ways to refer to it, as follows. _BY matching variable name to resource name_ -.... +[source,java] +---- @Stateless public class FooBean { @Resource DataSource myDerbyDatabase; } -.... +---- _OR BY matching name_ -.... +[source,java] +---- @Stateless public class FooBean { @Resource(name="myDerbyDatabase") DataSource dataSource; } -.... +---- _OR BY JNDI lookup_ -.... +[source,java] +---- @Resource(name="myDerbyDatabase", type=javax.sql.DataSource.class) @Stateless public class FooBean { @@ -159,32 +170,35 @@ public class FooBean { initialContext.lookup("java:comp/env/myDerbyDatabase"); } } -.... +---- _OR_ -.... +[source,java] +---- <resource-ref> <res-ref-name>myDerbyDatabase</res-ref-name> <res-type>javax.sql.DataSource</res-type> </resource-ref> -.... +---- _OR_ -.... +[source,java] +---- <resource-ref> <res-ref-name>jdbc/myDerbyDatabase</res-ref-name> <res-type>javax.sql.DataSource</res-type> </resource-ref> -.... +---- _OR_ -.... +[source,java] +---- <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/66e0d661/docs/configuring-durations.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-durations.adoc b/docs/configuring-durations.adoc index cacfb7a..e68377d 100644 --- a/docs/configuring-durations.adoc +++ b/docs/configuring-durations.adoc @@ -29,7 +29,8 @@ be nice when using the abbreviated forms: Abbreviations are accepted as follows: -.... +[source,java] +---- if (u.equalsIgnoreCase("NANOSECONDS")) return TimeUnit.NANOSECONDS; if (u.equalsIgnoreCase("NANOSECOND")) return TimeUnit.NANOSECONDS; if (u.equalsIgnoreCase("NANOS")) return TimeUnit.NANOSECONDS; @@ -66,4 +67,4 @@ Abbreviations are accepted as follows: 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/66e0d661/docs/configuring-javamail.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-javamail.adoc b/docs/configuring-javamail.adoc index c924b2c..21457f3 100644 --- a/docs/configuring-javamail.adoc +++ b/docs/configuring-javamail.adoc @@ -12,7 +12,8 @@ javax.mail.Session.getDefaultInstance(Properties props). Here might be some example properties. -.... +[source,java] +---- <Resource id="SuperbizMail" type="javax.mail.Session"> mail.smtp.host=mail.superbiz.org mail.smtp.port=25 @@ -21,7 +22,7 @@ Here might be some example properties. 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'. @@ -37,6 +38,7 @@ values before attempting to use them. If you wanted to do a System property or InitialContext property override of the above example mail session, you could do so like this: -.... +[source,java] +---- java ... -DSuperbizMail.mail.smtp.host=localhost -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/configuring-logging-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-logging-in-tests.adoc b/docs/configuring-logging-in-tests.adoc index 6a3461a..cf8d660 100644 --- a/docs/configuring-logging-in-tests.adoc +++ b/docs/configuring-logging-in-tests.adoc @@ -45,7 +45,8 @@ 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: -.... +[source,java] +---- Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); @@ -66,7 +67,7 @@ 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 @@ -91,7 +92,8 @@ source of logging information. For your purposes, here are the contents of the default embedded.logging.properties file contained in OpenEJB 3.1.1 -.... +[source,java] +---- log4j.rootLogger = fatal,C log4j.category.OpenEJB = warn log4j.category.OpenEJB.server = info @@ -107,7 +109,7 @@ 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://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/configuring-persistenceunits-in-tests.adoc ---------------------------------------------------------------------- diff --git a/docs/configuring-persistenceunits-in-tests.adoc b/docs/configuring-persistenceunits-in-tests.adoc index f499814..7291b3a 100644 --- a/docs/configuring-persistenceunits-in-tests.adoc +++ b/docs/configuring-persistenceunits-in-tests.adoc @@ -33,7 +33,8 @@ properties or the initial context properties. The format is: So for example with the following persistence.xml: -.... +[source,java] +---- <persistence> <persistence-unit name="movie-unit"> <provider>org.hibernate.ejb.HibernatePersistence</provider> @@ -45,13 +46,14 @@ So for example with the following persistence.xml: </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). -.... +[source,java] +---- Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.LocalInitialContextFactory"); @@ -59,7 +61,7 @@ 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. @@ -89,7 +91,8 @@ below. Note that you *must* use the *unit name* as the prefix. This will not work: -.... +[source,java] +---- Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.LocalInitialContextFactory"); @@ -97,7 +100,7 @@ work: 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. http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/constructor-injection.adoc ---------------------------------------------------------------------- diff --git a/docs/constructor-injection.adoc b/docs/constructor-injection.adoc index abe0531..b85cece 100644 --- a/docs/constructor-injection.adoc +++ b/docs/constructor-injection.adoc @@ -12,7 +12,8 @@ your wish has come true. This is a feature we intended to add to OpenEJB 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. -.... +[source,java] +---- @Stateless public class WidgetBean implements Widget { @@ -39,12 +40,13 @@ public class WidgetBean implements Widget { return foo; } } -.... +---- The @EJB, @Resource, @PersistenceUnit, and @PersistenceContext annotations can be placed at the class-level instead such as: -.... +[source,java] +---- @Stateless @EJB(name = "foo", beanInterface = Foo.class, beanName = "FooBean") @Resource(name = "count", type = int.class) @@ -63,7 +65,7 @@ public class WidgetBean implements Widget { return foo; } } -.... +---- Currently this functionality relies on classes being compiled with debug symbols (the default compile setting for javac) as we use the debug @@ -80,7 +82,8 @@ mailto:[email protected][[email protected]] Not yet possible -.... +[source,java] +---- @Stateless public class WidgetBean implements Widget { @@ -97,4 +100,4 @@ public class WidgetBean implements Widget { return foo; } } -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/containers-and-resources.adoc ---------------------------------------------------------------------- diff --git a/docs/containers-and-resources.adoc b/docs/containers-and-resources.adoc index 1bb00d7..2384c6a 100644 --- a/docs/containers-and-resources.adoc +++ b/docs/containers-and-resources.adoc @@ -5,9 +5,10 @@ :jbake-status: published -.... +[source,java] +---- <p><a name="ContainersandResources-containers"></a></p> -.... +---- CMP_ENTITY http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/custom-injection.adoc ---------------------------------------------------------------------- diff --git a/docs/custom-injection.adoc b/docs/custom-injection.adoc index 33314f4..6cf8439 100644 --- a/docs/custom-injection.adoc +++ b/docs/custom-injection.adoc @@ -33,7 +33,8 @@ http://tomee.apache.org/downloads.html[download page]. == Bean Class -.... +[source,java] +---- @Stateless public class Stratocaster { @@ -79,17 +80,18 @@ public class Stratocaster { return certificateOfAuthenticity; } } -.... +---- == The META-INF/env-entries.properties file -.... +[source,java] +---- guitarStringGuages=E1=0.052\nA=0.042\nD=0.030\nG=0.017\nB=0.013\nE=0.010 certificateOfAuthenticity=/tmp/strat-certificate.txt dateCreated=1962-03-01 pickups=S,S,S style=VINTAGE -.... +---- == The Custom Type and Editor @@ -98,7 +100,8 @@ we'd like to allow abbreviated versions of the enum constants to be usable. We do this by creating a custom PropertyEditor for our Pickup enum like so: -.... +[source,java] +---- public class PickupEditor extends java.beans.PropertyEditorSupport { public void setAsText(String text) throws IllegalArgumentException { text = text.trim(); @@ -108,13 +111,14 @@ public class PickupEditor extends java.beans.PropertyEditorSupport { else throw new IllegalStateException("H and S are the only supported Pickup aliases"); } } -.... +---- We cleverly install this PropertyEditor in a static block in the Pickup class that will be executed should someone actually reference the Pickup type. -.... +[source,java] +---- public enum Pickup { HUMBUCKER, @@ -127,11 +131,12 @@ public enum Pickup { PropertyEditorManager.registerEditor(Pickup.class, PickupEditor.class); } } -.... +---- # Test Case -.... +[source,java] +---- public class StratocasterTest extends TestCase { @EJB @@ -161,7 +166,7 @@ public class StratocasterTest extends TestCase { } } -.... +---- # Running it @@ -174,7 +179,8 @@ ___________________ Which should create output like the following. -.... +[source,java] +---- ------------------------------------------------------- T E S T S ------------------------------------------------------- @@ -200,4 +206,4 @@ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.705 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/datasource-config.adoc ---------------------------------------------------------------------- diff --git a/docs/datasource-config.adoc b/docs/datasource-config.adoc index 3260b89..672a169 100644 --- a/docs/datasource-config.adoc +++ b/docs/datasource-config.adoc @@ -10,7 +10,8 @@ A DataSource can be declared via xml in the using a declaration like the following. All properties in the element body are optional. -.... +[source,java] +---- <Resource id="myDataSource" type="javax.sql.DataSource"> accessToUnderlyingConnectionAllowed = false alternateUsernameAllowed = false @@ -41,14 +42,15 @@ body are optional. userName = sa validationQuery = </Resource> -.... +---- Alternatively, a DataSource 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` -.... +[source,java] +---- myDataSource = new://Resource?type=javax.sql.DataSource myDataSource.accessToUnderlyingConnectionAllowed = false myDataSource.alternateUsernameAllowed = false @@ -78,7 +80,7 @@ myDataSource.testWhileIdle = false myDataSource.timeBetweenEvictionRuns = -1 millisecond myDataSource.userName = sa myDataSource.validationQuery = -.... +---- Properties and xml can be mixed. Properties will override the xml allowing for easy configuration change without the need for $\{} style @@ -348,12 +350,13 @@ Wether SQL queries should be logged or not If true the raw physical connection to the database can be accessed using the following construct: -.... +[source,java] +---- 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 @@ -423,10 +426,11 @@ statements. If true, a statement pool is created for each Connection and PreparedStatements created by one of the following methods are pooled: -.... +[source,java] +---- public PreparedStatement prepareStatement(String sql); public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) -.... +---- == testOnBorrow @@ -469,7 +473,8 @@ XaDataSource can be defined as a standard resource using `class-name`. First solution is to define as `JdbcDriver` an XADataSource: -.... +[source,java] +---- <Resource id="myXaDs" type="DataSource"> JdbcDriver = org.foo.MyXaDataSource @@ -477,7 +482,7 @@ First solution is to define as `JdbcDriver` an XADataSource: myPoolProperty = 10 </Resource> -.... +---- This solution merges properties for the XaDataSource and the pool (tomcat-jdbc for TomEE, dbcp for OpenEJB by default but still @@ -494,20 +499,22 @@ factory mecanism. An alternative is to define a resource for the XaDataSource: -.... +[source,java] +---- <Resource id="myXa" class-name="org.foo.MyXaDataSource"> myXaProperty = value </Resource> -.... +---- And then wrap it in the pool: -.... +[source,java] +---- <Resource id="myXaDs" type="DataSource"> DataSourceCreator = [dbcp|dbcp-alternative] myPoolProperty = 10 </Resource> -.... +---- Note: `dbcp` is more adapted than `dbcp-alternative` in most of the case because it is reusing direct dbcp JTA management. @@ -516,9 +523,10 @@ because it is reusing direct dbcp JTA management. For TomEE 1.7.0/1.7.1 you can need to add the property: -.... +[source,java] +---- openejb.datasource.pool = true -.... +---- in resource properties to ensure the resource is pooled. http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/datasource-password-encryption.adoc ---------------------------------------------------------------------- diff --git a/docs/datasource-password-encryption.adoc b/docs/datasource-password-encryption.adoc index 6d6b3bc..5980741 100644 --- a/docs/datasource-password-encryption.adoc +++ b/docs/datasource-password-encryption.adoc @@ -20,7 +20,8 @@ not activated so plain passwords are used. Default Plain text password example: -.... +[source,java] +---- <Resource id="MySQL Database" type="DataSource"> # MySQL example # @@ -32,7 +33,7 @@ Default Plain text password example: UserName test Password Passw0rd </Resource> -.... +---- 3DES ciphered password example. @@ -43,7 +44,8 @@ how relying on an HSM for example._ The easiest way to do it is to implement the _org.apache.openejb.resource.jdbc.cipher.PasswordCipher_ interface. -.... +[source,java] +---- <Resource id="MySQL Database" type="DataSource"> # MySQL example # @@ -59,7 +61,7 @@ interface. Password xMH5uM1V9vQzVUv5LG7YLA== PasswordCipher Static3DES </Resource> -.... +---- == Hint @@ -78,9 +80,10 @@ openejb cipher - OpenEJB Cypher Tool ==== SYNOPSIS -.... +[source,java] +---- openejb cipher [#options] -.... +---- ==== DESCRIPTION @@ -99,31 +102,35 @@ directory C:-3.1.2. In Windows, the cipher tool can be executed as follows: -.... +[source,java] +---- `C:\openejb-3.1.2> bin\openejb cipher --help` -.... +---- In UNIX, Linux, or Mac OS X, the cipher tool can be executed as follows: -.... +[source,java] +---- `\[user@host openejb-3.1.2]# bin/openejb cipher --help` -.... +---- 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. -.... +[source,java] +---- `\[user@host openejb-3.1.2]# 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. -.... +[source,java] +---- `openejb cipher --help` -.... +---- ==== OPTIONS @@ -148,12 +155,14 @@ Switches command line tool to encrypt (default). Encrypt a plain password using the default algorithm. -.... +[source,java] +---- `openejb cipher Passw0rd` -.... +---- Output -.... +[source,java] +---- xMH5uM1V9vQzVUv5LG7YLA== -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/declaring-references.adoc ---------------------------------------------------------------------- diff --git a/docs/declaring-references.adoc b/docs/declaring-references.adoc index c6c3107..347e3fd 100644 --- a/docs/declaring-references.adoc +++ b/docs/declaring-references.adoc @@ -3,4 +3,3 @@ :jbake-date: 2018-12-05 :jbake-type: page :jbake-status: published - http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/deploy-tool.adoc ---------------------------------------------------------------------- diff --git a/docs/deploy-tool.adoc b/docs/deploy-tool.adoc index 49eba0f..5892134 100644 --- a/docs/deploy-tool.adoc +++ b/docs/deploy-tool.adoc @@ -147,7 +147,8 @@ _________________________ On running the deploy tool with a valid EJB jar the following output is printed on the console -.... +[source,java] +---- Application deployed successfully at {0} App(id=C:\samples\Calculator-new\hello-addservice.jar) EjbJar(id=hello-addservice.jar, path=C:\samples\Calculator-new\hello-addservice.jar) @@ -158,7 +159,7 @@ App(id=C:\samples\Calculator-new\hello-addservice.jar) Ejb(ejb-name=AddServiceBean, id=AddServiceBean) Jndi(name=AddServiceBean) Jndi(name=AddServiceBeanLocal) -.... +---- Note: In the above case the command used is: > openejb deploy hello-addservice.jar http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/deployment-id.adoc ---------------------------------------------------------------------- diff --git a/docs/deployment-id.adoc b/docs/deployment-id.adoc index 0855413..003b407 100644 --- a/docs/deployment-id.adoc +++ b/docs/deployment-id.adoc @@ -101,11 +101,12 @@ Each bean is added to the public, global namespace using it's deployment id as its JNDI lookup. For example, if a bean had a deployment-id of "/my/bean/foo", a non-bean client could lookup that bean as follows. -.... +[source,java] +---- ... Object bean = initialContext.lookup("/my/bean/Foo"); ... -.... +---- If a bean in the container system made the above JNDI call, the Local Server would see the bean's identity (deployment id) hidden in the @@ -138,11 +139,12 @@ Just as before, clients can lookup beans from the Remote Server using the bean's deployment id. For example, if a bean had a deployment-id of "/my/bean/foo", a client could lookup that bean as follows. -.... +[source,java] +---- ... Object bean = initialContext.lookup("/my/bean/Foo"); ... -.... +---- == In the CORBA Adapter @@ -158,7 +160,8 @@ So, just as with the Local Server and Remote Server, clients can lookup beans using the bean's deployment id. OpenORB has a JNDI implementation of their naming service, so lookups can be done just as before. -.... +[source,java] +---- ... String[] args = ... @@ -187,7 +190,7 @@ name[0] = new org.omg.CosNaming.NameComponent("/my/bean/foo",""); // Equvalent to an InitialContext.lookup("/my/bean/foo"); bean = context.resolve( name ); ... -.... +---- # What happens if there is a duplicate deployment ID? @@ -200,9 +203,10 @@ loaded. In addition, the system will log a warning like the following one asking you to redeploy the jar and choose an different deployment ID for the bean. -.... +[source,java] +---- WARN : Jar C:\openejb\beans\fooEjbs.jar cannot be loaded. The Deployment ID "/my/bean/foo" is already in use. Please redeploy this jar and assign a different deployment ID to the bean with the ejb-name "FooBean". -.... +---- For example, the acmeEjbs.jar contains a bean with the ejb-name "DaffyDuckBean". The disneyEjbs.jar contains contains a bean with the @@ -226,6 +230,7 @@ rest of the beans in the disneyEjbs.jar as they may need the "DonaldDuckBean" bean to function properly. The disneyEjbs.jar is skipped and the following warning is logged. -.... +[source,java] +---- WARN : Jar C:\openejb\beans\disneyEjbs.jar cannot be loaded. The Deployment ID "/my/favorite/duck" is already in use. Please redeploy this jar and assign a different deployment ID to the bean with the ejb-name "DonaldDuckBean". -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/deployments.adoc ---------------------------------------------------------------------- diff --git a/docs/deployments.adoc b/docs/deployments.adoc index dc31d32..f182bdf 100644 --- a/docs/deployments.adoc +++ b/docs/deployments.adoc @@ -12,14 +12,15 @@ To include a single jar by name, just declare a 'Deployments' element with a 'jar' attribute pointing to the jar file on the file system. -.... +[source,java] +---- <openejb> ... <Deployments jar="c:\my\app\superEjbs.jar" /> <Deployments jar="c:\someplace\purchasing.jar" /> <Deployments jar="timeTrack.jar" /> </openejb> -.... +---- The last element in the example uses a relative path to point to the ejb jar. This path will be resolved relative to the openejb.base property. @@ -33,7 +34,8 @@ To point to a directory that contains several jar files that OpenEJB should load, simply declare a 'Deployments' element with a 'dir' attribute pointing to the directory containing the jar files. -.... +[source,java] +---- <openejb> ... @@ -42,7 +44,7 @@ attribute pointing to the directory containing the jar files. <Deployments dir="ejbs" /> <Deployments dir="beans" /> </openejb> -.... +---- The directories listed will be searched for jars containing 'META-INF/ejb-jar.xml' files and will be added to the list of jars to @@ -64,7 +66,8 @@ in OpenEJB. You still need to follow the ejb jar layout and include an For example, if you have a directory structure like this: -.... +[source,java] +---- > C:\myapp\ > C:\myapp\acmeEjbs\ > C:\myapp\acmeEjbs\META-INF\ejb-jar.xml @@ -74,18 +77,19 @@ For example, if you have a directory structure like this: > C:\myapp\acmeEjbs\org\acme\Bar.class > C:\myapp\acmeEjbs\org\acme\BarBean.class > C:\myapp\acmeEjbs\org\acme\BarHome.class -.... +---- Then you would delcare a 'Deployments' element with the 'dir' attribute set to 'C:' as shown below. -.... +[source,java] +---- <openejb> ... <Deployments dir="c:\myapp\acmeEjbs" /> </openejb> -.... +---- Note that this syntax is the same as the directory syntax above. If OpenEJB finds a META-INF directory with an 'ejb-jar.xml' fine inside, @@ -101,27 +105,30 @@ is an incredible asset. If your ejbs were loaded successfully you should see entries like the following (1.x and higher only): -.... +[source,java] +---- INFO : Loaded EJBs from /usr/local/openejb-1.0-beta1/beans/openejb-itests-beans.jar INFO : Loaded EJBs from /usr/local/openejb-1.0-beta1/beans/openejb-webadmin-clienttools.jar -.... +---- If your ejbs failed to load, you will see an entry similar to the following. -.... +[source,java] +---- WARN : Jar not loaded. /usr/local/openejb-1.0-beta1/beans/helloworld.jar. Jar failed validation. Use the validation tool for more details -.... +---- Additionally, all the successfully loaded ejbs are individually listed in the log file at startup. The Deployment ID listed is the JNDI name used to lookup the ejb from a client of the Local or Remote Servers. The beans listed below are from our test suite. -.... +[source,java] +---- DEBUG: Deployments : 19 DEBUG: Type Deployment ID DEBUG: CMP_ENTITY client/tests/entity/cmp/RMI-over-IIOP/EJBHome @@ -143,4 +150,4 @@ DEBUG: STATELESS client/tools/DatabaseHome DEBUG: CMP_ENTITY client/tests/entity/cmp/allowed_operations/EntityHome DEBUG: BMP_ENTITY client/tests/entity/bmp/EncBean DEBUG: STATELESS client/tests/stateless/RMI-over-IIOP/EJBHome -.... +---- http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/details-on-openejb-jar.adoc ---------------------------------------------------------------------- diff --git a/docs/details-on-openejb-jar.adoc b/docs/details-on-openejb-jar.adoc index 36ceb86..a3190d6 100644 --- a/docs/details-on-openejb-jar.adoc +++ b/docs/details-on-openejb-jar.adoc @@ -44,14 +44,15 @@ This is the openejb-jar.xml that is created by the Deploy tool in the Hello World example. As you can see, the file format is extremely simple. -.... +[source,java] +---- <?xml version="1.0"?> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> <ejb-deployment ejb-name="Hello" deployment-id="Hello" container-id="Default Stateless Container"/> </openejb-jar> -.... +---- The _ejb-name_ attribute is the name you gave the bean in your ejb-jar.xml. The _deployment-id_ is the name you want to use to lookup @@ -64,7 +65,8 @@ your jar. Then you simply add a element to your element like this -.... +[source,java] +---- <?xml version="1.0"?> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> @@ -78,7 +80,7 @@ Then you simply add a element to your element like this </ejb-deployment> </openejb-jar> -.... +---- The _res-ref-name_ attribute refers to the element of the bean's declaration in the ejb-jar.xml. The _res-id_ attribute refers to the id @@ -90,7 +92,8 @@ and provide access to the desired resource. You will need one element for every element in your ejb-jar.xml. So if you had an ejb-jar.xml like the following -.... +[source,java] +---- <?xml version="1.0"?> <ejb-jar> <enterprise-beans> @@ -123,12 +126,13 @@ you had an ejb-jar.xml like the following </session> </enterprise-beans> </ejb-jar> -.... +---- Then you would need two elements for that bean in your openejb-jar.xml file as such. -.... +[source,java] +---- <?xml version="1.0"?> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> @@ -145,7 +149,7 @@ file as such. </ejb-deployment> </openejb-jar> -.... +---- This would require two declarations in your openejb.conf, one with the _id_ attribute set to _"My Oracle JDBC Database"_ , and another with http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/developer/classloading/index.adoc ---------------------------------------------------------------------- diff --git a/docs/developer/classloading/index.adoc b/docs/developer/classloading/index.adoc index fb47ef3..46a64d5 100644 --- a/docs/developer/classloading/index.adoc +++ b/docs/developer/classloading/index.adoc @@ -56,4 +56,3 @@ ifndef::backend-pdf[] Click on the tree (JVM) on the left to see the detail there. endif::[] - http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/developer/ide/index.adoc ---------------------------------------------------------------------- diff --git a/docs/developer/ide/index.adoc b/docs/developer/ide/index.adoc index 9bc3370..db16c32 100644 --- a/docs/developer/ide/index.adoc +++ b/docs/developer/ide/index.adoc @@ -21,5 +21,3 @@ Be the first to write this part! === Netbeans Be the first to write this part! - - http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/developer/index.adoc ---------------------------------------------------------------------- diff --git a/docs/developer/index.adoc b/docs/developer/index.adoc index 5d49d24..65ec610 100644 --- a/docs/developer/index.adoc +++ b/docs/developer/index.adoc @@ -4,4 +4,4 @@ :jbake-status: published :jbake-tomeepdf: -Click link:../docs.html[here] to find documentation for developers. \ No newline at end of file +Click link:../docs.html[here] to find documentation for developers. http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/developer/json/index.adoc ---------------------------------------------------------------------- diff --git a/docs/developer/json/index.adoc b/docs/developer/json/index.adoc index 9141d88..bbb05bd 100644 --- a/docs/developer/json/index.adoc +++ b/docs/developer/json/index.adoc @@ -203,4 +203,3 @@ TomEE uses by default Johnzon as JAX-RS provider for versions 7.x. If you want h Note: as you can see you mainly just need to define a service with the id johnzon (same as in openejb-jar.xml) and you can reference other instances using $id for services and @id for resources. - http://git-wip-us.apache.org/repos/asf/tomee/blob/66e0d661/docs/docs.adoc ---------------------------------------------------------------------- diff --git a/docs/docs.adoc b/docs/docs.adoc index 5507038..141c662 100644 --- a/docs/docs.adoc +++ b/docs/docs.adoc @@ -23,4 +23,4 @@ - link:advanced/setup/index.html[How to Setup TomEE in Production] - link:advanced/shading/index.html[Fat / Uber Jar Deployment using the Maven Shade Plugin] - link:advanced/client/jndi.html[Java Naming and Directory Interface (JNDI)] -- link:advanced/jms/jms-configuration.html[Why is my ActiveMQ/JMS MDB not scaling as expected?] \ No newline at end of file +- link:advanced/jms/jms-configuration.html[Why is my ActiveMQ/JMS MDB not scaling as expected?]
