[jboss-cvs] JBossAS SVN: r64166 - in trunk/ejb3/docs/tutorial: mdb and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 20 14:15:17 EDT 2007
Author: bdecoste
Date: 2007-07-20 14:15:16 -0400 (Fri, 20 Jul 2007)
New Revision: 64166
Added:
trunk/ejb3/docs/tutorial/mdb/custom-ejb3-interceptors-aop.xml
trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/bean/DefaultedExampleMDB.java
trunk/ejb3/docs/tutorial/service/service-xmbean.xml
trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanService.java
trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanServiceRemote.java
trunk/ejb3/docs/tutorial/third_party_jms/
trunk/ejb3/docs/tutorial/third_party_jms/application.xml
trunk/ejb3/docs/tutorial/third_party_jms/build.xml
trunk/ejb3/docs/tutorial/third_party_jms/jndi.properties
trunk/ejb3/docs/tutorial/third_party_jms/log4j.xml
trunk/ejb3/docs/tutorial/third_party_jms/src/
trunk/ejb3/docs/tutorial/third_party_jms/src/org/
trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/
trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/
trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/
trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/bean/
trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/bean/ExampleMDB.java
trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/client/
trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/client/Client.java
trunk/ejb3/docs/tutorial/third_party_jms/thirdparty-jms-service.xml
trunk/ejb3/docs/tutorial/third_party_jms/thirdparty/
trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.html
trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.wiki
Modified:
trunk/ejb3/docs/tutorial/mdb/build.xml
trunk/ejb3/docs/tutorial/mdb/mdb.html
trunk/ejb3/docs/tutorial/mdb/mdb.wiki
trunk/ejb3/docs/tutorial/mdb/queue-example-service.xml
trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/client/Client.java
trunk/ejb3/docs/tutorial/service/build.xml
trunk/ejb3/docs/tutorial/service/service.html
trunk/ejb3/docs/tutorial/service/service.wiki
trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/client/Client.java
Log:
[EJBTHREE-809] merged updated tutorials
Modified: trunk/ejb3/docs/tutorial/mdb/build.xml
===================================================================
--- trunk/ejb3/docs/tutorial/mdb/build.xml 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/mdb/build.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -60,8 +60,12 @@
<fileset dir="${build.classes.dir}">
<include name="**/*.class"/>
</fileset>
+ <fileset dir=".">
+ <include name="custom-ejb3-interceptors-aop.xml"/>
+ </fileset>
</jar>
<copy file="queue-example-service.xml" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+ <!--copy file="custom-ejb3-interceptors-aop.xml" todir="${jboss.home}/server/${jboss.server.config}/deploy"/-->
<sleep seconds="5"/>
<copy file="build/tutorial.jar" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
</target>
@@ -83,6 +87,7 @@
<delete dir="${build.dir}"/>
<delete file="${jboss.home}/server/${jboss.server.config}/deploy/tutorial.jar"/>
<delete file="${jboss.home}/server/${jboss.server.config}/deploy/queue-example-service.xml"/>
+ <!--delete file="${jboss.home}/server/${jboss.server.config}/deploy/custom-ejb3-interceptors-aop.xml"/-->
</target>
Added: trunk/ejb3/docs/tutorial/mdb/custom-ejb3-interceptors-aop.xml
===================================================================
--- trunk/ejb3/docs/tutorial/mdb/custom-ejb3-interceptors-aop.xml (rev 0)
+++ trunk/ejb3/docs/tutorial/mdb/custom-ejb3-interceptors-aop.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE aop PUBLIC
+ "-//JBoss//DTD JBOSS AOP 1.0//EN"
+ "http://labs.jboss.com/portal/jbossaop/dtd/jboss-aop_1_0.dtd">
+
+<aop>
+ <interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
+ <interceptor factory="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory" scope="PER_CLASS_JOINPOINT"/>
+ <interceptor factory="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.stateless.StatelessInstanceInterceptor" scope="PER_VM"/>
+ <interceptor factory="org.jboss.ejb3.tx.TxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
+
+ <domain name="Custom Message Driven Bean">
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+ @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=15, timeout=10000)
+ </annotation>
+ <annotation expr="!class(@org.jboss.annotation.ejb.DefaultActivationSpecs)">
+ @org.jboss.annotation.ejb.DefaultActivationSpecs (value={@javax.ejb.ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"), @javax.ejb.ActivationConfigProperty(propertyName="destination", propertyValue="queue/tutorial/defaultedexample")})
+ </annotation>
+ </domain>
+</aop>
Modified: trunk/ejb3/docs/tutorial/mdb/mdb.html
===================================================================
--- trunk/ejb3/docs/tutorial/mdb/mdb.html 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/mdb/mdb.html 2007-07-20 18:15:16 UTC (rev 64166)
@@ -3,19 +3,71 @@
<p>
<h2>Message Drive Beans</h2>
-This example shows you how to implement an MDB with EJB 3.0.
</p><p>
+<h3>The MDB</h3>
+
+This example shows you how to implement an MDB with EJB 3.0 using annotations.
</p><p>
-You configure properties by using the @MessageDriven(activationConfig) attribute with a bunch
-of @ActivationConfigProperty. All properties that you can set are defined in this file. Internally
-this is the class that is created to hold config information.
+Take a look at <a href="src/org/jboss/tutorial/mdb/bean/ExampleMDB.java">ExampleMDB.java</a>. The @MessageDriven
+annotation defines the bean as an MDB. The <tt>activationConfig</tt> attribute contains much of the
+MDB configuration via @ActivationConfigProperty annotations. Also notice that the MDB source contains
+properties for <tt>destinationType</tt> and <tt>destination</tt>.
</p><p>
-<a href="http://cvs.sourceforge.net/viewcvs.py/jboss/jboss-ejb3/src/main/org/jboss/ejb3/mdb/MDBConfig.java?rev=1.1&view=markup">MDBConfig.java</a>
+The following is the list of standard Activation Config Properties available from the JCA1.5
+specification. Also listed are the respective types and default values where defined.
</p><p>
-Take a look at <a href="src/org/jboss/tutorial/mdb/bean/ExampleMDB.java">ExampleMDB.java</a>.
+<pre>
+String destination - the jndi name of the Queue or Topic - MANDATORY
+String destinationType - the type of destination valid values are javax.jms.Queue or javax.jms.Topic
+String messageSelector - the message selector of the subscription
+int acknowledgeMode - the type of acknowledgement when not using transacted jms - valid values AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE - default is AUTO_ACKNOWLEDGE
+String clientID - the client id of the connection
+boolean subscriptionDurability - whether topic subscriptions are durable - valid values Durable or NonDurable - default is NonDurable
+String subscriptionName - the subsription name of the topic subscription
+</pre>
</p><p>
-The <a href="queue-example-service.xml">queue-example-service.xml</a> file defines the queue. This is the same in regular JBoss.
+The following is the list of Activation Config Properties available as JBoss extensions.
+Also listed are the respective types and default values where defined.
</p><p>
+<pre>
+boolean isTopic - sets the destinationType - default is false
+String providerAdapterJNDI - the jndi name of the jms provider - default java:/DefaultJMSProvider
+String user - the user id used to connect to the jms server
+String pass - the password of the user
+int maxMessages - read this number of messages before delivering messages to the mdb (each message is delivered individually on the same thread in an attempt to avoid context excessive context switching) - default 1
+int minSession - the minimum number of jms sessions that are available to concurrently deliver messages to this mdb - default 1
+int maxSession - the maximum number of jms sessions that can concurrently deliver messages to this mdb - default 15
+long reconnectInterval - the length of time in seconds between attempts to (re-)connect to the jms provider - default 10 seconds
+long keepAlive - the length of time in milliseconds that sessions over the minimum are kept alive - default is 60 seconds
+booleam sessionTransacted - whether the sessions are transacted - default is true
+boolean useDLQ - whether to use a DLQ handler - valid values true or false - default is true
+String dLQJNDIName - the JNDI name of the DLQ - default is "queue/DLQ"
+String dLQHandler - the org.jboss.resource.adapter.jms.inflow.DLQHandler implementation class name - default org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler
+int dLQMaxResent - the maximum number of times a message is redelivered before it is sent to the DLQ - default 5
+String dLQUser - the user id used to make the dlq connection to the jms server
+String dLQPassword - the password of the DLQUser
+String dLQClientID - the client id of the dlq connection - default is null
+boolean redeliverUnspecified - whether to attempt to redeliver a message in an unspecified transaction context - default is true
+int transactionTimeout - time in seconds for the transaction timeout - default is the timeout set for the resource manager
+</pre>
+</p><p>
+<h3> The Destination</h3>
+
+The <a href="queue-example-service.xml">queue-example-service.xml</a> file defines the Queues. There are no changes for deploying
+an EJB3 ready Destination as a standard Destination.
+</p><p>
+<h3> Configuring Default MDB Properties</h3>
+
+You can configure MDBs to have default properties using the @DefaultActivationSpecs annotations. Take a
+look at <a href="custom-ejb3-interceptors-aop.xml">custom-ejb3-interceptors-aop.xml</a>. Here we define a custom
+container configuration domain, "Custom Message Driven Bean", that adds a @DefaultActivationSpecs
+annotation and <tt>destinationType</tt> and <tt>destination</tt> properties to each MDB using this domain.
+Now take a look at <a href="src/org/jboss/tutorial/mdb/bean/DefaultedExampleMDB.java">DefaultedExampleMDB.java</a>.
+The MDB is configured to use the "Custom Message Driven Bean" container configuration domain via the
+ at AspectDomain annotation. Note there are no properties defined in the @MessageDriven annotation (they
+are all from the defaults).
+</p><p>
+</p><p>
<h4>Building and Running</h4>
To build and run the example, make sure you have <tt>ejb3.deployer</tt> installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
@@ -27,12 +79,16 @@
</pre>
</p><p>
-Look in the console window to determine that the message was sent.
+Look in the console window to determine that the messages was sent and received.
</p><p>
<pre>
-01:01:20,828 INFO [STDOUT] ----------------
-01:01:20,828 INFO [STDOUT] Received message
-01:01:20,828 INFO [STDOUT] ----------------
+09:43:35,893 INFO [STDOUT] ----------------
+09:43:35,894 INFO [STDOUT] ----------------
+09:43:35,894 INFO [STDOUT] Received message
+09:43:35,894 INFO [STDOUT] Received defaulted message
+09:43:35,894 INFO [STDOUT] ----------------
+09:43:35,894 INFO [STDOUT] ----------------
+
</pre>
</p><p>
</p><p>
Modified: trunk/ejb3/docs/tutorial/mdb/mdb.wiki
===================================================================
--- trunk/ejb3/docs/tutorial/mdb/mdb.wiki 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/mdb/mdb.wiki 2007-07-20 18:15:16 UTC (rev 64166)
@@ -1,17 +1,66 @@
!!!Message Drive Beans
-This example shows you how to implement an MDB with EJB 3.0.
+!!The MDB
+This example shows you how to implement an MDB with EJB 3.0 using annotations.
-You configure properties by using the @MessageDriven(activationConfig) attribute with a bunch
-of @ActivationConfigProperty. All properties that you can set are defined in this file. Internally
-this is the class that is created to hold config information.
+Take a look at [ExampleMDB.java|src/org/jboss/tutorial/mdb/bean/ExampleMDB.java]. The @MessageDriven
+annotation defines the bean as an MDB. The {{activationConfig}} attribute contains much of the
+MDB configuration via @ActivationConfigProperty annotations. Also notice that the MDB source contains
+properties for {{destinationType}} and {{destination}}.
-[MDBConfig.java|http://cvs.sourceforge.net/viewcvs.py/jboss/jboss-ejb3/src/main/org/jboss/ejb3/mdb/MDBConfig.java?rev=1.1&view=markup]
+The following is the list of standard Activation Config Properties available from the JCA1.5
+specification. Also listed are the respective types and default values where defined.
-Take a look at [ExampleMDB.java|src/org/jboss/tutorial/mdb/bean/ExampleMDB.java].
+{{{
+String destination - the jndi name of the Queue or Topic - MANDATORY
+String destinationType - the type of destination valid values are javax.jms.Queue or javax.jms.Topic
+String messageSelector - the message selector of the subscription
+int acknowledgeMode - the type of acknowledgement when not using transacted jms - valid values AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE - default is AUTO_ACKNOWLEDGE
+String clientID - the client id of the connection
+boolean subscriptionDurability - whether topic subscriptions are durable - valid values Durable or NonDurable - default is NonDurable
+String subscriptionName - the subsription name of the topic subscription
+}}}
-The [queue-example-service.xml|queue-example-service.xml] file defines the queue. This is the same in regular JBoss.
+The following is the list of Activation Config Properties available as JBoss extensions.
+Also listed are the respective types and default values where defined.
+{{{
+boolean isTopic - sets the destinationType - default is false
+String providerAdapterJNDI - the jndi name of the jms provider - default java:/DefaultJMSProvider
+String user - the user id used to connect to the jms server
+String pass - the password of the user
+int maxMessages - read this number of messages before delivering messages to the mdb (each message is delivered individually on the same thread in an attempt to avoid context excessive context switching) - default 1
+int minSession - the minimum number of jms sessions that are available to concurrently deliver messages to this mdb - default 1
+int maxSession - the maximum number of jms sessions that can concurrently deliver messages to this mdb - default 15
+long reconnectInterval - the length of time in seconds between attempts to (re-)connect to the jms provider - default 10 seconds
+long keepAlive - the length of time in milliseconds that sessions over the minimum are kept alive - default is 60 seconds
+booleam sessionTransacted - whether the sessions are transacted - default is true
+boolean useDLQ - whether to use a DLQ handler - valid values true or false - default is true
+String dLQJNDIName - the JNDI name of the DLQ - default is "queue/DLQ"
+String dLQHandler - the org.jboss.resource.adapter.jms.inflow.DLQHandler implementation class name - default org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler
+int dLQMaxResent - the maximum number of times a message is redelivered before it is sent to the DLQ - default 5
+String dLQUser - the user id used to make the dlq connection to the jms server
+String dLQPassword - the password of the DLQUser
+String dLQClientID - the client id of the dlq connection - default is null
+boolean redeliverUnspecified - whether to attempt to redeliver a message in an unspecified transaction context - default is true
+int transactionTimeout - time in seconds for the transaction timeout - default is the timeout set for the resource manager
+}}}
+
+!! The Destination
+The [queue-example-service.xml|queue-example-service.xml] file defines the Queues. There are no changes for deploying
+an EJB3 ready Destination as a standard Destination.
+
+!! Configuring Default MDB Properties
+You can configure MDBs to have default properties using the @DefaultActivationSpecs annotations. Take a
+look at [custom-ejb3-interceptors-aop.xml|custom-ejb3-interceptors-aop.xml]. Here we define a custom
+container configuration domain, "Custom Message Driven Bean", that adds a @DefaultActivationSpecs
+annotation and {{destinationType}} and {{destination}} properties to each MDB using this domain.
+Now take a look at [DefaultedExampleMDB.java|src/org/jboss/tutorial/mdb/bean/DefaultedExampleMDB.java].
+The MDB is configured to use the "Custom Message Driven Bean" container configuration domain via the
+ at AspectDomain annotation. Note there are no properties defined in the @MessageDriven annotation (they
+are all from the defaults).
+
+
!Building and Running
To build and run the example, make sure you have {{ejb3.deployer}} installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
{{{
@@ -22,12 +71,16 @@
}}}
-Look in the console window to determine that the message was sent.
+Look in the console window to determine that the messages was sent and received.
{{{
-01:01:20,828 INFO [STDOUT] ----------------
-01:01:20,828 INFO [STDOUT] Received message
-01:01:20,828 INFO [STDOUT] ----------------
+09:43:35,893 INFO [STDOUT] ----------------
+09:43:35,894 INFO [STDOUT] ----------------
+09:43:35,894 INFO [STDOUT] Received message
+09:43:35,894 INFO [STDOUT] Received defaulted message
+09:43:35,894 INFO [STDOUT] ----------------
+09:43:35,894 INFO [STDOUT] ----------------
+
}}}
Modified: trunk/ejb3/docs/tutorial/mdb/queue-example-service.xml
===================================================================
--- trunk/ejb3/docs/tutorial/mdb/queue-example-service.xml 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/mdb/queue-example-service.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -6,5 +6,9 @@
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
-
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=defaultedtutorial">
+ <attribute name="JNDIName">queue/tutorial/defaultedexample</attribute>
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ </mbean>
</server>
Added: trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/bean/DefaultedExampleMDB.java
===================================================================
--- trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/bean/DefaultedExampleMDB.java (rev 0)
+++ trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/bean/DefaultedExampleMDB.java 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.mdb.bean;
+
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import org.jboss.annotation.ejb.AspectDomain;
+
+ at MessageDriven
+ at AspectDomain("Custom Message Driven Bean")
+public class DefaultedExampleMDB implements MessageListener
+{
+ public void onMessage(Message recvMsg)
+ {
+ System.out.println("----------------");
+ System.out.println("Received defaulted message");
+ System.out.println("----------------");
+ }
+
+}
Modified: trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/client/Client.java
===================================================================
--- trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/client/Client.java 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/client/Client.java 2007-07-20 18:15:16 UTC (rev 64166)
@@ -33,11 +33,17 @@
{
public static void main(String[] args) throws Exception
{
+ processMessage("queue/tutorial/example");
+ processMessage("queue/tutorial/defaultedexample");
+ }
+
+ private static void processMessage(String queueBinding) throws Exception
+ {
QueueConnection cnn = null;
QueueSender sender = null;
QueueSession session = null;
InitialContext ctx = new InitialContext();
- Queue queue = (Queue) ctx.lookup("queue/tutorial/example");
+ Queue queue = (Queue) ctx.lookup(queueBinding);
QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
cnn = factory.createQueueConnection();
session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
@@ -46,7 +52,7 @@
sender = session.createSender(queue);
sender.send(msg);
- System.out.println("Message sent successfully to remote queue.");
+ System.out.println("Message sent successfully to remote queue " + queueBinding);
}
}
Modified: trunk/ejb3/docs/tutorial/service/build.xml
===================================================================
--- trunk/ejb3/docs/tutorial/service/build.xml 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/service/build.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -60,6 +60,9 @@
<fileset dir="${build.classes.dir}">
<include name="**/*.class"/>
</fileset>
+ <fileset dir=".">
+ <include name="service-xmbean.xml"/>
+ </fileset>
</jar>
<copy file="build/tutorial.jar" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
</target>
Added: trunk/ejb3/docs/tutorial/service/service-xmbean.xml
===================================================================
--- trunk/ejb3/docs/tutorial/service/service-xmbean.xml (rev 0)
+++ trunk/ejb3/docs/tutorial/service/service-xmbean.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC
+ "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
+<mbean>
+
+ <description>EJB3 Service XMBean Example</description>
+
+ <class>org.jboss.tutorial.service.bean.XMBeanService</class>
+
+ <!-- Constructors -->
+ <constructor>
+ <description>The default constructor</description>
+ <name>XMBeanService</name>
+ </constructor>
+
+ <!-- Attributes -->
+
+ <attribute access="read-write" getMethod="getAttribute" setMethod="setAttribute">
+ <description>Test attribute</description>
+ <name>IntAttribute</name>
+ <type>java.lang.Integer</type>
+ </attribute>
+
+ <!-- Operations -->
+ <operation>
+ <description>Say Hello</description>
+ <name>sayHello</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+</mbean>
+
Modified: trunk/ejb3/docs/tutorial/service/service.html
===================================================================
--- trunk/ejb3/docs/tutorial/service/service.html 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/service/service.html 2007-07-20 18:15:16 UTC (rev 64166)
@@ -107,7 +107,16 @@
}
</pre>
</p><p>
+<h3> Defining Management Interface via XML</h3>
+
+You can deploy a Service bean as an XMBean, where the management attributes and operations are defined
+via xml. Take a look at <a href="src/org/jboss/tutorial/service/bean/XMBeanService.java">XMBeanService.xml</a>. Note
+the @Service annotation specifies an <tt>xmbean</tt> property. Also note there is no @Management annotation.
+Now take a look at <a href="service-xmbean.xml">service-xmbean.xml</a>. This is the file referenced by the <tt>xmbean</tt>
+property and specifies the bean's management attributes and operations. Note the <tt>class</tt>, <tt>constructor</tt>,
+<tt>attribute</tt>, and <tt>operation</tt> elements.
</p><p>
+</p><p>
<h3>Building</h3>
To build and run the example, make sure you have ejb3.deployer installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
@@ -143,10 +152,13 @@
Buildfile: build.xml
run:
+ [java] invoking Service...
[java] attribute value for singleton obtained via JMX is what we set via remote i/f: 100
[java] Hello from service One
[java] Hello from service Two
-
+ [java] invoking XMBean...
+ [java] attribute value for singleton obtained via JMX is what we set via remote i/f: 0
+ [java] Hello from an XMBean
</pre>
</p><p>
The JBoss console should show the following output
Modified: trunk/ejb3/docs/tutorial/service/service.wiki
===================================================================
--- trunk/ejb3/docs/tutorial/service/service.wiki 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/service/service.wiki 2007-07-20 18:15:16 UTC (rev 64166)
@@ -93,7 +93,15 @@
}
}}}
+!! Defining Management Interface via XML
+You can deploy a Service bean as an XMBean, where the management attributes and operations are defined
+via xml. Take a look at [XMBeanService.xml|src/org/jboss/tutorial/service/bean/XMBeanService.java]. Note
+the @Service annotation specifies an {{xmbean}} property. Also note there is no @Management annotation.
+Now take a look at [service-xmbean.xml|service-xmbean.xml]. This is the file referenced by the {{xmbean}}
+property and specifies the bean's management attributes and operations. Note the {{class}}, {{constructor}},
+{{attribute}}, and {{operation}} elements.
+
!!Building
To build and run the example, make sure you have ejb3.deployer installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
@@ -128,10 +136,13 @@
Buildfile: build.xml
run:
+ [java] invoking Service...
[java] attribute value for singleton obtained via JMX is what we set via remote i/f: 100
[java] Hello from service One
[java] Hello from service Two
-
+ [java] invoking XMBean...
+ [java] attribute value for singleton obtained via JMX is what we set via remote i/f: 0
+ [java] Hello from an XMBean
}}}
The JBoss console should show the following output
Added: trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanService.java
===================================================================
--- trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanService.java (rev 0)
+++ trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanService.java 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.service.bean;
+
+import org.jboss.annotation.ejb.Service;
+
+ at Service(objectName="jboss.ejb3.tutorial:service=XMBeanService", xmbean="resource:service-xmbean.xml")
+public class XMBeanService implements XMBeanServiceRemote
+{
+ int attribute;
+
+ public void setIntAttribute(int attribute)
+ {
+ this.attribute = attribute;
+ }
+
+ public int getIntAttribute()
+ {
+ return this.attribute;
+ }
+
+ public String sayHello()
+ {
+ return "Hello from an XMBean";
+ }
+
+ public void remoteBusinessMethod()
+ {
+
+ }
+}
Added: trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanServiceRemote.java
===================================================================
--- trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanServiceRemote.java (rev 0)
+++ trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/bean/XMBeanServiceRemote.java 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.service.bean;
+
+
+public interface XMBeanServiceRemote
+{
+ void remoteBusinessMethod();
+}
Modified: trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/client/Client.java
===================================================================
--- trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/client/Client.java 2007-07-20 14:26:09 UTC (rev 64165)
+++ trunk/ejb3/docs/tutorial/service/src/org/jboss/tutorial/service/client/Client.java 2007-07-20 18:15:16 UTC (rev 64166)
@@ -36,7 +36,15 @@
InitialContext ctx = new InitialContext();
//Get hold of the MBean server invoker
RMIAdaptor server = (RMIAdaptor)ctx.lookup("jmx/invoker/RMIAdaptor");
-
+
+ invokeService(ctx, server);
+
+ invokeXMBean(ctx, server);
+ }
+
+ public static void invokeService(InitialContext ctx, RMIAdaptor server) throws Exception
+ {
+ System.out.println("invoking Service...");
//Set attribute on singleton ServiceOne via remote interface
ServiceOneRemote serviceOne = (ServiceOneRemote) ctx.lookup("ServiceOne/remote");
serviceOne.setAttribute(100);
@@ -58,4 +66,20 @@
String service2Hello = (String)server.invoke(service3, "serviceTwoHello", noArgs, noSig);
System.out.println(service2Hello);
}
+
+ public static void invokeXMBean(InitialContext ctx, RMIAdaptor server) throws Exception
+ {
+ System.out.println("invoking XMBean...");
+ ObjectName service = new ObjectName("jboss.ejb3.tutorial:service=XMBeanService");
+ //Get attribute of singleton XMBeanService via JMX
+ int attr = (Integer)server.getAttribute(service, "IntAttribute");
+ System.out.println("attribute value for singleton obtained via JMX is what we set via remote i/f: " + attr);
+
+ //Call sayHello() on XMBeanService
+ Object[] noArgs = new Object[0];//No arguments
+ String[] noSig = new String[0];//No parameters in signature
+
+ String hello = (String)server.invoke(service, "sayHello", noArgs, noSig);
+ System.out.println(hello);
+ }
}
Added: trunk/ejb3/docs/tutorial/third_party_jms/application.xml
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/application.xml (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/application.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
+
+<application>
+ <display-name>JBoss EJB Tutorial</display-name>
+
+ <module>
+ <java>lib/jms-1.1.jar</java>
+ </module>
+
+ <module>
+ <java>lib/jndi-1.2.1.jar</java>
+ </module>
+
+ <module>
+ <java>lib/openjms-0.7.7-beta-1.jar</java>
+ </module>
+
+ <module>
+ <ejb>tutorial.jar</ejb>
+ </module>
+
+</application>
+
+
Added: trunk/ejb3/docs/tutorial/third_party_jms/build.xml
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/build.xml (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/build.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="ejbjar" basedir=".">
+
+ <property environment="env"/>
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="jboss.home" value="${env.JBOSS_HOME}"/> <property name="jboss.server.config" value="all"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="thirdparty.lib.dir" value="thirdparty"/>
+
+ <!-- Build classpath -->
+ <path id="classpath">
+ <!-- So that we can get jndi.properties for InitialContext -->
+ <pathelement location="${basedir}"/>
+ <fileset dir="${jboss.home}/lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="${jboss.home}/server/${jboss.server.config}/deployers/ejb3.deployer">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${jboss.home}/server/${jboss.server.config}/deployers/jboss-aop-jboss5.deployer">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${thirdparty.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="${build.classes.dir}"/>
+ </path>
+
+ <property name="build.classpath" refid="classpath"/>
+
+ <!-- =================================================================== -->
+ <!-- Prepares the build directory -->
+ <!-- =================================================================== -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the source code -->
+ <!-- =================================================================== -->
+ <target name="compile" depends="prepare">
+ <javac srcdir="${src.dir}"
+ destdir="${build.classes.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="**">
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="ejbjar" depends="compile">
+ <jar jarfile="build/tutorial.jar">
+ <fileset dir="${build.classes.dir}">
+ <include name="**/*.class"/>
+ </fileset>
+ <fileset dir=".">
+ <include name="custom-ejb3-interceptors-aop.xml"/>
+ </fileset>
+ </jar>
+ <ear earfile="build/tutorial.ear" appxml="application.xml">
+ <zipfileset dir="build">
+ <include name="tutorial.jar"/>
+ </zipfileset>
+ <zipfileset dir="${thirdparty.lib.dir}" prefix="lib">
+ <include name="*.jar"/>
+ </zipfileset>
+ </ear>
+ <copy file="thirdparty-jms-service.xml" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+ <sleep seconds="5"/>
+ <copy file="build/tutorial.ear" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+ </target>
+
+ <target name="run" depends="ejbjar">
+ <java classname="org.jboss.tutorial.thirdpartyjms.client.Client" dir=".">
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Cleans up generated stuff -->
+ <!-- =================================================================== -->
+ <target name="clean.db">
+ <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ <delete file="${jboss.home}/server/${jboss.server.config}/deploy/tutorial.ear"/>
+ <delete file="${jboss.home}/server/${jboss.server.config}/deploy/thirdparty-jms-service.xml"/>
+ </target>
+
+
+</project>
+
Added: trunk/ejb3/docs/tutorial/third_party_jms/jndi.properties
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/jndi.properties (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/jndi.properties 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=localhost
Added: trunk/ejb3/docs/tutorial/third_party_jms/log4j.xml
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/log4j.xml (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/log4j.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 60233 2007-02-03 10:13:23Z wolfc $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Messagen -->
+ <!--
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ -->
+ <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) -%m%n"/>
+ </layout>
+</appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/bean/ExampleMDB.java
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/bean/ExampleMDB.java (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/bean/ExampleMDB.java 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.thirdpartyjms.bean;
+
+import javax.ejb.MessageDriven;
+import javax.ejb.ActivationConfigProperty;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+ at MessageDriven(activationConfig =
+ {
+ @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName="destination", propertyValue="queue1"),
+ @ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="java:ThirdPartyJmsProvider"),
+ @ActivationConfigProperty(propertyName="dLQJNDIName", propertyValue="queue2")
+ })
+public class ExampleMDB implements MessageListener
+{
+ public void onMessage(Message recvMsg)
+ {
+ System.out.println("----------------");
+ System.out.println("Received message");
+ System.out.println("----------------");
+ }
+
+}
Added: trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/client/Client.java
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/client/Client.java (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/src/org/jboss/tutorial/thirdpartyjms/client/Client.java 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.thirdpartyjms.client;
+
+import javax.jms.Destination;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingEnumeration;
+
+import java.util.Hashtable;
+
+public class Client
+{
+ public static void main(String[] args) throws Exception
+ {
+ processMessage();
+ }
+
+ private static void processMessage() throws Exception
+ {
+ Hashtable properties = new Hashtable();
+ properties.put(Context.INITIAL_CONTEXT_FACTORY,
+ "org.exolab.jms.jndi.InitialContextFactory");
+ properties.put(Context.PROVIDER_URL, "tcp://localhost:3035/");
+ InitialContext jndiContext = new InitialContext(properties);
+
+ ConnectionFactory factory = (ConnectionFactory) jndiContext.lookup("ConnectionFactory");
+ Connection connection = factory.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Destination queue = (Destination) jndiContext.lookup("queue1");
+
+ MessageProducer sender = session.createProducer(queue);
+
+ TextMessage msg = session.createTextMessage("Hello World");
+
+ sender.send(msg);
+ System.out.println("Message sent successfully to remote third party queue ");
+
+ }
+}
Added: trunk/ejb3/docs/tutorial/third_party_jms/thirdparty-jms-service.xml
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/thirdparty-jms-service.xml (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/thirdparty-jms-service.xml 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
+ name=":service=JMSProviderLoader,name=ThirdPartyJmsProvider">
+ <attribute name="ProviderName">ThirdPartyJmsProvider</attribute>
+ <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
+ <attribute name="QueueFactoryRef">JmsQueueConnectionFactory</attribute>
+ <attribute name="TopicFactoryRef">JmsTopicConnectionFactory</attribute>
+ <attribute name="Properties">
+ java.naming.factory.initial=org.exolab.jms.jndi.InitialContextFactory
+ java.naming.provider.url=tcp://localhost:3035
+ </attribute>
+ </mbean>
+ </server>
\ No newline at end of file
Added: trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.html
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.html (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.html 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,81 @@
+<html>
+<body>
+<p>
+<h2>Third Party JMS Provider Integration</h2>
+
+</p><p>
+This tutorial describes how to integrate third party JMS providers into JBoss and EJB3 Message Driven
+Beans. This tutorial is based on integration with OpenJMS, but applies to any third party JMS provider.
+OpenJMS is not included as part of this tutorial. In order to run the example, you will need to download,
+install, and start OpenJMS. You will also need to copy the appropriate jars into the <tt>thirdparty</tt>
+directory.
+</p><p>
+<h3>The JMS Resource Adaptor</h3>
+
+</p><p>
+There are two mechanisms you can use to integrate the third party provider. MDBs in JBoss EJB3
+are based on JMS JCA resource adaptors. The adaptors handle the integration with the JMS provider
+as well as handling transactions, thread pooling, etc.
+</p><p>
+The first and often the preferred mechanism is to use a JMS JCA resource adaptor provided by the
+third party vendor. Some vendors supply resource adaptors, others do not. If this is the chosen approach,
+you need to annotate your MDB with @org.jboss.annotation.ejb.ResourceAdaptor("thirdparty.rar") and then
+add the @ActivationConfigProperty annotations with the properties described by the third party vendor
+and supported by their resource adaptor.
+</p><p>
+The second mechanism uses the JBoss JMS JCA resource adaptor and is described in detail here.
+</p><p>
+<h3> The Third Party Provider</h3>
+
+</p><p>
+Take a look at <a href="thirdparty-jms-service.xml">thirdparty-jms-service.xml</a>. This file describes the service
+that defines how to communicate with the third party provider. You typically define:
+<pre>
+ProviderName - the JNDI binding (in JBoss JNDI) of the provider, which is referenced by the MDB
+ProviderAdapterClass - the JBoss class used to implement the provider adaptor
+QueueFactoryRef - the JNDI binding (in third party JNDI) of the third party QueueConnectionFactory
+TopicFactoryRef - the JNDI binding (in third party JNDI) of the third partt TopicConnectionFactory
+Properties - the JNDI properties used to access the third party JNDI service
+</pre>
+</p><p>
+<h3> The MDB</h3>
+
+</p><p>
+Take a look at <a href="src/org/jboss/tutorial/thirdpartyjms/bean/ExampleMDB">ExampleMDB.java</a>. Note there is
+no @ResourceAdaptor annotation as by default MDBs are configured to use the JBoss JMS JCA resource
+adaptor. Also, note that we have defined the <tt>providerAdapterJNDI</tt> property to be the name we defined
+in <a href="thirdparty-jms-service.xml">thirdparty-jms-service.xml</a>. The <tt>destination</tt> and <tt>dLQJNDIName</tt>
+properties are the JNDI bindings of the queues in the third party JNDI service.
+</p><p>
+<h4>Building and Running</h4>
+
+To build and run the example, make sure you have <tt>ejb3.deployer</tt> installed in JBoss 4.x and have JBoss running. See the reference manual on how to install EJB 3.0.
+<pre>
+Unix: $ export JBOSS_HOME=<where your jboss 4.x distribution is>
+Windows: $ set JBOSS_HOME=<where your jboss 4.x distribution is>
+$ ant
+$ ant run
+
+</pre>
+</p><p>
+Look at the client window to determine that the message was sent.
+</p><p>
+<pre>
+run:
+ [java] Message sent successfully to remote third party queue
+</pre>
+</p><p>
+Look in the console window to determine that the messages was received.
+</p><p>
+<pre>
+16:08:08,233 INFO [STDOUT] ----------------
+16:08:08,233 INFO [STDOUT] Received message
+16:08:08,233 INFO [STDOUT] ----------------
+</pre>
+</p><p>
+</p><p>
+</p><p>
+</p><p>
+</p>
+</body>
+</html>
Added: trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.wiki
===================================================================
--- trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.wiki (rev 0)
+++ trunk/ejb3/docs/tutorial/third_party_jms/thirdpartyjms.wiki 2007-07-20 18:15:16 UTC (rev 64166)
@@ -0,0 +1,70 @@
+!!!Third Party JMS Provider Integration
+
+This tutorial describes how to integrate third party JMS providers into JBoss and EJB3 Message Driven
+Beans. This tutorial is based on integration with OpenJMS, but applies to any third party JMS provider.
+OpenJMS is not included as part of this tutorial. In order to run the example, you will need to download,
+install, and start OpenJMS. You will also need to copy the appropriate jars into the {{thirdparty}}
+directory.
+
+!!The JMS Resource Adaptor
+
+There are two mechanisms you can use to integrate the third party provider. MDBs in JBoss EJB3
+are based on JMS JCA resource adaptors. The adaptors handle the integration with the JMS provider
+as well as handling transactions, thread pooling, etc.
+
+The first and often the preferred mechanism is to use a JMS JCA resource adaptor provided by the
+third party vendor. Some vendors supply resource adaptors, others do not. If this is the chosen approach,
+you need to annotate your MDB with @org.jboss.annotation.ejb.ResourceAdaptor("thirdparty.rar") and then
+add the @ActivationConfigProperty annotations with the properties described by the third party vendor
+and supported by their resource adaptor.
+
+The second mechanism uses the JBoss JMS JCA resource adaptor and is described in detail here.
+
+!! The Third Party Provider
+
+Take a look at [thirdparty-jms-service.xml|thirdparty-jms-service.xml]. This file describes the service
+that defines how to communicate with the third party provider. You typically define:
+{{{
+ProviderName - the JNDI binding (in JBoss JNDI) of the provider, which is referenced by the MDB
+ProviderAdapterClass - the JBoss class used to implement the provider adaptor
+QueueFactoryRef - the JNDI binding (in third party JNDI) of the third party QueueConnectionFactory
+TopicFactoryRef - the JNDI binding (in third party JNDI) of the third partt TopicConnectionFactory
+Properties - the JNDI properties used to access the third party JNDI service
+}}}
+
+!! The MDB
+
+Take a look at [ExampleMDB.java|src/org/jboss/tutorial/thirdpartyjms/bean/ExampleMDB]. Note there is
+no @ResourceAdaptor annotation as by default MDBs are configured to use the JBoss JMS JCA resource
+adaptor. Also, note that we have defined the {{providerAdapterJNDI}} property to be the name we defined
+in [thirdparty-jms-service.xml|thirdparty-jms-service.xml]. The {{destination}} and {{dLQJNDIName}}
+properties are the JNDI bindings of the queues in the third party JNDI service.
+
+!Building and Running
+To build and run the example, make sure you have {{ejb3.deployer}} installed in JBoss 4.x and have JBoss running. See the reference manual on how to install EJB 3.0.
+{{{
+Unix: $ export JBOSS_HOME=<where your jboss 4.x distribution is>
+Windows: $ set JBOSS_HOME=<where your jboss 4.x distribution is>
+$ ant
+$ ant run
+
+}}}
+
+Look at the client window to determine that the message was sent.
+
+{{{
+run:
+ [java] Message sent successfully to remote third party queue
+}}}
+
+Look in the console window to determine that the messages was received.
+
+{{{
+16:08:08,233 INFO [STDOUT] ----------------
+16:08:08,233 INFO [STDOUT] Received message
+16:08:08,233 INFO [STDOUT] ----------------
+}}}
+
+
+
+
More information about the jboss-cvs-commits
mailing list