You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by bu...@apache.org on 2011/07/11 04:31:38 UTC
svn commit: r792512 [2/3] - /websites/staging/openejb/trunk/content/
Modified: websites/staging/openejb/trunk/content/failover.html
==============================================================================
--- websites/staging/openejb/trunk/content/failover.html (original)
+++ websites/staging/openejb/trunk/content/failover.html Mon Jul 11 02:31:36 2011
@@ -278,47 +278,38 @@ special "multicast://" URL can be used i
signify that multicast should be used to seed the connection process. Such
as:</p>
-<p>{code:java}
-Properties p = new Properties();
+<pre><code>Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
p.put(Context.PROVIDER_URL, "multicast://239.255.2.3:6142?group=default");
-InitialContext remoteContext = new InitialContext(p);</p>
-
-<pre><code>The URL has optional query parameters such as "schemes" and "group" and
+InitialContext remoteContext = new InitialContext(p);
</code></pre>
-<p>"timeout" which allow you to zero in on a particular type of service of a
+<p>The URL has optional query parameters such as "schemes" and "group" and
+"timeout" which allow you to zero in on a particular type of service of a
particular cluster group as well as set how long you are willing to wait in
the discovery process till finally giving up. The first matching service
that it sees "flowing" around on the UDP stream is the one it picks and
sticks to for that and subsequent requests, ensuring UDP is only used when
there are no other servers to talk to.</p>
-<pre><code>Note that EJB clients do not need to use multicast to find a server. If
-</code></pre>
-
-<p>the client knows the URL of a server in the cluster, it may use it and
+<p>Note that EJB clients do not need to use multicast to find a server. If
+the client knows the URL of a server in the cluster, it may use it and
connect directly to that server, at which point that server will share the
full list of its peers.</p>
<h2>Multicast Servers with TCP Clients</h2>
-<pre><code>Note that clients do not need to use multicast to communicate with servers.
-</code></pre>
-
-<p>Servers can use multicast to discover each other, but clients are still
+<p>Note that clients do not need to use multicast to communicate with servers.
+Servers can use multicast to discover each other, but clients are still
free to connect to servers in the network using the server's TCP address.</p>
-<pre><code>{code:java}
-Properties p = new Properties();
-p.put(Context.INITIAL_CONTEXT_FACTORY,
+<pre><code>Properties p = new Properties();
+p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+p.put(Context.PROVIDER_URL, "ejbd://192.168.1.30:4201");
+InitialContext remoteContext = new InitialContext(p);
</code></pre>
-<p>"org.apache.openejb.client.RemoteInitialContextFactory");
- p.put(Context.PROVIDER_URL, "ejbd://192.168.1.30:4201");
- InitialContext remoteContext = new InitialContext(p);</p>
-
<p>When the client connects, the server will send the URLs of all the servers
in the group and failover will take place normally.</p>
@@ -326,11 +317,7 @@ in the group and failover will take plac
<h1>Multipoint (TCP)</h1>
-<p>{info:title=Since OpenEJB 3.1.3}
-{span:style=float: right;}
-{gliffy:name=Multipoint|space=OPENEJBx30|page=Failover|align=right|border=false|size=L|version=9}
-{span}
-As TCP has no real broadcast functionality to speak of, communication of
+<p>As TCP has no real broadcast functionality to speak of, communication of
who is in the network is achieved by each server having a physical
connection to each other server in the network.</p>
@@ -361,7 +348,7 @@ list to bootstrap getting the more valua
<h2>Server Configuration</h2>
<p>In the server this list can be specified via the
-<em>conf/multipoint.properties</em> file like so:</p>
+<code>conf/multipoint.properties</code> file like so:</p>
<pre><code>server = org.apache.openejb.server.discovery.MultipointDiscoveryAgent
bind = 127.0.0.1
@@ -372,7 +359,7 @@ initialServers = 192.168.1.20:4212, 192.
<p>The above configuration shows the server has an port 4212 open for
connections by other servers for multipoint communication. The
-<em>initialServers</em> list should be a comma separated list of other similar
+<code>initialServers</code> list should be a comma separated list of other similar
servers on the network. Only one of the servers listed is required to be
running when this server starts up -- it is not required to list all
servers in the network.</p>
@@ -386,41 +373,33 @@ participate directly in multipoint commu
the multipoint port. The server list is simply a list of the regular
"ejbd://" urls that a client normally uses to connect to a server.</p>
-<p>{code:java}
-Properties p = new Properties();
-p.put(Context.INITIAL_CONTEXT_FACTORY,
-"org.apache.openejb.client.RemoteInitialContextFactory");
-p.put(Context.PROVIDER_URL,
-"failover:ejbd://192.168.1.20:4201,ejbd://192.168.1.30:4201");
-InitialContext remoteContext = new InitialContext(p);</p>
+<pre><code>Properties p = new Properties();
+p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+p.put(Context.PROVIDER_URL, "failover:ejbd://192.168.1.20:4201,ejbd://192.168.1.30:4201");
+InitialContext remoteContext = new InitialContext(p);
+</code></pre>
<h2>Considerations</h2>
<h3>Network size</h3>
-<pre><code>The general disadvantage of this topology is the number of connections
-</code></pre>
-
-<p>required. The number of connections for the network of servers is equal to
+<p>The general disadvantage of this topology is the number of connections
+required. The number of connections for the network of servers is equal to
"(n * n - n) / 2 ", where n is the number of servers. For example, with 5
servers you need 10 connections, with 10 servers you need 45 connections,
and with 50 servers you need 1225 connections. This is of course the
number of connections across the entire network, each individual server
only needs "n - 1" connections.</p>
-<pre><code>The handling of these sockets is all asynchronous Java NIO code which
-</code></pre>
-
-<p>allows the server to handle many connections (all of them) with one thread.
+<p>The handling of these sockets is all asynchronous Java NIO code which
+allows the server to handle many connections (all of them) with one thread.
From a pure threading perspective, the option is extremely efficient with
just one thread to listen and broadcast to many peers. </p>
<h3>Double connect</h3>
-<pre><code>It is possible in this process that two servers learn of each other at the
-</code></pre>
-
-<p>same time and each attempts to connect to the other simultaneously,
+<p>It is possible in this process that two servers learn of each other at the
+same time and each attempts to connect to the other simultaneously,
resulting in two connections between the same two servers. When this
happens both servers will detect the extra connection and one of the
connections will be dropped and one will be kept. In practice this race
@@ -429,185 +408,150 @@ server startup by as little as 100 milli
<h1>Multipoint Configuration Recommendations</h1>
-<pre><code>As mentioned above the {{initialServers}} is only used for bootstrapping
-</code></pre>
-
-<p>the multipoint network. Once running, all servers will dynamically
+<p>As mentioned above the {{initialServers}} is only used for bootstrapping
+the multipoint network. Once running, all servers will dynamically
establish direct connections with each other and there is no single point
of failure.</p>
-<pre><code>However to ensure that the bootstrapping process can occur successfully,
-</code></pre>
-
-<p>the {{initialServers}} property of the {{conf/multipoint.properties}} file
+<p>However to ensure that the bootstrapping process can occur successfully,
+the {{initialServers}} property of the {{conf/multipoint.properties}} file
must be set carefully and with a specific server start order in mind. Each
server consults its {{initialServers}} list exactly once in the
bootstrapping phase at startup, after that time connections are made
dynamically.</p>
-<pre><code>This means that at least one of the servers listed in {{initialServers}}
-</code></pre>
-
-<p>must already be running when the server starts or the server might never
+<p>This means that at least one of the servers listed in {{initialServers}}
+must already be running when the server starts or the server might never
become introduced and connected to all the other servers in the network.</p>
<h2>Failed scenario (background)</h2>
-<pre><code>As an example of a failed scenario, imagine there are three servers;
-</code></pre>
-
-<p>server1, server2, server3. They are setup only to point to the server in
+<p>As an example of a failed scenario, imagine there are three servers;
+server1, server2, server3. They are setup only to point to the server in
front of them making a chain:</p>
-<pre><code> * server1; initialServers = server2
- * server2; initialServers = server3
- * server3; initialServers = <blank>
+<ul>
+<li>server1; initialServers = server2</li>
+<li>server2; initialServers = server3</li>
+<li>server3; initialServers = <blank></li>
+</ul>
-Which is essentially server1 -> server2 -> server3. This scenario could
-</code></pre>
-
-<p>work, but they servers would have to be started in exactly the opposite
+<p>Which is essentially server1 -> server2 -> server3. This scenario could
+work, but they servers would have to be started in exactly the opposite
order:</p>
-<pre><code> # server3 starts
+<p># server3 starts
# server2 starts
#* static: connect to server3
# server1 starts
#* static: connect to server2
- #* dynamic: connect to server3
-
-At this point all servers would be fully connected. But the above setup is
-</code></pre>
+ #* dynamic: connect to server3</p>
-<p>flawed and could easily fail. The first flaw is server3 lists nothing in
+<p>At this point all servers would be fully connected. But the above setup is
+flawed and could easily fail. The first flaw is server3 lists nothing in
its {{initialServers}} list, so if it were restarted it would leave the
multipoint network and not know how to get back in.</p>
-<pre><code>The second flaw is if you started them in any other order, you would also
-</code></pre>
-
-<p>not get a fully connected multipoint network. Say the servers were started
+<p>The second flaw is if you started them in any other order, you would also
+not get a fully connected multipoint network. Say the servers were started
in "front" order:</p>
-<pre><code> # server1 starts
+<p># server1 starts
#* static: connect to server2 - failed, server2 not started.
# server2 starts
#* static: connect to server3 - failed, server3 not started.
# server3 starts
- #* no connection attempts, initialServers list is empty.
-
-After startup completes, all servers will be completely isolated and
-</code></pre>
+ #* no connection attempts, initialServers list is empty.</p>
-<p>failover will not work. The described setup is weaker than it needs to be.
- Listing just one server means the listed server is a potential point of
+<p>After startup completes, all servers will be completely isolated and
+failover will not work. The described setup is weaker than it needs to be.
+Listing just one server means the listed server is a potential point of
weakness. As a matter of trivia, it is interesting to point out that you
could bring a fourth server online temporarily that lists all three
servers. Once it makes the introductions and all servers learn of each
other, you could shut it down again.</p>
-<pre><code>The above setup is easily fixable via better configuration. If server3
-</code></pre>
-
-<p>listed both server1 and server2 in its initialServers list, rather than
+<p>The above setup is easily fixable via better configuration. If server3
+listed both server1 and server2 in its initialServers list, rather than
listing nothing at all, then all servers would fully discover each other
regardless of startup order; assuming all three servers did eventually
start.</p>
<h2>Bootstrapping Three Servers or Less</h2>
-<pre><code>In a three sever scenario, we recommend simply having all three servers
-</code></pre>
-
-<p>list all three servers. </p>
-
-<pre><code> * server1/conf/multipoint.properties
- ** initialServers = server1, server2, server3
- * server2/conf/multipoint.properties
- ** initialServers = server1, server2, server3
- * server3/conf/multipoint.properties
- ** initialServers = server1, server2, server3
+<p>In a three sever scenario, we recommend simply having all three servers
+list all three servers. </p>
-There's no harm to a server listing itself. It gives you one clean list to
-</code></pre>
+<ul>
+<li>server1/conf/multipoint.properties
+** initialServers = server1, server2, server3</li>
+<li>server2/conf/multipoint.properties
+** initialServers = server1, server2, server3</li>
+<li>server3/conf/multipoint.properties
+** initialServers = server1, server2, server3</li>
+</ul>
-<p>maintain and it will work even if you decide not to start one of the three
+<p>There's no harm to a server listing itself. It gives you one clean list to
+maintain and it will work even if you decide not to start one of the three
servers.</p>
<h2>Bootstrapping Four Servers or More</h2>
-<pre><code>{span:style=float: right;}
-{gliffy:name=MultipointFour|space=OPENEJBx30|page=Failover|align=right|border=false|size=L|version=3}
-{span}
-
-In a scenario of four or more, we recommend picking at least to servers and
-</code></pre>
-
-<p>focus on always keeping at least one of them running. Lets refer to them
+<p>In a scenario of four or more, we recommend picking at least to servers and
+focus on always keeping at least one of them running. Lets refer to them
as "root" servers for simplicity sake.</p>
-<pre><code> * server1/conf/multipoint.properties
- ** initialServers = server2
- * server2/conf/multipoint.properties
- ** initialServers = server1
+<ul>
+<li>server1/conf/multipoint.properties
+** initialServers = server2</li>
+<li>server2/conf/multipoint.properties
+** initialServers = server1</li>
+</ul>
-Root server1 would list root server2 so they would always be linked to each
-</code></pre>
-
-<p>other regardless of start order or if one of them went down. Server1 could
+<p>Root server1 would list root server2 so they would always be linked to each
+other regardless of start order or if one of them went down. Server1 could
be shutdown and reconnect on startup to the full multipoint network through
server2, and vice versa.</p>
-<pre><code>All other servers would simply list the root servers (server1, server2) in
-</code></pre>
-
-<p>their initialServers list.</p>
+<p>All other servers would simply list the root servers (server1, server2) in
+their initialServers list.</p>
-<pre><code> * server3/conf/multipoint.properties
- ** initialServers = server1, server2
- * server4/conf/multipoint.properties
- ** initialServers = server1, server2
- * serverN/conf/multipoint.properties
- ** initialServers = server1, server2
+<ul>
+<li>server3/conf/multipoint.properties
+** initialServers = server1, server2</li>
+<li>server4/conf/multipoint.properties
+** initialServers = server1, server2</li>
+<li>serverN/conf/multipoint.properties
+** initialServers = server1, server2</li>
+</ul>
-As long as at least one root server (server1 or server2) was running, you
-</code></pre>
-
-<p>can bring other servers on and offline at will and always have a fully
+<p>As long as at least one root server (server1 or server2) was running, you
+can bring other servers on and offline at will and always have a fully
connected graph.</p>
-<pre><code>Of course all servers once running and connected will have a full list of
-</code></pre>
-
-<p>all other servers in the network, so if at any time the "root" servers
+<p>Of course all servers once running and connected will have a full list of
+all other servers in the network, so if at any time the "root" servers
weren't around to make initial introductions to new servers it would be no
trouble. It's possible to reconfigure new servers to point at any other
server in the network as all servers will have the full list. So these
"root" servers are no real point of failure in function, but only of
convenience.</p>
-<pre><code>{div:style=clear:both;}{div}
-</code></pre>
-
<h2>Command line overrides</h2>
-<pre><code>Always remember that any property in a conf/<server-service>.properties
-</code></pre>
-
-<p>file can be overridden on the command line or via system properties. So it
+<p>Always remember that any property in a conf/<server-service>.properties
+file can be overridden on the command line or via system properties. So it
is possible easily set the initialServers list in startup scripts.</p>
-<pre><code>A bash example might look something like:
-</code></pre>
+<p>A bash example might look something like:</p>
-<ol>
-<li>!/bin/bash</li>
-</ol>
+<pre><code>!/bin/bash
-<p>OPENEJB_HOME=/opt/openejb-3.1.3
-INITIAL_LIST=$(cat /some/shared/directory/our_initial_servers.txt)</p>
+OPENEJB_HOME=/opt/openejb-3.1.3
+INITIAL_LIST=$(cat /some/shared/directory/our_initial_servers.txt)
-<p>$OPENEJB_HOME/bin/openejb start -Dmultipoint.initialServers=$INITIAL_LIST</p>
+$OPENEJB_HOME/bin/openejb start -Dmultipoint.initialServers=$INITIAL_LIST
+</code></pre>
</DIV>
</P>
Modified: websites/staging/openejb/trunk/content/hibernate.html
==============================================================================
--- websites/staging/openejb/trunk/content/hibernate.html (original)
+++ websites/staging/openejb/trunk/content/hibernate.html Mon Jul 11 02:31:36 2011
@@ -159,32 +159,28 @@
<p>For a unit called "movie-unit" using two datasources called "movieDatabase"
and "movieDatabaseUnmanaged" the following persistence.xml would work.</p>
-<p>{code:xml|title=persistence.xml}
-<persistence version="1.0"
- xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
-http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"></p>
-
-<p><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></p>
-
-<pre><code><properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- <property name="hibernate.transaction.manager_lookup_class"
+<pre><code><persistence version="1.0"
+ xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
+
+ <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.transaction.manager_lookup_class"
+ value="org.apache.openejb.hibernate.TransactionManagerLookup"/>
+ </properties>
+ </persistence-unit>
+</persistence>
</code></pre>
-<p>value="org.apache.openejb.hibernate.TransactionManagerLookup"/>
- </properties>
- </persistence-unit>
-</persistence></p>
-
-<pre><code>Note that as of OpenEJB 3.1 you do not need to set the
-</code></pre>
-
-<p><em>hibernate.transaction.manager</em>lookup_class_ as it will be set for you
+<p>Note that as of OpenEJB 3.1 you do not need to set the
+<em>hibernate.transaction.manager</em>lookup_class_ as it will be set for you
automatically and will overwrite any "org.hibernate.transaction." strategy
class already set while leaving any custom strategy class you may have
implemented untouched. The result is that you can leave your
@@ -194,75 +190,53 @@ testing. On the other hand if you have
<em>org.hibernate.transaction.TransactionManagerLookup</em> strategy it will
always be used and never replaced by OpenEJB.</p>
-<pre><code>Note that if you need more functionality in this area we are always happy
-</code></pre>
-
-<p>to add it.</p>
+<p>Note that if you need more functionality in this area we are always happy
+to add it.</p>
<h1>Not using OpenEJB in production?</h1>
-<pre><code>If you're using OpenEJB 3.0 which does not support the dynamic switching of
-</code></pre>
-
-<p>the <em>hibernate.transaction.manager</em>lookup_class_ this is one way to achieve
+<p>If you're using OpenEJB 3.0 which does not support the dynamic switching of
+the <em>hibernate.transaction.manager</em>lookup_class_ this is one way to achieve
it.</p>
-<pre><code>A custom implementation of Hibernate's *TransactionManagerLookup* strategy
-</code></pre>
-
-<p>like the following will do the trick. This
+<p>A custom implementation of Hibernate's <em>TransactionManagerLookup</em> strategy
+like the following will do the trick. This
"DynamicTransactionManagerLookup" class can be packed in your jar and
deployed with your app.</p>
-<pre><code>{code:title=DynamicTransactionManagerLookup.java}
-import org.hibernate.HibernateException;
+<pre><code>import org.hibernate.HibernateException;
import org.hibernate.transaction.TransactionManagerLookup;
import javax.transaction.TransactionManager;
import java.util.Properties;
-public class DynamicTransactionManagerLookup implements
-</code></pre>
-
-<p>TransactionManagerLookup {</p>
+public class DynamicTransactionManagerLookup implements TransactionManagerLookup {
-<pre><code> private TransactionManagerLookup impl;
+ private TransactionManagerLookup impl;
public DynamicTransactionManagerLookup() {
- String[]
-</code></pre>
-
-<p>strategies = {
- "org.apache.openejb.hibernate.TransactionManagerLookup",
- "org.hibernate.transaction.JBossTransactionManagerLookup"
- };</p>
-
-<pre><code> for (String className : strategies) {
- try {
- Class<?> clazz =
-</code></pre>
-
-<p>this.getClass().getClassLoader().loadClass(className);
- impl = (TransactionManagerLookup) clazz.newInstance();
- break;
+ String[] strategies = {
+ "org.apache.openejb.hibernate.TransactionManagerLookup",
+ "org.hibernate.transaction.JBossTransactionManagerLookup"
+ };
+
+ for (String className : strategies) {
+ try {
+ Class<?> clazz = this.getClass().getClassLoader().loadClass(className);
+ impl = (TransactionManagerLookup) clazz.newInstance();
+ break;
} catch (Exception e) {
}
- }</p>
-
-<pre><code> if (impl == null) throw new IllegalStateException("No
-</code></pre>
-
-<p>TransactionManagerLookup available");
- }</p>
+ }
-<pre><code> public TransactionManager getTransactionManager(Properties properties)
-</code></pre>
+ if (impl == null) throw new IllegalStateException("No TransactionManagerLookup available");
+ }
-<p>throws HibernateException {
+ public TransactionManager getTransactionManager(Properties properties) throws HibernateException {
return impl.getTransactionManager(properties);
- }</p>
+ }
-<pre><code> public String getUserTransactionName() {
- return impl.getUserTransactionName();
+ public String getUserTransactionName() {
+ return impl.getUserTransactionName();
}
}
</code></pre>
Modified: websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.html
==============================================================================
--- websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.html (original)
+++ websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.html Mon Jul 11 02:31:36 2011
@@ -156,76 +156,62 @@
<h1>External ActiveMQ Broker</h1>
-<p>{code:xml|title=openejb.xml}
-<openejb>
- <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
-1. Do not start the embedded ActiveMQ broker
- BrokerXmlConfig
- ServerUrl tcp://someHostName:61616
- </Resource></p>
-
-<pre><code><Resource id="MyJmsConnectionFactory"
-</code></pre>
-
-<p>type="javax.jms.ConnectionFactory">
- ResourceAdapter MyJmsResourceAdapter
- </Resource></p>
-
-<pre><code><Container id="MyJmsMdbContainer" ctype="MESSAGE">
-ResourceAdapter MyJmsResourceAdapter
-</Container>
-
-<Resource id="FooQueue" type="javax.jms.Queue"/>
-<Resource id="BarTopic" type="javax.jms.Topic"/>
+<pre><code><openejb>
+ <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
+ # Do not start the embedded ActiveMQ broker
+ BrokerXmlConfig
+ ServerUrl tcp://someHostName:61616
+ </Resource>
+
+ <Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">
+ ResourceAdapter MyJmsResourceAdapter
+ </Resource>
+
+ <Container id="MyJmsMdbContainer" ctype="MESSAGE">
+ ResourceAdapter MyJmsResourceAdapter
+ </Container>
+
+ <Resource id="FooQueue" type="javax.jms.Queue"/>
+ <Resource id="BarTopic" type="javax.jms.Topic"/>
+</openejb>
</code></pre>
-<p></openejb></p>
-
-<pre><code>The {{ServerUrl}} would be changed to point to the host and port of the
-</code></pre>
-
-<p>ActiveMQ process. The various URL formats that ActiveMQ supports also
+<p>The {{ServerUrl}} would be changed to point to the host and port of the
+ActiveMQ process. The various URL formats that ActiveMQ supports also
work, such as 'failover:'.</p>
-<pre><code>The same can be done via properties in an embedded configuration, via the
-</code></pre>
-
-<p>{{conf/system.properties}} file or on the command line via {{-D}} flags.</p>
+<p>The same can be done via properties in an embedded configuration, via the
+{{conf/system.properties}} file or on the command line via {{-D}} flags.</p>
-<p>Properties p = new Properties();
-p.put(Context.INITIAL_CONTEXT_FACTORY,
-LocalInitialContextFactory.class.getName());</p>
+<pre><code>Properties p = new Properties();
+p.put(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
-<p>p.put("MyJmsResourceAdapter",
-"new://Resource?type=ActiveMQResourceAdapter");
+p.put("MyJmsResourceAdapter", "new://Resource?type=ActiveMQResourceAdapter");
p.put("MyJmsResourceAdapter.ServerUrl", "tcp://someHostName:61616");
// Do not start the ActiveMQ broker
-p.put("MyJmsResourceAdapter.BrokerXmlConfig", "");</p>
+p.put("MyJmsResourceAdapter.BrokerXmlConfig", "");
-<p>p.put("MyJmsConnectionFactory",
-"new://Resource?type=javax.jms.ConnectionFactory");
-p.put("MyJmsConnectionFactory.ResourceAdapter", "MyJmsResourceAdapter");</p>
+p.put("MyJmsConnectionFactory", "new://Resource?type=javax.jms.ConnectionFactory");
+p.put("MyJmsConnectionFactory.ResourceAdapter", "MyJmsResourceAdapter");
-<p>p.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
-p.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");</p>
+p.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
+p.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");
-<p>p.put("FooQueue", "new://Resource?type=javax.jms.Queue");
-p.put("BarTopic", "new://Resource?type=javax.jms.Topic");</p>
+p.put("FooQueue", "new://Resource?type=javax.jms.Queue");
+p.put("BarTopic", "new://Resource?type=javax.jms.Topic");
-<p>InitialContext context = new InitialContext(p);</p>
-
-<pre><code>From anywhere in the same VM as the EJB Container you could lookup the
+InitialContext context = new InitialContext(p);
</code></pre>
-<p>above resources like so:</p>
+<p>From anywhere in the same VM as the EJB Container you could lookup the
+above resources like so:</p>
-<p>javax.jms.ConnectionFactory cf = (ConnectionFactory)
- context.lookup("openejb:Resource/MyJmsConnectionFactory");</p>
+<pre><code>javax.jms.ConnectionFactory cf = (ConnectionFactory)
+ context.lookup("openejb:Resource/MyJmsConnectionFactory");
-<p>javax.jms.Queue queue = (Queue)
-context.lookup("openejb:Resource/FooQueue");
-javax.jms.Topic topic = (Topic)
-context.lookup("openejb:Resource/BarTopic");</p>
+javax.jms.Queue queue = (Queue) context.lookup("openejb:Resource/FooQueue");
+javax.jms.Topic topic = (Topic) context.lookup("openejb:Resource/BarTopic");
+</code></pre>
<h1>Internal ActiveMQ Broker</h1>
Modified: websites/staging/openejb/trunk/content/jndi-names.html
==============================================================================
--- websites/staging/openejb/trunk/content/jndi-names.html (original)
+++ websites/staging/openejb/trunk/content/jndi-names.html Mon Jul 11 02:31:36 2011
@@ -365,20 +365,21 @@ with these examples is to show the vario
interfaces or types of interfaces to gain more specific control on how they
are named.</p>
-<p>{code:xml|title=#1}
-<openejb-jar>
- <ejb-deployment ejb-name="FooBean">
- <jndi name="LocalOne" interface="org.superbiz.LocalOne"/>
- <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/>
- <jndi name="RemoteOne" interface="org.superbiz.RemoteOne"/>
- <jndi name="RemoteTwo" interface="org.superbiz.RemoteTwo"/>
- <jndi name="FooHome" interface="org.superbiz.FooHome"/>
- <jndi name="FooLocalHome" interface="org.superbiz.FooLocalHome"/>
- </ejb-deployment>
-</openejb-jar></p>
+<pre><code><openejb-jar>
+ <ejb-deployment ejb-name="FooBean">
+ <jndi name="LocalOne" interface="org.superbiz.LocalOne"/>
+ <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/>
+ <jndi name="RemoteOne" interface="org.superbiz.RemoteOne"/>
+ <jndi name="RemoteTwo" interface="org.superbiz.RemoteTwo"/>
+ <jndi name="FooHome" interface="org.superbiz.FooHome"/>
+ <jndi name="FooLocalHome" interface="org.superbiz.FooLocalHome"/>
+ </ejb-deployment>
+</openejb-jar>
+</code></pre>
-<pre><code>{code:xml|title=#2}
-<openejb-jar>
+<p>Or</p>
+
+<pre><code><openejb-jar>
<ejb-deployment ejb-name="FooBean">
<!-- applies to LocalOne and LocalTwo -->
<jndi name="{interfaceClass.simpleName}" interface="Local"/>
@@ -395,31 +396,30 @@ are named.</p>
</openejb-jar>
</code></pre>
-<p>{code:xml|title=#3}
-<openejb-jar>
- <ejb-deployment ejb-name="FooBean">
- <!-- applies to RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
- <jndi name="{interfaceClass.simpleName}"/> </p>
-
-<pre><code><!-- these two would count as an override on the above format -->
-<jndi name="LocalOne" interface="org.superbiz.LocalOne"/>
-<jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/>
+<p>Or</p>
+
+<pre><code><openejb-jar>
+ <ejb-deployment ejb-name="FooBean">
+ <!-- applies to RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
+ <jndi name="{interfaceClass.simpleName}"/>
+
+ <!-- these two would count as an override on the above format -->
+ <jndi name="LocalOne" interface="org.superbiz.LocalOne"/>
+ <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/>
+ </ejb-deployment>
+</openejb-jar>
</code></pre>
-<p></ejb-deployment>
-</openejb-jar></p>
+<p>or</p>
-<pre><code>{code:xml|title=#4}
-<openejb-jar>
+<pre><code><openejb-jar>
<ejb-deployment ejb-name="FooBean">
- <!-- applies to LocalOne, LocalTwo, RemoteOne, RemoteTwo, FooHome, and
+ <!-- applies to LocalOne, LocalTwo, RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
+ <jndi name="{interfaceClass.simpleName}"/>
+ </ejb-deployment>
+</openejb-jar>
</code></pre>
-<p>FooLocalHome -->
- <jndi name="{interfaceClass.simpleName}"/>
- </ejb-deployment>
- </openejb-jar></p>
-
<p><a name="JNDINames-ChangingtheDefaultSetting"></a></p>
<h1>Changing the Default Setting</h1>
Modified: websites/staging/openejb/trunk/content/jpa-concepts.html
==============================================================================
--- websites/staging/openejb/trunk/content/jpa-concepts.html (original)
+++ websites/staging/openejb/trunk/content/jpa-concepts.html Mon Jul 11 02:31:36 2011
@@ -284,60 +284,55 @@ Detached object.</p>
<p>Servlets and EJBs can use RESOURCE_LOCAL persistence units through the
EntityManagerFactory as follows:</p>
-<p>{code:xml=persistence.xml}
-<?xml version="1.0" encoding="UTF-8" ?>
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"></p>
-
-<p><!-- Tutorial "unit" -->
- <persistence-unit name="Tutorial" transaction-type="RESOURCE_LOCAL">
- <non-jta-data-source>myNonJtaDataSource</non-jta-data-source>
- <class>org.superbiz.jpa.Account</class>
- </persistence-unit></p>
+<pre><code><?xml version="1.0" encoding="UTF-8" ?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+ <!-- Tutorial "unit" -->
+ <persistence-unit name="Tutorial" transaction-type="RESOURCE_LOCAL">
+ <non-jta-data-source>myNonJtaDataSource</non-jta-data-source>
+ <class>org.superbiz.jpa.Account</class>
+ </persistence-unit>
+
+</persistence>
+</code></pre>
-<p></persistence></p>
+<p>And referenced as follows</p>
-<p>import javax.persistence.EntityManagerFactory;
+<pre><code>import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
-import javax.persistence.PersistenceUnit;</p>
+import javax.persistence.PersistenceUnit;
-<p>public class MyEjbOrServlet ... {</p>
+public class MyEjbOrServlet ... {
-<pre><code>@PersistenceUnit(unitName="Tutorial")
-private EntityManagerFactory factory;
+ @PersistenceUnit(unitName="Tutorial")
+ private EntityManagerFactory factory;
-// Proper exception handling left out for simplicity
-public void ejbMethodOrServletServiceMethod() throws Exception {
-EntityManager entityManager = factory.createEntityManager();
+ // Proper exception handling left out for simplicity
+ public void ejbMethodOrServletServiceMethod() throws Exception {
+ EntityManager entityManager = factory.createEntityManager();
-EntityTransaction entityTransaction =
-</code></pre>
+ EntityTransaction entityTransaction = entityManager.getTransaction();
-<p>entityManager.getTransaction();</p>
+ entityTransaction.begin();
-<pre><code>entityTransaction.begin();
+ Account account = entityManager.find(Account.class, 12345);
-Account account = entityManager.find(Account.class, 12345);
+ account.setBalance(5000);
-account.setBalance(5000);
+ entityTransaction.commit();
+ }
-entityTransaction.commit();
+ ...
}
-
-...
</code></pre>
-<p>}</p>
-
<h1>Valid TRANSACTION Unit usage</h1>
-<pre><code>EJBs can use TRANSACTION persistence units through the EntityManager as
-</code></pre>
-
-<p>follows:</p>
+<p>EJBs can use TRANSACTION persistence units through the EntityManager as
+follows:</p>
-<pre><code>{code:xml=persistence.xml}
-<?xml version="1.0" encoding="UTF-8" ?>
+<pre><code><?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<!-- Tutorial "unit" -->
@@ -348,10 +343,11 @@ entityTransaction.commit();
</persistence-unit>
</persistence>
+</code></pre>
+<p>And referenced as follows</p>
-
-import javax.ejb.Stateless;
+<pre><code>import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
Modified: websites/staging/openejb/trunk/content/new-in-openejb-3.0.html
==============================================================================
--- websites/staging/openejb/trunk/content/new-in-openejb-3.0.html (original)
+++ websites/staging/openejb/trunk/content/new-in-openejb-3.0.html Mon Jul 11 02:31:36 2011
@@ -216,12 +216,11 @@ JavaBeans PropertyEditor. We include se
already such as Date, InetAddress, Class, File, URL, URI, Map, List and
more.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;
- import java.util.Date;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
+import java.util.Date;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource URI blog;
@Resource Date birthday;
@@ -249,10 +248,10 @@ are not container controlled resources (
nature). You can configure you ejbs via a properties file and skip the
need for an ejb-jar.xml and it's 5 lines per property madness.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>META-INF/env-entries.properties</B></DIV><DIV class="codeContent panelContent">
- blog = http://acme.org/myblog
- birthday = locale=en_US style=MEDIUM Mar 1, 1954
- homeDirectory = /home/esmith/</p>
+<pre><code>blog = http://acme.org/myblog
+birthday = locale=en_US style=MEDIUM Mar 1, 1954
+homeDirectory = /home/esmith/
+</code></pre>
<p><a name="NewinOpenEJB3.0-SupportforGlassFishdescriptors"></a></p>
Modified: websites/staging/openejb/trunk/content/openejb-1.0-beta-1.html
==============================================================================
--- websites/staging/openejb/trunk/content/openejb-1.0-beta-1.html (original)
+++ websites/staging/openejb/trunk/content/openejb-1.0-beta-1.html Mon Jul 11 02:31:36 2011
@@ -258,23 +258,20 @@ of the very first CMP accessed to grab a
use on all requests into the CMP container. This was configured with
something like this:</p>
-<p>{code:xml|title=cmp.global_database.xml}
- <database name="Global_TX_Database" engine="instantdb">
- <jndi name="java:comp/env/jdbc/basic/entityDatabase" />
- <mapping href="conf/default.cmp_mapping.xml" />
- </database></p>
-
-<pre><code>This was just wrong. We've switched it so that the "jndi" tag of a Castor
+<pre><code><database name="Global_TX_Database" engine="instantdb">
+ <jndi name="java:comp/env/jdbc/basic/entityDatabase" />
+ <mapping href="conf/default.cmp_mapping.xml" />
+</database>
</code></pre>
-<p>database.xml file can be set directly to the global JNDI name of a
+<p>This was just wrong. We've switched it so that the "jndi" tag of a Castor
+database.xml file can be set directly to the global JNDI name of a
Connector element declared in an openejb.conf file. </p>
-<pre><code>{code:xml|title=cmp.global_database.xml}
- <database name="Global_TX_Database" engine="instantdb">
- <jndi name="java:openejb/connector/Default JDBC Database" />
- <mapping href="conf/default.cmp_mapping.xml" />
- </database>
+<pre><code> <database name="Global_TX_Database" engine="instantdb">
+ <jndi name="java:openejb/connector/Default JDBC Database" />
+ <mapping href="conf/default.cmp_mapping.xml" />
+ </database>
</code></pre>
<p>This is still not so optimal as we do not want to people using OpenEJB's
Modified: websites/staging/openejb/trunk/content/openejb-1.0.html
==============================================================================
--- websites/staging/openejb/trunk/content/openejb-1.0.html (original)
+++ websites/staging/openejb/trunk/content/openejb-1.0.html Mon Jul 11 02:31:36 2011
@@ -318,23 +318,20 @@ of the very first CMP accessed to grab a
use on all requests into the CMP container. This was configured with
something like this:</p>
-<p>{code:xml|title=cmp.global_database.xml}
- <database name="Global_TX_Database" engine="instantdb">
- <jndi name="java:comp/env/jdbc/basic/entityDatabase" />
- <mapping href="conf/default.cmp_mapping.xml" />
- </database></p>
-
-<pre><code>This was just wrong. We've switched it so that the "jndi" tag of a Castor
+<pre><code><database name="Global_TX_Database" engine="instantdb">
+ <jndi name="java:comp/env/jdbc/basic/entityDatabase" />
+ <mapping href="conf/default.cmp_mapping.xml" />
+</database>
</code></pre>
-<p>database.xml file can be set directly to the global JNDI name of a
+<p>This was just wrong. We've switched it so that the "jndi" tag of a Castor
+database.xml file can be set directly to the global JNDI name of a
Connector element declared in an openejb.conf file.</p>
-<pre><code>{code:xml|title=cmp.global_database.xml}
- <database name="Global_TX_Database" engine="instantdb">
- <jndi name="java:openejb/connector/Default JDBC Database" />
- <mapping href="conf/default.cmp_mapping.xml" />
- </database>
+<pre><code> <database name="Global_TX_Database" engine="instantdb">
+ <jndi name="java:openejb/connector/Default JDBC Database" />
+ <mapping href="conf/default.cmp_mapping.xml" />
+ </database>
</code></pre>
<p>This is still not so optimal as we do not want to people using OpenEJB's
Modified: websites/staging/openejb/trunk/content/openejb-3.0-beta-2.html
==============================================================================
--- websites/staging/openejb/trunk/content/openejb-3.0-beta-2.html (original)
+++ websites/staging/openejb/trunk/content/openejb-3.0-beta-2.html Mon Jul 11 02:31:36 2011
@@ -302,12 +302,11 @@ JavaBeans PropertyEditor. We include se
already such as Date, InetAddress, Class, File, URL, URI, Map, List and
more.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;
- import java.util.Date;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
+import java.util.Date;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource URI blog;
@Resource Date birthday;
@@ -335,10 +334,10 @@ are not container controlled resources (
nature). You can configure you ejbs via a properties file and skip the
need for an ejb-jar.xml and it's 5 lines per property madness.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>META-INF/env-entries.properties</B></DIV><DIV class="codeContent panelContent">
- blog = http://acme.org/myblog
- birthday = locale=en_US style=MEDIUM Mar 1, 1954
- homeDirectory = /home/esmith/</p>
+<pre><code>blog = http://acme.org/myblog
+birthday = locale=en_US style=MEDIUM Mar 1, 1954
+homeDirectory = /home/esmith/
+</code></pre>
<p><a name="OpenEJB3.0beta2-SupportforGlassFishdescriptors"></a></p>
Modified: websites/staging/openejb/trunk/content/openejb-3.0.html
==============================================================================
--- websites/staging/openejb/trunk/content/openejb-3.0.html (original)
+++ websites/staging/openejb/trunk/content/openejb-3.0.html Mon Jul 11 02:31:36 2011
@@ -386,12 +386,11 @@ JavaBeans PropertyEditor. We include se
already such as Date, InetAddress, Class, File, URL, URI, Map, List, any
java.lang.Enum and more.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;
- import java.util.Date;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
+import java.util.Date;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource URI blog;
@Resource Date birthday;
@@ -408,11 +407,10 @@ powerful. Declare an injectable field t
will use that information to boost your injection to the next level. For
example:</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource List<Class> factories;
@Resource Map<URI, File> locations;
@@ -439,12 +437,12 @@ public enum Pickup {
// which knows how to create this object from a string.
// You can add any of your own Property Editors in the same way.
static {
- PropertyEditorManager.registerEditor(Pickup.class,
+ PropertyEditorManager.registerEditor(Pickup.class, PickupEditor.class);
+ }
+}
</code></pre>
-<p>PickupEditor.class);
- }
- }</p>
+<p>Reference as follows</p>
<pre><code>@Stateful
public class StratocasterImpl implements Stratocaster {
@@ -474,10 +472,10 @@ are not container controlled resources (
nature). You can configure you ejbs via a properties file and skip the
need for an ejb-jar.xml and it's 5 lines per property madness.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>META-INF/env-entries.properties</B></DIV><DIV class="codeContent panelContent">
- blog = http://acme.org/myblog
- birthday = 1954-03-01
- homeDirectory = /home/esmith/</p>
+<pre><code>blog = http://acme.org/myblog
+birthday = 1954-03-01
+homeDirectory = /home/esmith/
+</code></pre>
<p><a name="OpenEJB3.0-SupportforGlassFishdescriptors"></a></p>
@@ -527,32 +525,22 @@ beginners and people using OpenEJB in a
some annotations to the "Movies" bean's interface as well as use the wrong
annotations for various types of injection:</p>
-<p>{code:none}
-FAIL ... Movies: @Stateful cannot be applied to an interface:
-org.superbiz.injection.jpa.Movies
-FAIL ... Movies: Missing required "type" attribute on class-level
-@Resource usage
-FAIL ... Movies: Mistaken use of @Resource on an EntityManagerFactory
-reference. <br />
- Use @PersistenceUnit for ref
-"org.superbiz.injection.jpa.MoviesImpl/entityManagerFactory"
-FAIL ... Movies: Mistaken use of @PersistenceUnit on an EntityManager
-reference. <br />
- Use @PersistenceContext for ref
-"org.superbiz.injection.jpa.MoviesImpl/entityManager"
-WARN ... Movies: Inoring @RolesAllowed used on interface
-org.superbiz.injection.jpa.Movies method deleteMovie.
- Annotation only usable on the bean class.
-WARN ... Movies: Ignoring @TransactionAttribute used on interface
-org.superbiz.injection.jpa.Movies method addMovie.
- Annotation only usable on the bean class.</p>
+<pre><code>FAIL ... Movies: @Stateful cannot be applied to an interface: org.superbiz.injection.jpa.Movies
+FAIL ... Movies: Missing required "type" attribute on class-level @Resource usage
+FAIL ... Movies: Mistaken use of @Resource on an EntityManagerFactory reference.
+ Use @PersistenceUnit for ref "org.superbiz.injection.jpa.MoviesImpl/entityManagerFactory"
+FAIL ... Movies: Mistaken use of @PersistenceUnit on an EntityManager reference.
+ Use @PersistenceContext for ref "org.superbiz.injection.jpa.MoviesImpl/entityManager"
+WARN ... Movies: Inoring @RolesAllowed used on interface org.superbiz.injection.jpa.Movies method deleteMovie.
+ Annotation only usable on the bean class.
+WARN ... Movies: Ignoring @TransactionAttribute used on interface org.superbiz.injection.jpa.Movies method addMovie.
+ Annotation only usable on the bean class.
+</code></pre>
<h2>JNDI Name Formatting</h2>
-<pre><code>A complication when using EJB is that plain client applications are at the
-</code></pre>
-
-<p>mercy of vendor's chosen methodology for how JNDI names should be
+<p>A complication when using EJB is that plain client applications are at the
+mercy of vendor's chosen methodology for how JNDI names should be
constructed. OpenEJB breaks the mold by allowing you to [specify the exact format|OPENEJBx30:JNDI Names]
you'd like OpenEJB to use for your server or any individual application.
Supply us with a formatting string, such as
Modified: websites/staging/openejb/trunk/content/openejb-3.1.1.html
==============================================================================
--- websites/staging/openejb/trunk/content/openejb-3.1.1.html (original)
+++ websites/staging/openejb/trunk/content/openejb-3.1.1.html Mon Jul 11 02:31:36 2011
@@ -309,15 +309,12 @@ the InitialContext. For example, to cre
you can simply:</p>
<pre><code>Properties p = new Properties();
-p.put(Context.INITIAL_CONTEXT_FACTORY,
-</code></pre>
-
-<p>"org.apache.openejb.client.LocalInitialContextFactory");
- p.put("movieDatabase", "new://Resource?type=DataSource");
- p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
- p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");</p>
+p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+p.put("movieDatabase", "new://Resource?type=DataSource");
+p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
-<pre><code>Context context = new InitialContext(p);
+Context context = new InitialContext(p);
</code></pre>
<p>See the examples zip for a dozen embedded testing examples that range from
@@ -362,17 +359,17 @@ public class WidgetBean implements Widge
private final DataSource ds;
public WidgetBean(Integer count, Foo foo, DataSource ds) {
- this.count = count;
- this.foo = foo;
- this.ds = ds;
+ this.count = count;
+ this.foo = foo;
+ this.ds = ds;
}
public int getCount() {
- return count;
+ return count;
}
public Foo getFoo() {
- return foo;
+ return foo;
}
}
</code></pre>
@@ -458,13 +455,11 @@ discover and access servers with a new "
as follows:</p>
<pre><code>Properties p = new Properties();
-p.put("java.naming.factory.initial",
+p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
+p.put("java.naming.provider.url", "multicast://239.255.3.2:6142");
+InitialContext ctx = new InitialContext(p);
</code></pre>
-<p>"org.apache.openejb.client.RemoteInitialContextFactory");
- p.put("java.naming.provider.url", "multicast://239.255.3.2:6142");
- InitialContext ctx = new InitialContext(p);</p>
-
<p><a name="OpenEJB3.1.1-RunsonOSGi"></a></p>
<h2>Runs on OSGi</h2>
@@ -503,12 +498,11 @@ a JavaBeans PropertyEditor. We include
already such as Date, InetAddress, Class, File, URL, URI, Map, List, any
java.lang.Enum and more.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;
- import java.util.Date;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
+import java.util.Date;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource URI blog;
@Resource Date birthday;
@@ -525,11 +519,10 @@ powerful. Declare an injectable field t
will use that information to boost your injection to the next level. For
example:</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource List<Class> factories;
@Resource Map<URI, File> locations;
@@ -556,12 +549,12 @@ public enum Pickup {
// which knows how to create this object from a string.
// You can add any of your own Property Editors in the same way.
static {
- PropertyEditorManager.registerEditor(Pickup.class,
+ PropertyEditorManager.registerEditor(Pickup.class, PickupEditor.class);
+ }
+}
</code></pre>
-<p>PickupEditor.class);
- }
- }</p>
+<p>And referenced as follows</p>
<pre><code>@Stateful
public class StratocasterImpl implements Stratocaster {
@@ -591,10 +584,12 @@ are not container controlled resources (
nature). You can configure you ejbs via a properties file and skip the
need for an ejb-jar.xml and it's 5 lines per property madness.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>META-INF/env-entries.properties</B></DIV><DIV class="codeContent panelContent">
- blog = http://acme.org/myblog
- birthday = 1954-03-01
- homeDirectory = /home/esmith/</p>
+<p>META-INF/env-entries.properties</p>
+
+<pre><code>blog = http://acme.org/myblog
+birthday = 1954-03-01
+homeDirectory = /home/esmith/
+</code></pre>
<p><a name="OpenEJB3.1.1-SupportforGlassFishdescriptors"></a></p>
@@ -644,34 +639,24 @@ beginners and people using OpenEJB in a
some annotations to the "Movies" bean's interface as well as use the wrong
annotations for various types of injection:</p>
-<p>{code:none}
-FAIL ... Movies: @Stateful cannot be applied to an interface:
-org.superbiz.injection.jpa.Movies
-FAIL ... Movies: Missing required "type" attribute on class-level
-@Resource usage
-FAIL ... Movies: Mistaken use of @Resource on an EntityManagerFactory
-reference. <br />
- Use @PersistenceUnit for ref
-"org.superbiz.injection.jpa.MoviesImpl/entityManagerFactory"
-FAIL ... Movies: Mistaken use of @PersistenceUnit on an EntityManager
-reference. <br />
- Use @PersistenceContext for ref
-"org.superbiz.injection.jpa.MoviesImpl/entityManager"
-WARN ... Movies: Inoring @RolesAllowed used on interface
-org.superbiz.injection.jpa.Movies method deleteMovie.
- Annotation only usable on the bean class.
-WARN ... Movies: Ignoring @TransactionAttribute used on interface
-org.superbiz.injection.jpa.Movies method addMovie.
- Annotation only usable on the bean class.</p>
+<pre><code>FAIL ... Movies: @Stateful cannot be applied to an interface: org.superbiz.injection.jpa.Movies
+FAIL ... Movies: Missing required "type" attribute on class-level @Resource usage
+FAIL ... Movies: Mistaken use of @Resource on an EntityManagerFactory reference.
+ Use @PersistenceUnit for ref "org.superbiz.injection.jpa.MoviesImpl/entityManagerFactory"
+FAIL ... Movies: Mistaken use of @PersistenceUnit on an EntityManager reference.
+ Use @PersistenceContext for ref "org.superbiz.injection.jpa.MoviesImpl/entityManager"
+WARN ... Movies: Inoring @RolesAllowed used on interface org.superbiz.injection.jpa.Movies method deleteMovie.
+ Annotation only usable on the bean class.
+WARN ... Movies: Ignoring @TransactionAttribute used on interface org.superbiz.injection.jpa.Movies method addMovie.
+ Annotation only usable on the bean class.
+</code></pre>
<h2>JNDI Name Formatting</h2>
-<pre><code>A complication when using EJB is that plain client applications are at the
-</code></pre>
-
-<p>mercy of vendor's chosen methodology for how JNDI names should be
+<p>A complication when using EJB is that plain client applications are at the
+mercy of vendor's chosen methodology for how JNDI names should be
constructed. OpenEJB breaks the mold by allowing you to [specify the exact format|OPENEJBx30:JNDI Names]
- you'd like OpenEJB to use for your server or any individual application.
+you'd like OpenEJB to use for your server or any individual application.
Supply us with a formatting string, such as
"ejb/{ejbName}/{interfaceClass.simpleName}", to get a JNDI layout that
best matches your needs.</p>
Modified: websites/staging/openejb/trunk/content/openejb-3.1.html
==============================================================================
--- websites/staging/openejb/trunk/content/openejb-3.1.html (original)
+++ websites/staging/openejb/trunk/content/openejb-3.1.html Mon Jul 11 02:31:36 2011
@@ -506,12 +506,11 @@ JavaBeans PropertyEditor. We include se
already such as Date, InetAddress, Class, File, URL, URI, Map, List, any
java.lang.Enum and more.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;
- import java.util.Date;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
+import java.util.Date;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource URI blog;
@Resource Date birthday;
@@ -528,11 +527,10 @@ powerful. Declare an injectable field t
will use that information to boost your injection to the next level. For
example:</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>MyBean.java</B></DIV><DIV class="codeContent panelContent">
- import java.net.URI;
- import java.io.File;</p>
+<pre><code>import java.net.URI;
+import java.io.File;
-<pre><code>@Stateful
+@Stateful
public class MyBean {
@Resource List<Class> factories;
@Resource Map<URI, File> locations;
@@ -594,10 +592,10 @@ are not container controlled resources (
nature). You can configure you ejbs via a properties file and skip the
need for an ejb-jar.xml and it's 5 lines per property madness.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>META-INF/env-entries.properties</B></DIV><DIV class="codeContent panelContent">
- blog = http://acme.org/myblog
- birthday = 1954-03-01
- homeDirectory = /home/esmith/</p>
+<pre><code>blog = http://acme.org/myblog
+birthday = 1954-03-01
+homeDirectory = /home/esmith/
+</code></pre>
<p><a name="OpenEJB3.1-SupportforGlassFishdescriptors"></a></p>
@@ -647,34 +645,24 @@ beginners and people using OpenEJB in a
some annotations to the "Movies" bean's interface as well as use the wrong
annotations for various types of injection:</p>
-<p>{code:none}
-FAIL ... Movies: @Stateful cannot be applied to an interface:
-org.superbiz.injection.jpa.Movies
-FAIL ... Movies: Missing required "type" attribute on class-level
-@Resource usage
-FAIL ... Movies: Mistaken use of @Resource on an EntityManagerFactory
-reference. <br />
- Use @PersistenceUnit for ref
-"org.superbiz.injection.jpa.MoviesImpl/entityManagerFactory"
-FAIL ... Movies: Mistaken use of @PersistenceUnit on an EntityManager
-reference. <br />
- Use @PersistenceContext for ref
-"org.superbiz.injection.jpa.MoviesImpl/entityManager"
-WARN ... Movies: Inoring @RolesAllowed used on interface
-org.superbiz.injection.jpa.Movies method deleteMovie.
- Annotation only usable on the bean class.
-WARN ... Movies: Ignoring @TransactionAttribute used on interface
-org.superbiz.injection.jpa.Movies method addMovie.
- Annotation only usable on the bean class.</p>
+<pre><code>FAIL ... Movies: @Stateful cannot be applied to an interface: org.superbiz.injection.jpa.Movies
+FAIL ... Movies: Missing required "type" attribute on class-level @Resource usage
+FAIL ... Movies: Mistaken use of @Resource on an EntityManagerFactory reference.
+ Use @PersistenceUnit for ref "org.superbiz.injection.jpa.MoviesImpl/entityManagerFactory"
+FAIL ... Movies: Mistaken use of @PersistenceUnit on an EntityManager reference.
+ Use @PersistenceContext for ref "org.superbiz.injection.jpa.MoviesImpl/entityManager"
+WARN ... Movies: Inoring @RolesAllowed used on interface org.superbiz.injection.jpa.Movies method deleteMovie.
+ Annotation only usable on the bean class.
+WARN ... Movies: Ignoring @TransactionAttribute used on interface org.superbiz.injection.jpa.Movies method addMovie.
+ Annotation only usable on the bean class.
+</code></pre>
<h2>JNDI Name Formatting</h2>
-<pre><code>A complication when using EJB is that plain client applications are at the
-</code></pre>
-
-<p>mercy of vendor's chosen methodology for how JNDI names should be
+<p>A complication when using EJB is that plain client applications are at the
+mercy of vendor's chosen methodology for how JNDI names should be
constructed. OpenEJB breaks the mold by allowing you to [specify the exact format|OPENEJBx30:JNDI Names]
- you'd like OpenEJB to use for your server or any individual application.
+you'd like OpenEJB to use for your server or any individual application.
Supply us with a formatting string, such as
"ejb/{ejbName}/{interfaceClass.simpleName}", to get a JNDI layout that
best matches your needs.</p>
Modified: websites/staging/openejb/trunk/content/openejb-binaries.html
==============================================================================
--- websites/staging/openejb/trunk/content/openejb-binaries.html (original)
+++ websites/staging/openejb/trunk/content/openejb-binaries.html Mon Jul 11 02:31:36 2011
@@ -155,26 +155,26 @@
<p>Add this to your <em>$HOME/.m2/settings.xml</em> to enable publishing to the
Apache Nexus repo. This works for snapshots or staging final binaries.</p>
-<p>{code:xml|title=.m2/settings.xml}
-<settings>
- <servers>
- <server>
- <id>apache.snapshots.https</id>
- <username>yourapacheid</username>
- <password>yourapachepass</password>
- </server>
- <server>
- <id>apache.releases.https</id>
- <username>yourapacheid</username>
- <password>yourapachepass</password>
- </server>
- </servers>
-</settings></p>
-
-<pre><code>Then publish via:
+<pre><code><settings>
+ <servers>
+ <server>
+ <id>apache.snapshots.https</id>
+ <username>yourapacheid</username>
+ <password>yourapachepass</password>
+ </server>
+ <server>
+ <id>apache.releases.https</id>
+ <username>yourapacheid</username>
+ <password>yourapachepass</password>
+ </server>
+ </servers>
+</settings>
</code></pre>
-<p>$ mvn clean deploy</p>
+<p>Then publish via:</p>
+
+<pre><code>$ mvn clean deploy
+</code></pre>
</DIV>
</P>
Modified: websites/staging/openejb/trunk/content/openjpa.html
==============================================================================
--- websites/staging/openejb/trunk/content/openjpa.html (original)
+++ websites/staging/openejb/trunk/content/openjpa.html Mon Jul 11 02:31:36 2011
@@ -156,27 +156,24 @@
<p>An example of working persistence.xml for OpenJPA:</p>
-<p>{code:xml|title=persistence.xml}
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"></p>
+<pre><code><persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
-<p><persistence-unit name="movie-unit">
- <jta-data-source>movieDatabase</jta-data-source>
- <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
- <class>org.superbiz.injection.jpa.Movie</class></p>
-
-<pre><code><properties>
- <property name="openjpa.jdbc.SynchronizeMappings"
+ <persistence-unit name="movie-unit">
+ <jta-data-source>movieDatabase</jta-data-source>
+ <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+ <class>org.superbiz.injection.jpa.Movie</class>
+
+ <properties>
+ <property name="openjpa.jdbc.SynchronizeMappings"
+value="buildSchema(ForeignKeys=true)"/>
+ </properties>
+ </persistence-unit>
+</persistence>
</code></pre>
-<p>value="buildSchema(ForeignKeys=true)"/>
- </properties>
- </persistence-unit>
-</persistence></p>
-
-<pre><code>Where the datasources above are configured in your openejb.xml as follows:
+<p>Where the datasources above are configured in your openejb.xml as follows:</p>
-{code:xml|title=openejb.xml}
-<Resource id="movieDatabase" type="DataSource">
+<pre><code><Resource id="movieDatabase" type="DataSource">
JdbcDriver = org.hsqldb.jdbcDriver
JdbcUrl = jdbc:hsqldb:mem:moviedb
</Resource>
@@ -190,44 +187,39 @@
<p>Or in properties as follows:</p>
-<p>{code:xml|title=java.lang.System or InitialContext properties}
-p.put("movieDatabase", "new://Resource?type=DataSource");
+<pre><code>p.put("movieDatabase", "new://Resource?type=DataSource");
p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
-p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");</p>
+p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
-<p>p.put("movieDatabaseUnmanaged", "new://Resource?type=DataSource");
+p.put("movieDatabaseUnmanaged", "new://Resource?type=DataSource");
p.put("movieDatabaseUnmanaged.JdbcDriver", "org.hsqldb.jdbcDriver");
p.put("movieDatabaseUnmanaged.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
-p.put("movieDatabaseUnmanaged.JtaManaged", "false");</p>
+p.put("movieDatabaseUnmanaged.JtaManaged", "false");
+</code></pre>
<h1>Common exceptions</h1>
<h2>Table not found in statement</h2>
-<pre><code>Or as derby will report it "Table 'abc.xyz' doesn't exist"
+<p>Or as derby will report it "Table 'abc.xyz' doesn't exist"</p>
-Someone has to create the database structure for your persistent objects.
-</code></pre>
-
-<p>If you add the <em>openjpa.jdbc.SynchronizeMappings</em> property as shown below
+<p>Someone has to create the database structure for your persistent objects.
+If you add the <em>openjpa.jdbc.SynchronizeMappings</em> property as shown below
OpenJPA will auto-create all your tables, all your primary keys and all
foreign keys exactly to match your objects.</p>
-<pre><code>{code:xml|title=persistence.xml}
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+<pre><code><persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="movie-unit">
<!-- your other stuff -->
<properties>
- <property name="openjpa.jdbc.SynchronizeMappings"
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ </properties>
+ </persistence-unit>
+</persistence>
</code></pre>
-<p>value="buildSchema(ForeignKeys=true)"/>
- </properties>
- </persistence-unit>
- </persistence></p>
-
<p><a name="OpenJPA-Auto-commitcannotbesetwhileenrolledinatransaction"></a></p>
<h2>Auto-commit can not be set while enrolled in a transaction</h2>
@@ -242,21 +234,22 @@ foreign keys exactly to match your objec
<h3>Setup</h3>
-<p>Using a EXTENDED persistence context ...
-<DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>bean code</B></DIV><DIV class="codeContent panelContent">
- @PersistenceContext(unitName = "movie-unit", type =
-PersistenceContextType.EXTENDED)
- EntityManager entityManager;</p>
-
-<p>on a persistence unit setup as RESOURCE_LOCAL ...
-{code:xml|title=persistence.xml}
-<persistence-unit name="movie-unit" transaction-type="RESOURCE_LOCAL">
+<p>Using a EXTENDED persistence context ...</p>
+
+<pre><code>@PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.EXTENDED)
+EntityManager entityManager;
+</code></pre>
+
+<p>on a persistence unit setup as RESOURCE_LOCAL ...</p>
+
+<pre><code><persistence-unit name="movie-unit" transaction-type="RESOURCE_LOCAL">
...
-</persistence-unit></p>
+</persistence-unit>
+</code></pre>
+
+<p>inside of a transaction.</p>
-<pre><code>inside of a transaction.
-{code:title=bean code}
-@TransactionAttribute(TransactionAttributeType.REQUIRED)
+<pre><code>@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void addMovie(Movie movie) throws Exception {
entityManager.persist(movie);
}
Modified: websites/staging/openejb/trunk/content/persistence-context.html
==============================================================================
--- websites/staging/openejb/trunk/content/persistence-context.html (original)
+++ websites/staging/openejb/trunk/content/persistence-context.html Mon Jul 11 02:31:36 2011
@@ -157,12 +157,11 @@
<h1>Via annotation</h1>
<p>Both lookup and injection of an EntityManager can be configured via the
-@PersistenceContext annotation.</p>
+<code>@PersistenceContext</code> annotation.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>Usable by EJB, Interceptor, Servlet, Filter, or Listener</B></DIV><DIV class="codeContent panelContent">
- package org.superbiz;</p>
+<pre><code>package org.superbiz;
-<pre><code>import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
@@ -175,22 +174,16 @@ public class MyBean implements MyInterfa
private EntityManager myBarEntityManager;
public void someBusinessMethod() throws Exception {
- if (myBarEntityManager == null) throw new
-</code></pre>
-
-<p>NullPointerException("myBarEntityManager not injected");</p>
+ if (myBarEntityManager == null) throw new NullPointerException("myBarEntityManager not injected");
-<pre><code> // Both can be looked up from JNDI as well
- InitialContext context = new InitialContext();
- EntityManager fooEntityManager = (EntityManager)
+ // Both can be looked up from JNDI as well
+ InitialContext context = new InitialContext();
+ EntityManager fooEntityManager = (EntityManager) context.lookup("java:comp/env/myFooEntityManager");
+ EntityManager barEntityManager = (EntityManager) context.lookup("java:comp/env/org.superbiz.MyBean/myBarEntityManager");
+ }
+}
</code></pre>
-<p>context.lookup("java:comp/env/myFooEntityManager");
- EntityManager barEntityManager = (EntityManager)
-context.lookup("java:comp/env/org.superbiz.MyBean/myBarEntityManager");
- }
- }</p>
-
<p><a name="persistence-context-Viaxml"></a></p>
<h1>Via xml</h1>
@@ -198,24 +191,22 @@ context.lookup("java:comp/env/org.superb
<p>The above @PersistenceContext annotation usage is 100% equivalent to the
following xml.</p>
-<p>{code:xml|title=ejb-jar.xml or web.xml}
-<persistence-context-ref></p>
-
-<p><persistence-context-ref-name>myFooEntityManager</persistence-context-ref-name>
- <persistence-unit-name>foo-unit</persistence-unit-name>
- <persistence-context-type>Transaction</persistence-context-type>
-</persistence-context-ref>
-<persistence-context-ref></p>
-
-<p><persistence-context-ref-name>org.superbiz.calculator.MyBean/myBarEntityManager</persistence-context-ref-name>
- <persistence-unit-name>bar-unit</persistence-unit-name>
- <persistence-context-type>Transaction</persistence-context-type>
- <injection-target></p>
-
-<p><injection-target-class>org.superbiz.calculator.MyBean</injection-target-class>
- <injection-target-name>myBarEntityManager</injection-target-name>
- </injection-target>
-</persistence-context-ref></p>
+<pre><code><persistence-context-ref>
+ <persistence-context-ref-name>myFooEntityManager</persistence-context-ref-name>
+ <persistence-unit-name>foo-unit</persistence-unit-name>
+ <persistence-context-type>Transaction</persistence-context-type>
+</persistence-context-ref>
+
+<persistence-context-ref>
+ <persistence-context-ref-name>org.superbiz.calculator.MyBean/myBarEntityManager</persistence-context-ref-name>
+ <persistence-unit-name>bar-unit</persistence-unit-name>
+ <persistence-context-type>Transaction</persistence-context-type>
+ <injection-target>
+ <injection-target-class>org.superbiz.calculator.MyBean</injection-target-class>
+ <injection-target-name>myBarEntityManager</injection-target-name>
+ </injection-target>
+</persistence-context-ref>
+</code></pre>
</DIV>
</P>
Modified: websites/staging/openejb/trunk/content/persistence-unit-ref.html
==============================================================================
--- websites/staging/openejb/trunk/content/persistence-unit-ref.html (original)
+++ websites/staging/openejb/trunk/content/persistence-unit-ref.html Mon Jul 11 02:31:36 2011
@@ -164,10 +164,9 @@ Annotations and xml have equal function
<h2>Via annotation</h2>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>Usable by EJB, Interceptor, Servlet, Filter, or Listener</B></DIV><DIV class="codeContent panelContent">
- package org.superbiz;</p>
+<pre><code>package org.superbiz;
-<pre><code>import javax.persistence.PersistenceUnit;
+import javax.persistence.PersistenceUnit;
import javax.persistence.EntityManagerFactory;
import javax.ejb.Stateless;
import javax.naming.InitialUnit;
@@ -179,21 +178,15 @@ public class MyBean implements MyInterfa
private EntityManagerFactory myBarEntityManagerFactory;
public void someBusinessMethod() throws Exception {
- if (myBarEntityManagerFactory == null) throw new
-</code></pre>
-
-<p>NullPointerException("myBarEntityManagerFactory not injected");</p>
+ if (myBarEntityManagerFactory == null) throw new NullPointerException("myBarEntityManagerFactory not injected");
-<pre><code> // Both can be looked up from JNDI as well
- InitialContext unit = new InitialContext();
- EntityManagerFactory barEntityManagerFactory =
+ // Both can be looked up from JNDI as well
+ InitialContext unit = new InitialContext();
+ EntityManagerFactory barEntityManagerFactory = (EntityManagerFactory) context.lookup("java:comp/env/org.superbiz.MyBean/myBarEntityManagerFactory");
+ }
+}
</code></pre>
-<p>(EntityManagerFactory)
-context.lookup("java:comp/env/org.superbiz.MyBean/myBarEntityManagerFactory");
- }
- }</p>
-
<p><a name="persistence-unit-ref-Viaxml"></a></p>
<h2>Via xml</h2>
@@ -201,26 +194,22 @@ context.lookup("java:comp/env/org.superb
<p>The above @PersistenceUnit annotation usage is 100% equivalent to the
following xml.</p>
-<p>{code:xml|title=ejb-jar.xml or web.xml}
-<persistence-unit-ref></p>
-
-<p><persistence-unit-ref-name>org.superbiz.calculator.MyBean/myBarEntityManagerFactory</persistence-unit-ref-name>
- <persistence-unit-name>bar-unit</persistence-unit-name>
- <persistence-unit-type>Transaction</persistence-unit-type>
- <injection-target></p>
-
-<p><injection-target-class>org.superbiz.calculator.MyBean</injection-target-class></p>
-
-<p><injection-target-name>myBarEntityManagerFactory</injection-target-name>
- </injection-target>
-</persistence-unit-ref></p>
+<pre><code><persistence-unit-ref>
+ <persistence-unit-ref-name>org.superbiz.calculator.MyBean/myBarEntityManagerFactory</persistence-unit-ref-name>
+ <persistence-unit-name>bar-unit</persistence-unit-name>
+ <persistence-unit-type>Transaction</persistence-unit-type>
+ <injection-target>
+ <injection-target-class>org.superbiz.calculator.MyBean</injection-target-class>
+ <injection-target-name>myBarEntityManagerFactory</injection-target-name>
+ </injection-target>
+</persistence-unit-ref>
+</code></pre>
<h1>Lookup only</h1>
<h2>Via annotation</h2>
-<pre><code>{code:title=Usable by EJB, Interceptor, Servlet, Filter, or Listener}
-package org.superbiz;
+<pre><code>package org.superbiz;
import javax.persistence.PersistenceUnit;
import javax.persistence.EntityManagerFactory;
@@ -232,15 +221,12 @@ import javax.naming.InitialUnit;
public class MyBean implements MyInterface {
public void someBusinessMethod() throws Exception {
- InitialContext context = new InitialContext();
- EntityManagerFactory fooEntityManagerFactory =
+ InitialContext context = new InitialContext();
+ EntityManagerFactory fooEntityManagerFactory = (EntityManagerFactory) context.lookup("java:comp/env/myFooEntityManagerFactory");
+ }
+}
</code></pre>
-<p>(EntityManagerFactory)
-context.lookup("java:comp/env/myFooEntityManagerFactory");
- }
- }</p>
-
<p><a name="persistence-unit-ref-Viaxml"></a></p>
<h1>Via xml</h1>
@@ -248,13 +234,12 @@ context.lookup("java:comp/env/myFooEntit
<p>The above @PersistenceUnit annotation usage is 100% equivalent to the
following xml.</p>
-<p>{code:xml|title=ejb-jar.xml or web.xml}
-<persistence-unit-ref></p>
-
-<p><persistence-unit-ref-name>myFooEntityManagerFactory</persistence-unit-ref-name>
- <persistence-unit-name>foo-unit</persistence-unit-name>
- <persistence-unit-type>Transaction</persistence-unit-type>
-</persistence-unit-ref></p>
+<pre><code><persistence-unit-ref>
+ <persistence-unit-ref-name>myFooEntityManagerFactory</persistence-unit-ref-name>
+ <persistence-unit-name>foo-unit</persistence-unit-name>
+ <persistence-unit-type>Transaction</persistence-unit-type>
+</persistence-unit-ref>
+</code></pre>
</DIV>
</P>
Modified: websites/staging/openejb/trunk/content/properties-tool.html
==============================================================================
--- websites/staging/openejb/trunk/content/properties-tool.html (original)
+++ websites/staging/openejb/trunk/content/properties-tool.html Mon Jul 11 02:31:36 2011
@@ -185,11 +185,11 @@ if you reapply them back into conf/opene
<p>Any component configured in OpenEJB via the openejb.xml (and some that
aren't) can be overridden using system properties. The format is:</p>
-<p><id>.<property-name>=<property-value></p>
+<p><code><id>.<property-name>=<property-value></code></p>
<p>And this can be done on the command line as follows:</p>
-<p>./bin/openejb -D<id>.<property-name>=<property-value> ...</p>
+<p><code>./bin/openejb -D<id>.<property-name>=<property-value> ...</code></p>
<p>Or by adding the property to the conf/system.properties file. Note that
command line overrides win over overrides in the
@@ -208,51 +208,56 @@ new property value before constructing t
<h1>Example output</h1>
-<p>{code:none}
-1. Container(id=Default CMP Container)
-1. className: org.apache.openejb.core.cmp.CmpContainer
-1. Default\ CMP\
-Container.CmpEngineFactory=org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory
+<pre><code># Container(id=Default CMP Container)
+# className: org.apache.openejb.core.cmp.CmpContainer
+#
+Default\ CMP\ Container.CmpEngineFactory=org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory
Default\ CMP\ Container.Engine=instantdb
-Default\ CMP\ Container.ConnectorName=Default JDBC Database</p>
+Default\ CMP\ Container.ConnectorName=Default JDBC Database
-<ol>
-<li>Container(id=Default BMP Container)</li>
-<li>className: org.apache.openejb.core.entity.EntityContainer</li>
-<li><p>Default\ BMP\ Container.PoolSize=10</p></li>
-<li><p>Container(id=Default Stateful Container)</p></li>
-<li>className: org.apache.openejb.core.stateful.StatefulContainer</li>
-<li><p>Default\ Stateful\ Container.BulkPassivate=50
-Default\ Stateful\
-Container.Passivator=org.apache.openejb.core.stateful.SimplePassivater
+# Container(id=Default BMP Container)
+# className: org.apache.openejb.core.entity.EntityContainer
+#
+Default\ BMP\ Container.PoolSize=10
+
+# Container(id=Default Stateful Container)
+# className: org.apache.openejb.core.stateful.StatefulContainer
+#
+Default\ Stateful\ Container.BulkPassivate=50
+Default\ Stateful\ Container.Passivator=org.apache.openejb.core.stateful.SimplePassivater
Default\ Stateful\ Container.TimeOut=20
-Default\ Stateful\ Container.PoolSize=500</p></li>
-<li><p>Container(id=Default Stateless Container)</p></li>
-<li>className: org.apache.openejb.core.stateless.StatelessContainer</li>
-<li><p>Default\ Stateless\ Container.PoolSize=10
+Default\ Stateful\ Container.PoolSize=500
+
+# Container(id=Default Stateless Container)
+# className: org.apache.openejb.core.stateless.StatelessContainer
+#
+Default\ Stateless\ Container.PoolSize=10
Default\ Stateless\ Container.StrictPooling=true
-Default\ Stateless\ Container.TimeOut=0</p></li>
-<li><p>Container(id=Default MDB Container)</p></li>
-<li>className: org.apache.openejb.core.mdb.MdbContainer</li>
-<li><p>Default\ MDB\ Container.ResourceAdapter=Default JMS Resource Adapter
+Default\ Stateless\ Container.TimeOut=0
+
+# Container(id=Default MDB Container)
+# className: org.apache.openejb.core.mdb.MdbContainer
+#
+Default\ MDB\ Container.ResourceAdapter=Default JMS Resource Adapter
Default\ MDB\ Container.InstanceLimit=10
Default\ MDB\ Container.MessageListenerInterface=javax.jms.MessageListener
-Default\ MDB\
-Container.ActivationSpecClass=org.apache.activemq.ra.ActiveMQActivationSpec</p></li>
-<li><p>ConnectionManager(id=Default Local TX ConnectionManager)</p></li>
-<li>className: org.apache.openejb.resource.SharedLocalConnectionManager</li>
-<li>
-<ol>
-<li>Resource(id=Default JMS Resource Adapter)</li>
-</ol></li>
-<li>className: org.apache.activemq.ra.ActiveMQResourceAdapter</li>
-<li><p>Default\ JMS\ Resource\ Adapter.ServerUrl=vm\://localhost?async\=true
-Default\ JMS\ Resource\
-Adapter.BrokerXmlConfig=broker\:(tcp\://localhost\:61616)
-Default\ JMS\ Resource\ Adapter.ThreadPoolSize=30</p></li>
-<li><p>Resource(id=Default JDBC Database)</p></li>
-<li>className: org.apache.openejb.resource.jdbc.BasicManagedDataSource</li>
-<li><p>Default\ JDBC\ Database.MinIdle=0
+Default\ MDB\ Container.ActivationSpecClass=org.apache.activemq.ra.ActiveMQActivationSpec
+
+# ConnectionManager(id=Default Local TX ConnectionManager)
+# className: org.apache.openejb.resource.SharedLocalConnectionManager
+#
+
+# Resource(id=Default JMS Resource Adapter)
+# className: org.apache.activemq.ra.ActiveMQResourceAdapter
+#
+Default\ JMS\ Resource\ Adapter.ServerUrl=vm\://localhost?async\=true
+Default\ JMS\ Resource\ Adapter.BrokerXmlConfig=broker\:(tcp\://localhost\:61616)
+Default\ JMS\ Resource\ Adapter.ThreadPoolSize=30
+
+# Resource(id=Default JDBC Database)
+# className: org.apache.openejb.resource.jdbc.BasicManagedDataSource
+#
+Default\ JDBC\ Database.MinIdle=0
Default\ JDBC\ Database.Password=xxxx
Default\ JDBC\ Database.JdbcUrl=jdbc\:hsqldb\:file\:hsqldb
Default\ JDBC\ Database.MaxIdle=20
@@ -272,10 +277,12 @@ Default\ JDBC\ Database.ConnectionInterf
Default\ JDBC\ Database.TestOnReturn=false
Default\ JDBC\ Database.MinEvictableIdleTimeMillis=1800000
Default\ JDBC\ Database.NumTestsPerEvictionRun=3
-Default\ JDBC\ Database.InitialSize=0</p></li>
-<li><p>Resource(id=Default Unmanaged JDBC Database)</p></li>
-<li>className: org.apache.openejb.resource.jdbc.BasicDataSource</li>
-<li><p>Default\ Unmanaged\ JDBC\ Database.MaxWait=-1
+Default\ JDBC\ Database.InitialSize=0
+
+# Resource(id=Default Unmanaged JDBC Database)
+# className: org.apache.openejb.resource.jdbc.BasicDataSource
+#
+Default\ Unmanaged\ JDBC\ Database.MaxWait=-1
Default\ Unmanaged\ JDBC\ Database.InitialSize=0
Default\ Unmanaged\ JDBC\ Database.DefaultAutoCommit=true
Default\ Unmanaged\ JDBC\ Database.ConnectionProperties=
@@ -283,8 +290,7 @@ Default\ Unmanaged\ JDBC\ Database.MaxAc
Default\ Unmanaged\ JDBC\ Database.TestOnBorrow=true
Default\ Unmanaged\ JDBC\ Database.JdbcUrl=jdbc\:hsqldb\:file\:hsqldb
Default\ Unmanaged\ JDBC\ Database.TestOnReturn=false
-Default\ Unmanaged\ JDBC\
-Database.AccessToUnderlyingConnectionAllowed=false
+Default\ Unmanaged\ JDBC\ Database.AccessToUnderlyingConnectionAllowed=false
Default\ Unmanaged\ JDBC\ Database.Password=xxxx
Default\ Unmanaged\ JDBC\ Database.MinEvictableIdleTimeMillis=1800000
Default\ Unmanaged\ JDBC\ Database.PoolPreparedStatements=false
@@ -296,66 +302,73 @@ Default\ Unmanaged\ JDBC\ Database.TimeB
Default\ Unmanaged\ JDBC\ Database.JdbcDriver=org.hsqldb.jdbcDriver
Default\ Unmanaged\ JDBC\ Database.UserName=sa
Default\ Unmanaged\ JDBC\ Database.MaxIdle=10
-Default\ Unmanaged\ JDBC\ Database.TestWhileIdle=false</p></li>
-<li><p>Resource(id=Default JMS Connection Factory)</p></li>
-<li>className: org.apache.activemq.ra.ActiveMQManagedConnectionFactory</li>
-<li><p>Default\ JMS\ Connection\
-Factory.ConnectionInterface=javax.jms.ConnectionFactory, \
+Default\ Unmanaged\ JDBC\ Database.TestWhileIdle=false
+
+# Resource(id=Default JMS Connection Factory)
+# className: org.apache.activemq.ra.ActiveMQManagedConnectionFactory
+#
+Default\ JMS\ Connection\ Factory.ConnectionInterface=javax.jms.ConnectionFactory, \
javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory
-Default\ JMS\ Connection\ Factory.ResourceAdapter=Default JMS Resource
-Adapter</p></li>
-<li><p>SecurityService(id=Default Security Service)</p></li>
-<li>className: org.apache.openejb.core.security.SecurityServiceImpl</li>
-<li>
-<ol>
-<li>TransactionManager(id=Default Transaction Manager)</li>
-</ol></li>
-<li>className:
-org.apache.geronimo.transaction.manager.GeronimoTransactionManager</li>
-<li>
-<ol>
-<li>ServerService(id=httpejbd)</li>
-</ol></li>
-<li>className: org.apache.openejb.server.httpd.HttpEjbServer</li>
-<li><p>httpejbd.port=4204
+Default\ JMS\ Connection\ Factory.ResourceAdapter=Default JMS Resource Adapter
+
+# SecurityService(id=Default Security Service)
+# className: org.apache.openejb.core.security.SecurityServiceImpl
+#
+
+# TransactionManager(id=Default Transaction Manager)
+# className: org.apache.geronimo.transaction.manager.GeronimoTransactionManager
+#
+
+# ServerService(id=httpejbd)
+# className: org.apache.openejb.server.httpd.HttpEjbServer
+#
+httpejbd.port=4204
httpejbd.name=httpejbd
httpejbd.disabled=false
httpejbd.server=org.apache.openejb.server.httpd.HttpEjbServer
httpejbd.threads=200
-httpejbd.bind=127.0.0.1</p></li>
-<li><p>ServerService(id=telnet)</p></li>
-<li>className: org.apache.openejb.server.telnet.TelnetServer</li>
-<li><p>telnet.port=4202
+httpejbd.bind=127.0.0.1
+
+# ServerService(id=telnet)
+# className: org.apache.openejb.server.telnet.TelnetServer
+#
+telnet.port=4202
telnet.name=telnet
telnet.disabled=false
telnet.bind=127.0.0.1
telnet.threads=5
-telnet.server=org.apache.openejb.server.telnet.TelnetServer</p></li>
-<li><p>ServerService(id=ejbd)</p></li>
-<li>className: org.apache.openejb.server.ejbd.EjbServer</li>
-<li><p>ejbd.disabled=false
+telnet.server=org.apache.openejb.server.telnet.TelnetServer
+
+# ServerService(id=ejbd)
+# className: org.apache.openejb.server.ejbd.EjbServer
+#
+ejbd.disabled=false
ejbd.bind=127.0.0.1
ejbd.server=org.apache.openejb.server.ejbd.EjbServer
ejbd.port=4201
ejbd.name=ejbd
-ejbd.threads=200</p></li>
-<li><p>ServerService(id=hsql)</p></li>
-<li>className: org.apache.openejb.server.hsql.HsqlService</li>
-<li><p>hsql.port=9001
+ejbd.threads=200
+
+# ServerService(id=hsql)
+# className: org.apache.openejb.server.hsql.HsqlService
+#
+hsql.port=9001
hsql.name=hsql
hsql.disabled=false
hsql.server=org.apache.openejb.server.hsql.HsqlService
-hsql.bind=127.0.0.1</p></li>
-<li><p>ServerService(id=admin)</p></li>
-<li>className: org.apache.openejb.server.admin.AdminDaemon</li>
-<li>admin.disabled=false
+hsql.bind=127.0.0.1
+
+# ServerService(id=admin)
+# className: org.apache.openejb.server.admin.AdminDaemon
+#
+admin.disabled=false
admin.bind=127.0.0.1
admin.only_from=localhost
admin.port=4200
admin.threads=1
admin.name=admin
-admin.server=org.apache.openejb.server.admin.AdminDaemon</li>
-</ol>
+admin.server=org.apache.openejb.server.admin.AdminDaemon
+</code></pre>
</DIV>
</P>