You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2008/09/17 12:07:28 UTC
svn commit: r696227 [2/2] - in /cxf/trunk:
distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch-wsdl/
distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch-wsdl/etc/
distribution/src/main/release/samples/integ...
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocal.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocal.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocal.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocal.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.ejb;
+
+import javax.ejb.EJBLocalObject;
+import org.apache.hello_world_soap_http.Greeter;
+
+public interface GreeterLocal extends EJBLocalObject, Greeter {
+}
+
+
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocal.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocalHome.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocalHome.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocalHome.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocalHome.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.ejb;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBLocalHome;
+
+public interface GreeterLocalHome extends EJBLocalHome {
+ GreeterLocal create() throws CreateException;
+}
+
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocalHome.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterLocalHome.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterRemote.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterRemote.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterRemote.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterRemote.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.ejb;
+
+import java.rmi.RemoteException;
+import javax.ejb.EJBObject;
+
+public interface GreeterRemote extends EJBObject {
+
+ String sayHi() throws RemoteException;
+
+ String greetMe(String user) throws RemoteException;
+
+}
+
+
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterRemote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/demo/ejb/GreeterRemote.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/org/apache/hello_world_soap_http/Greeter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/org/apache/hello_world_soap_http/Greeter.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/org/apache/hello_world_soap_http/Greeter.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/org/apache/hello_world_soap_http/Greeter.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hello_world_soap_http;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public interface Greeter {
+
+ @WebMethod
+ String sayHi();
+
+ @WebMethod
+ String greetMe(String user);
+}
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/org/apache/hello_world_soap_http/Greeter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb-dispatch/src/org/apache/hello_world_soap_http/Greeter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/README.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/README.txt?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/README.txt (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/README.txt Wed Sep 17 03:07:25 2008
@@ -0,0 +1,253 @@
+CXF INBOUND RESOURCE ADAPTER MESSAGE DRIVEN BEAN SAMPLE
+=======================================================
+
+Introduction to the inbound-mdb* Samples
+----------------------------------------
+
+This is one of three new inbound resource adapter samples (inbound-mdb,
+inbound-mdb-dispatch, and inbound-mdb-dispatch-wsdl).
+Please read all of them before you decide which is best suit for your
+scenario. This series of inbound adapter samples leverages the JCA
+Specification Version 1.5 and Message Driven Bean in EJB 2.1 to activate
+CXF service endpoint facade inside the application server. For more inform-
+ation about the JCA message inflow model, please refer to chapter 12
+(Message Inflow) of the JCA Specification 1.5.
+
+The JCA Specification 1.5 defines a framework that allows a resource adapter
+to be notified when a Message Driven Bean (MDB) is started. The resource
+adapter can activate some services (in our case, CXF service endpoint
+facade) to enable inbound communication from an Enterprise Information System
+(EIS). In order for the resource adapter to get notified, the deployment
+descriptors of the MDB (ejb-jar.xml) and the resource adapter (ra.xml) must
+define the same interface for messaging-type and messagelistener-type,
+respectively.
+
+Once the service endpoint facade is activated, the service facade can
+receive client requests and then invoke the MDB's message listener interface,
+which is defined in the "messaging-type" of the deployement descriptor
+(ejb-jar.xml).
+
+When the MDB is stopped, the resource adapter will be notified. So, the
+CXF service endpoint facade will stop as well.
+
+Notice that the resource adapter in this sample does not use the
+activation mechanism used by the old "inbound" sample. There is no "ant
+activate" task and the ejb_servants.properties file is ignored by the new
+inbound resource adapter. It is not recommended to use the old and new
+activation mechanism together in the same application server. It is
+important to note that the old activation mechanism does not support IBM
+WebSphere 6.1 server.
+
+Detailed steps to deploy and run the sample in WebSphere 6.1 are provided
+in this README file. These samples can be run in other JCA 1.5 and EJB 3.0
+compliant application servers as well. The ejb-jar.xml needs to be slightly
+modified in order to run in EJB 2.1 compliant application server.
+
+Notice that each inbound-mdb* sample has its own ra.xml and ejb-jar.xml in
+its etc directory. The ra.xml only contains inbound-resourceadapter
+(no outbound-resourceadapter) for clarity. It is perfectly fine to have
+both inbound and outbound resource adapter defined in ra.xml.
+
+The following activation config properties are supported. They can be put
+in the ejb-jar.xml, activation spec, and ra.xml. Values specified in the
+activation spec can override the ones in ra.xml. And, the ejb-jar.xml takes
+precedence over the activation spec. These are all String values. Location
+values are relative to the ejb jar.
+
+
+The following properties apply when org.apache.cxf.jca.inbound.MDBActivationSpec
+is specified.
+
+wsdlLocation: WSDL location
+schemaLocations: Comma separated schema locations
+serviceInterfaceClass: Service endpoint interface classname
+busConfigLocation: CXF bus config location
+address: Transport address
+endpointName: PortType QName in WSDL
+serviceName: Service Name QName in WSDL
+displayName: Name used for logging and as key in a map of endpoints.
+
+When org.apache.cxf.jca.inbound.DispatchMDBActivationSpec is specified,
+the following also applies.
+
+targetBeanJndiName: JNDI name of the target session bean
+
+Prerequisite
+------------
+
+For IBM WebSphere 6.1, you need to copy <CXF_HOME>/lib/wsdl4j-1.6.2.jar to
+<WAS_HOME>/AppServer/java/jre/lib/endorsed. If the "endorsed" directory does
+not exist, create a new one. You need to restart the WebSphere 6.1 server.
+
+If your environment already includes cxf-manifest.jar on the
+CLASSPATH, and the JDK and ant bin directories on the PATH
+it is not necessary to set the environment as described in
+the samples directory README. If your environment is not
+properly configured, or if you are planning on using wsdl2java,
+javac, and java to build and run the samples, you must set the
+environment.
+
+< End of Introduction to the inbound-mdb* Samples >
+
+
+Simple MDB Invocation
+---------------------
+
+This sample shows a simple MDB invocation by the CXF service
+endpoint facade. The service implementation is contained in the MDB.
+This is the most straightward approach and does not involve any dispatching.
+It should be faster then the other inbound-mdb* samples. Another
+advantage is that since this approach only requires a MDB (no Session Bean),
+it does not require any EJB Home, Local or Remote interfaces.
+
+
+The downside is that the service endpoint interface must be exposed as the
+messagelistener-type element in the deployment descriptors of the resource
+adapter. So, you will have to edit the ra.xml to add a new
+MDB that is exposed as a Web Service by the CXF resource adapter.
+
+As you can see in etc/ra.xml file, the activation spec specified is
+org.apache.cxf.jca.inbound.MDBActivationSpec as it is not doing any
+dispatching.
+
+This sample does not contain a WSDL. CXF will use the service endpoint
+interface (Greeter) to build a service model as it is defined in the
+serviceInterfaceClass property in the etc/ejb-jar.xml.
+
+
+Building and running the sample using Ant
+-----------------------------------------
+From the base directory of this sample (i.e., where this README file is
+located), the Ant build.xml file can be used to build and run the sample.
+
+
+Build CXF J2C RAR file
+----------------------
+ (Unix) % ant generate.rar
+ (Windows) > ant generate.rar
+
+The result RAR file is located in build/lib/cxf.rar
+
+Launch the application server
+-----------------------------
+
+The sample requires an application server (IBM WebSphere 6.1). Make sure
+you have a running instance of an application server.
+
+Deploy the CXF JCA Connector
+-----------------------------
+
+The CXF JCA Connector must be deployed to the application server before
+running the sample. The JCA Connector used in this sample has a unique
+deployment descriptor (ra.xml) to demonstrate the direct invocation of
+service implementation resides in the Message Driven Bean. Therefore, the
+JCA Connector in this sample cannot be used by other JCA samples. Please
+make sure there is no other CXF JCA Connector deployed into the application
+server.
+
+Please consult your vendor documentation on Resource Adapter deployment.
+Here are basic instructions to deploy the CXF JCA connector in WebSphere 6.1.
+
+1. Logon to WebSphere Integrated Solution Console. The default address is:
+
+ http://<hostname>:9060/ibm/console/login.do
+
+2. Navigate to tree menu: Resources -> Resource adapters -> Resource adapters
+
+3. On the Resource adapters page, click the "Install RAR" button.
+
+4. On the Install RAR File page, select the "Local path" radio button if this
+ sample is located in the same machine as the WebSphere server. Otherwise,
+ select the "Server path" radio button. Specify or browse to the path
+ build/lib/cxf.rar file of this sample. Then, click the "Next" button.
+
+5. On the next page, click the "OK" button to install the Resource Adapter.
+
+6. On the next page, click the "CXF JCA Connector" link to edit the Resource
+ Adatper.
+
+7. On the "Configuration" page, click the "J2C activation specification"
+ link.
+
+8. On the next page, click the "New" button to create a new Activation
+ Specification.
+
+9. On the next page, enter "MyActivationSpec" in the Name textbox and click
+ the "OK" button.
+
+ Notice that the JNDI name is optional. If it is omitted, a JNDI name
+ is created for you as eis/<ActivationSpecName> where <ActivationSpecName>
+ is "MyActivationSpec" above.
+
+10. Finally, click the "Save" link to commit the configuration.
+
+ Notice that you can specify activation config values in the new
+ activation spec you just created. The activation spec will be associated
+ to your MDB later. The MDB's deployment descriptor can define activation
+ config values to override the values specified in the associated activation
+ spec.
+
+
+Building Message Driven Bean Jar
+--------------------------------
+
+Issue the command:
+
+ (Unix) % ant
+ (Windows) > ant
+
+
+Deploying the Message Drive Bean
+--------------------------------
+
+Please consult your vendor documentation on EJB deployment. Here are
+basic instructions to deploy the MDB in WebSphere 6.1.
+
+1. Logon to WebSphere Integrated Solution Console. The default address is:
+
+ http://<hostname>:9060/ibm/console/login.do
+
+2. Navigate to tree menu: Applications -> Install new Applications
+
+3. On the "Preparing for the application installation" page, select the "Local
+ path" radio button if this sample is located in the same machine as the
+ WebSphere server. Otherwise, select the "Server path" radio button.
+ Specify or browse to the path j2ee-archives/greeterejb.jar file in this
+ sample. Then, click the "Next" button.
+
+4. Click the "Next" button on the "Step 1: Select installation options" page.
+
+5. Click the "Next" button on the "Step 2: Map modules to servers" page.
+
+6. On the "Step 3: Bind listeners for message-driven beans" page, click the
+ "Activation Specification" radio button on the far right column. Specify
+ the Target Resource JNDI Name as below and the client the "Next" button.
+
+ eis/MyActivationSpec
+
+7. On the "Step 4: Summary" page, click the "Finish" button.
+
+8. Finally, click the "Save" link to commit the configuration.
+
+9. Navigate to tree menu: Applications -> Enterprise Applications
+
+10. Select the box next to "greeterejb_jar" and click the "Start" button at
+ the top to start the MDB.
+
+
+Running the Demo
+----------------
+
+Once the resource adapter and the EJB application have been deployed,
+the client can be run with the ant build script:
+
+ ant client
+
+This will launch an CXF Java Client which contacts the web service
+endpoint facade. The facade then invokes the Greeter interface that is
+implemented by the MDB. The output from the MDB is returned to the client.
+
+The following output is observed from the client.
+
+client:
+ [java] server return: Hi CXF from an EJB
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/README.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/build.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/build.xml?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/build.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/build.xml Wed Sep 17 03:07:25 2008
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<project name="Inbound Connection Demo" default="build" basedir=".">
+ <property environment="env"/>
+
+ <property environment="env"/>
+ <condition property="cxf.home" value="${env.CXF_HOME}">
+ <isset property="env.CXF_HOME"/>
+ </condition>
+
+ <fail message="this sample need to use CXF_HOME enviroment, please setup CXF_HOME in your environment" unless="cxf.home"/>
+
+ <property name="j2ee.resources.dir" location="${basedir}/../common/resources"/>
+ <property name="build.archives" value="${basedir}/j2ee-archives"/>
+ <property name="ejb.xml" location="./etc/ejb.xml"/>
+ <property name="j2ee.archives" value="j2ee-archives"/>
+ <property name="demos.current.dir" value="."/>
+ <property name="build.classes.dir" value="${basedir}/build"/>
+
+ <import file="../../../common_build.xml"/>
+
+
+ <path id="other.classpath">
+ <fileset dir="${cxf.home}/modules/integration" >
+ <include name="cxf-integration-jca-*.jar"/>
+ </fileset>
+ <pathelement location="${basedir}/../common/lib/geronimo-ejb_3.0_spec-1.0.1.jar"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="${build.classes.dir}/cxf-rar/META-INF"/>
+ <mkdir dir="${build.classes.dir}/lib"/>
+ <mkdir dir="${j2ee.archives}"/>
+ </target>
+
+ <target name="generate.rar" depends="init">
+ <copy file="${basedir}/etc/ra.xml" todir="${build.classes.dir}/cxf-rar/META-INF"/>
+ <copy todir="${build.classes.dir}/cxf-rar">
+ <fileset dir="${cxf.home}/lib">
+ <include name="*.jar"/>
+ <exclude name="cxf*.jar"/>
+ </fileset>
+ <fileset dir="${cxf.home}/modules">
+ <include name="*.jar"/>
+ <exclude name="*manifest*.jar"/>
+ </fileset>
+ <fileset dir="${cxf.home}/modules/integration">
+ <include name="*.jar"/>
+ <exclude name="*-jbi-*.jar"/>
+ </fileset>
+ </copy>
+ <jar destfile="${build.classes.dir}/lib/cxf.rar"
+ basedir="${build.classes.dir}/cxf-rar"/>
+ </target>
+
+ <target name="build" description="compile the code" depends="init,j2ee.compile,build.ejb.jar"/>
+
+ <target name="j2ee.compile">
+ <javac srcdir="${basedir}/src" destdir="${build.classes.dir}" debug="true" fork="yes">
+ <include name="**/*.java"/>
+ <classpath>
+ <pathelement location="${cxf.home}/modules/cxf-manifest.jar"/>
+ <pathelement location="${build.classes.dir}"/>
+ <path refid="cxf.classpath"/>
+ <path refid="other.classpath"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ <delete dir="${basedir}/j2ee-archives"/>
+ </target>
+
+ <target name="build.ejb.jar">
+ <jar destfile="${j2ee.archives}/greeterejb.jar">
+ <metainf dir="./etc">
+ <include name="*ejb*.xml"/>
+ </metainf>
+ <fileset dir="${build.classes.dir}/" includes="org/**/*.class"/>
+ <fileset dir="${build.classes.dir}">
+ <include name="**/ejb/*.class"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="client" description="run the client side demo " >
+ <java classname="demo.client.GreeterClient" fork="true">
+ <sysproperty key="java.util.logging.config.file" value="${cxf.home}/etc/logging.properties"/>
+ <arg value="${wsdl.location}"/>
+ <classpath>
+ <pathelement location="${build.classes.dir}"/>
+ <path refid="cxf.classpath"/>
+ </classpath>
+ </java>
+ </target>
+</project>
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/build.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ejb-jar.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ejb-jar.xml?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ejb-jar.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ejb-jar.xml Wed Sep 17 03:07:25 2008
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or
+ more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding
+ copyright ownership. The ASF licenses this file to you under the
+ Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain
+ a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+ -->
+<ejb-jar>
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>Greeter MDB</ejb-name>
+ <ejb-class>demo.ejb.GreeterBean</ejb-class>
+ <messaging-type>
+ org.apache.hello_world_soap_http.Greeter
+ </messaging-type>
+ <transaction-type>Bean</transaction-type>
+ <activation-config>
+
+ <!-- displayName -->
+ <activation-config-property>
+ <activation-config-property-name>
+ displayName
+ </activation-config-property-name>
+ <activation-config-property-value>
+ MyCxfEndpoint
+ </activation-config-property-value>
+ </activation-config-property>
+
+ <!-- service endpoint interface -->
+ <activation-config-property>
+ <activation-config-property-name>
+ serviceInterfaceClass
+ </activation-config-property-name>
+ <activation-config-property-value>
+ org.apache.hello_world_soap_http.Greeter
+ </activation-config-property-value>
+ </activation-config-property>
+
+ <!-- address -->
+ <activation-config-property>
+ <activation-config-property-name>
+ address
+ </activation-config-property-name>
+ <activation-config-property-value>
+ http://localhost:9999/GreeterBean
+ </activation-config-property-value>
+ </activation-config-property>
+
+ </activation-config>
+ </message-driven>
+ </enterprise-beans>
+
+ <assembly-descriptor>
+ <method-permission>
+ <unchecked/>
+ <method>
+ <ejb-name>GreeterBean</ejb-name>
+ <method-name>*</method-name>
+ </method>
+ </method-permission>
+ <container-transaction>
+ <description/>
+ <method>
+ <description/>
+ <ejb-name>GreeterBean</ejb-name>
+ <method-name>*</method-name>
+ </method>
+ <trans-attribute>Supports</trans-attribute>
+ </container-transaction>
+ </assembly-descriptor>
+</ejb-jar>
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ejb-jar.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ejb-jar.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ejb-jar.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ra.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ra.xml?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ra.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ra.xml Wed Sep 17 03:07:25 2008
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or
+ more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding
+ copyright ownership. The ASF licenses this file to you under the
+ Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain
+ a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+ -->
+<connector xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+http://java/sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+ <display-name>CXF JCA Connector</display-name>
+ <vendor-name>Apache CXF</vendor-name>
+ <eis-type>CXF</eis-type>
+ <resourceadapter-version>2.0</resourceadapter-version>
+ <license>
+ <license-required>false</license-required>
+ </license>
+ <resourceadapter>
+ <resourceadapter-class> org.apache.cxf.jca.cxf.ResourceAdapterImpl
+ </resourceadapter-class>
+ <inbound-resourceadapter>
+ <messageadapter>
+ <messagelistener>
+ <messagelistener-type>
+ org.apache.hello_world_soap_http.Greeter
+ </messagelistener-type>
+ <activationspec>
+ <activationspec-class>
+ org.apache.cxf.jca.inbound.MDBActivationSpec
+ </activationspec-class>
+ <required-config-property>
+ <config-property-name>displayName
+ </config-property-name>
+ </required-config-property>
+ </activationspec>
+ </messagelistener>
+ </messageadapter>
+ </inbound-resourceadapter>
+ </resourceadapter>
+</connector>
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ra.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ra.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/etc/ra.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/client/GreeterClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/client/GreeterClient.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/client/GreeterClient.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/client/GreeterClient.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.client;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import javax.xml.namespace.QName;
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.jaxws.ServiceImpl;
+
+/**
+ * validate call to ejb in jboss from command line
+ */
+public final class GreeterClient {
+
+ protected GreeterClient() {
+ }
+
+ public static void main(String[] args) throws Exception {
+ Bus bus = new SpringBusFactory().getDefaultBus();
+ QName serviceQName = new QName("http://apache.org/hello_world_soap_http", "Greeter");
+ QName portQName = new QName("http://apache.org/hello_world_soap_http", "HelloPort");
+ String bindingId = "http://schemas.xmlsoap.org/soap/";
+
+ String hostName = "";
+ try {
+ InetAddress addr = InetAddress.getLocalHost();
+ hostName = addr.getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+
+ String address = "http://" + hostName + ":9999/GreeterBean";
+
+ ServiceImpl ss = new ServiceImpl(bus, null, serviceQName, null);
+ ss.addPort(portQName, bindingId, address);
+ org.apache.hello_world_soap_http.Greeter port = ss.getPort(portQName,
+ org.apache.hello_world_soap_http.Greeter.class);
+ String response = port.greetMe(" CXF");
+ System.out.println(" server return: " + response);
+ }
+}
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/client/GreeterClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/client/GreeterClient.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/ejb/GreeterBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/ejb/GreeterBean.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/ejb/GreeterBean.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/ejb/GreeterBean.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.ejb;
+
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+
+import org.apache.hello_world_soap_http.Greeter;
+
+public class GreeterBean implements MessageDrivenBean, Greeter {
+
+ public String sayHi() {
+ System.out.println("sayHi called ");
+ return "Hi there!";
+ }
+
+ public String greetMe(String user) {
+ System.out.println("greetMe called user = " + user);
+ return "Hello " + user;
+ }
+
+ //---------------- EJB Methods
+ public void ejbCreate() {
+ }
+
+ public void ejbRemove() {
+ }
+
+ public void setMessageDrivenContext(MessageDrivenContext mdc) {
+ }
+
+}
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/ejb/GreeterBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/demo/ejb/GreeterBean.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/org/apache/hello_world_soap_http/Greeter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/org/apache/hello_world_soap_http/Greeter.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/org/apache/hello_world_soap_http/Greeter.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/org/apache/hello_world_soap_http/Greeter.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hello_world_soap_http;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public interface Greeter {
+
+ @WebMethod
+ String sayHi();
+
+ @WebMethod
+ String greetMe(String user);
+}
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/org/apache/hello_world_soap_http/Greeter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound-mdb/src/org/apache/hello_world_soap_http/Greeter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound/README.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound/README.txt?rev=696227&r1=696226&r2=696227&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound/README.txt (original)
+++ cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound/README.txt Wed Sep 17 03:07:25 2008
@@ -5,6 +5,12 @@
This demo shows how to expose an Enterprise Java Bean over
SOAP/HTTP using CXF. This demo is based on JBoss4.0.5GA.
+Notice that a new CXF inbound resource adapter has been
+introduced. Please read "Introduction to the inbound-mdb*
+Samples" section in the inbound-mdb/README.txt. It contains
+important information.
+
+
Running the Demo
================
Modified: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java?rev=696227&r1=696226&r2=696227&view=diff
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java (original)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java Wed Sep 17 03:07:25 2008
@@ -18,11 +18,13 @@
*/
package org.apache.cxf.jca.cxf;
-
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
import java.util.logging.Logger;
import javax.resource.NotSupportedException;
@@ -32,18 +34,24 @@
import javax.resource.spi.ResourceAdapter;
import javax.resource.spi.ResourceAdapterInternalException;
import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.resource.spi.work.Work;
import javax.transaction.xa.XAResource;
import org.apache.cxf.Bus;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.jca.core.resourceadapter.ResourceBean;
+import org.apache.cxf.jca.inbound.InboundEndpoint;
+import org.apache.cxf.jca.inbound.MDBActivationSpec;
+import org.apache.cxf.jca.inbound.MDBActivationWork;
+
public class ResourceAdapterImpl extends ResourceBean implements ResourceAdapter {
private static final Logger LOG = LogUtils.getL7dLogger(ResourceAdapterImpl.class);
private BootstrapContext ctx;
private Set <Bus> busCache = new HashSet<Bus>();
-
+ private Map<String, InboundEndpoint> endpoints = new ConcurrentHashMap<String, InboundEndpoint>();
+
public ResourceAdapterImpl() {
super();
}
@@ -83,6 +91,16 @@
bus.shutdown(true);
}
}
+
+ // shutdown all the inbound endpoints
+ for (Map.Entry<String, InboundEndpoint> entry : endpoints.entrySet()) {
+ try {
+ entry.getValue().shutdown();
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Failed to stop endpoint " + entry.getKey(), e);
+ }
+ }
+ endpoints.clear();
}
public XAResource[] getXAResources(ActivationSpec as[])
@@ -92,10 +110,39 @@
public void endpointActivation(MessageEndpointFactory mef, ActivationSpec as)
throws ResourceException {
- throw new NotSupportedException();
+
+ if (!(as instanceof MDBActivationSpec)) {
+ LOG.fine("Ignored unknown activation spec " + as);
+ return;
+ }
+
+ MDBActivationSpec spec = (MDBActivationSpec)as;
+ LOG.info("CXF resource adapter is activating " + spec.getDisplayName());
+
+ Work work = new MDBActivationWork(spec, mef, endpoints);
+ ctx.getWorkManager().scheduleWork(work);
+
}
public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec as) {
+
+ if (!(as instanceof MDBActivationSpec)) {
+ LOG.fine("Ignored unknown activation spec " + as);
+ return;
+ }
+
+ MDBActivationSpec spec = (MDBActivationSpec)as;
+ LOG.info("CXF resource adapter is deactivating " + spec.getDisplayName());
+
+ InboundEndpoint endpoint = endpoints.remove(spec.getDisplayName());
+ if (endpoint != null) {
+ try {
+ endpoint.shutdown();
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Failed to stop endpoint "
+ + spec.getDisplayName(), e);
+ }
+ }
}
public BootstrapContext getBootstrapContext() {
@@ -118,3 +165,4 @@
+
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBActivationSpec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBActivationSpec.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBActivationSpec.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBActivationSpec.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+/**
+ *
+ * DispatchMDBActivationSpec is an {@link javax.resource.spi.ActivationSpec}
+ * that activates a CXF service endpoint facade to dispatch call to the target
+ * Stateless Session Bean.
+ *
+ */
+public class DispatchMDBActivationSpec extends MDBActivationSpec {
+
+ private String targetBeanJndiName;
+
+ /**
+ * @param targetBeanJndiName
+ */
+ public void setTargetBeanJndiName(String targetBeanJndiName) {
+ this.targetBeanJndiName = targetBeanJndiName;
+ }
+
+ /**
+ * @return the targetBeanJndiName
+ */
+ public String getTargetBeanJndiName() {
+ return targetBeanJndiName;
+ }
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBActivationSpec.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBActivationSpec.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.resource.spi.endpoint.MessageEndpoint;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Exchange;
+
+/**
+ * DispatchMDBInvoker is executed in the context of a Message Driven Bean
+ * that dispatches calls to the target Session Bean where the service logic is
+ * implemented. The target must be a Stateless Session Bean. Since
+ * DispatchMDBInvoker makes EJB local invocation to the target bean, the
+ * Message Driven Bean must be configured to include a local reference to
+ * the target bean in the deployment descriptor. The advantage of using
+ * DispatchMDBInvoker is that no modification to the resource adapter's
+ * deployment descriptor (ra.xml) is required to add or remove inbound endpoints.
+ */
+public class DispatchMDBInvoker extends MDBInvoker {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(DispatchMDBInvoker.class);
+
+ private String targetJndiName;
+
+ /**
+ * @param messageEndpoint
+ */
+ public DispatchMDBInvoker(MessageEndpoint messageEndpoint, String targetJndiName) {
+ super(messageEndpoint);
+ this.targetJndiName = targetJndiName;
+ }
+
+ @Override
+ public Object getServiceObject(Exchange context) {
+ Object target = null;
+ try {
+ target = ((DispatchMDBMessageListener)getMessageEndpoint())
+ .lookupTargetObject(targetJndiName);
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to obtain service object " + targetJndiName, e);
+ return null;
+ }
+
+ return target;
+ }
+
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBInvoker.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListener.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListener.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListener.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+
+/**
+ * The DispatchMDBMessageListener is intended to be used as the
+ * <messagelistener-type> of an <inbound-resourcesadapter> in the resource
+ * adapter's deployment descriptor (ra.xml). The default implementation
+ * class is {@link DispatchMDBMessageListenerImpl}.
+ * The benefit of using DispatchMDBMessageListener is that users
+ * are not required to put the Service Endpoint Interface (SEI) in the resource
+ * adaptor's deployment descriptor. Thus, users can leave the <messagelistener-type>
+ * as org.apache.cxf.jca.inbound.DispatchMDBMessageListener for any their endpoints.
+ */
+public interface DispatchMDBMessageListener {
+
+ /**
+ * Looks up the target object by JNDI name.
+ *
+ * @param targetJndiName
+ * @return
+ */
+ Object lookupTargetObject(String targetJndiName) throws Exception;
+
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListener.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListenerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListenerImpl.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListenerImpl.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListenerImpl.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+import java.lang.reflect.Method;
+
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+import javax.naming.InitialContext;
+
+/**
+ * DispatchMDBMessageListenerImpl supports dispatching of calls to a
+ * Stateless Session Bean.
+ *
+ * DispatchMDBMessageListenerImpl is intended to be used as the <ejb-class> of
+ * the <message-driven> bean in the resource adaptor's deployment descriptor
+ * (ra.xml). When it is used, the <messaging-type> should be set to
+ * org.apache.cxf.jca.inbound.DispatchMDBMessageListener. Also, the resource
+ * adaptor's deployment descriptor should specify the same interface
+ * (org.apache.cxf.jca.inbound.DispatchMDBMessageListener) in the
+ * <messagelistener-type> in order to activate the inbound facade endpoint.
+ * Since the Message Driven Bean is used to activate the inbound
+ * endpoint facade by CXF JCA connector, all the required resources (such as,
+ * service endpoint interface class, WSDL, or bus configuration) should be put
+ * in the same jar with the Message Driven Bean.
+ */
+public class DispatchMDBMessageListenerImpl
+ implements MessageDrivenBean, DispatchMDBMessageListener {
+
+ private static final long serialVersionUID = -8428728265893081763L;
+
+ /**
+ * Looks up the target object by EJB local reference.
+ */
+ public Object lookupTargetObject(String targetJndiName) throws Exception {
+ Object home = new InitialContext().lookup(targetJndiName);
+ Method method = home.getClass().getMethod("create", new Class[0]);
+ return method.invoke(home, new Object[0]);
+ }
+
+ //---------------- EJB Methods
+
+ public void ejbCreate() {
+ }
+
+ public void ejbRemove() {
+ }
+
+ public void setMessageDrivenContext(MessageDrivenContext mdc) {
+ }
+
+
+
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListenerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/DispatchMDBMessageListenerImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/InboundEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/InboundEndpoint.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/InboundEndpoint.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/InboundEndpoint.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+
+import org.apache.cxf.endpoint.Server;
+
+/**
+ * An inbound endpoint is a CXF service endpoint facade exposed by
+ * the JCA connector. Its role is to accept service requests from
+ * ordinary CXF clients and forward them to an invoker (running in
+ * the context of the activating message driven bean). The invoker
+ * either contains the service implementation or dispatches the call
+ * to a Stateless Session Bean. This class holds objects that are
+ * needed to accomplish the task and provides a shutdown method to
+ * clean up the endpoint.
+ *
+ */
+public class InboundEndpoint {
+
+ private Server server;
+ private MDBInvoker invoker;
+
+ /**
+ * @param server the server object that has already been started
+ * @param invoker the invoker that invoker an EJB
+ */
+ InboundEndpoint(Server server, MDBInvoker invoker) {
+ this.server = server;
+ this.invoker = invoker;
+ }
+
+ /**
+ * @return the invoker
+ */
+ public MDBInvoker getInvoker() {
+ return invoker;
+ }
+
+ /**
+ * @return the server
+ */
+ public Server getServer() {
+ return server;
+ }
+
+
+ /**
+ * @param invoker the invoker to set
+ */
+ public void setInvoker(MDBInvoker invoker) {
+ this.invoker = invoker;
+ }
+
+
+ /**
+ * @param server the server to set
+ */
+ public void setServer(Server server) {
+ this.server = server;
+ }
+
+
+ /**
+ * Shuts down the endpoint
+ *
+ * @throws Exception
+ */
+ public void shutdown() throws Exception {
+ if (invoker != null) {
+ invoker.getMessageEndpoint().release();
+ invoker = null;
+ }
+
+ if (server != null) {
+ server.stop();
+ server = null;
+ }
+ }
+
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/InboundEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/InboundEndpoint.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationSpec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationSpec.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationSpec.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationSpec.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,197 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.InvalidPropertyException;
+import javax.resource.spi.ResourceAdapter;
+
+/**
+ * MDBActivationSpec is an {@link javax.resource.spi.ActivationSpec} that
+ * activates a CXF service endpoint facade. All resource locations are
+ * relative to the message driven bean jar.
+ *
+ */
+public class MDBActivationSpec implements ActivationSpec {
+
+ private ResourceAdapter resouceAdapter;
+ private String wsdlLocation;
+ private String schemaLocations;
+ private String serviceInterfaceClass;
+ private String busConfigLocation;
+ private String address;
+ private String endpointName;
+ private String serviceName;
+ private String displayName;
+
+ /**
+ * Gets the transport address used by
+ * {@link org.apache.cxf.frontend.ServerFactoryBean}.
+ *
+ * @return the address
+ */
+ public String getAddress() {
+ return address;
+ }
+
+ /**
+ * @return the busConfigLocation
+ */
+ public String getBusConfigLocation() {
+ return busConfigLocation;
+ }
+
+ /**
+ * @return the displayName
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ *
+ * @return the endpointName
+ */
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ public ResourceAdapter getResourceAdapter() {
+ return resouceAdapter;
+ }
+
+ /**
+ * Comma separated schema locations
+ *
+ * @return the schemaLocations
+ */
+ public String getSchemaLocations() {
+ return schemaLocations;
+ }
+
+
+ /**
+ * Gets the service endpoint interface classname.
+ *
+ * The class should be available in the Message Driven Bean jar.
+ *
+ * @return the serviceInterfaceClass
+ */
+ public String getServiceInterfaceClass() {
+ return serviceInterfaceClass;
+ }
+
+ /**
+ * @return the serviceName
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+
+ /**
+ *
+ * @return the wsdlLocation
+ */
+ public String getWsdlLocation() {
+ return wsdlLocation;
+ }
+
+
+ /**
+ * Sets the transport address used by
+ * {@link org.apache.cxf.frontend.ServerFactoryBean}.
+ *
+ * @param address the address to set
+ */
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+
+ /**
+ *
+ * @param busConfigLocation the busConfigLocation to set
+ */
+ public void setBusConfigLocation(String busConfigLocation) {
+ this.busConfigLocation = busConfigLocation;
+ }
+
+
+ /**
+ * A unique name that is readable to human and it is to
+ * identify an inbound endpoint within a application server.
+ *
+ * @param displayName the displayName to set
+ */
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * @param endpointName the endpointName to set
+ */
+ public void setEndpointName(String endpointName) {
+ this.endpointName = endpointName;
+ }
+
+ public void setResourceAdapter(ResourceAdapter ra) throws ResourceException {
+ resouceAdapter = ra;
+ }
+
+ /**
+ * Comma separated schema locations
+ *
+ * @param schemaLocations the schemaLocations to set
+ */
+ public void setSchemaLocations(String schemaLocations) {
+ this.schemaLocations = schemaLocations;
+ }
+
+ /**
+ * @param serviceInterfaceClass the serviceInterfaceClass to set
+ */
+ public void setServiceInterfaceClass(String serviceInterfaceClass) {
+ this.serviceInterfaceClass = serviceInterfaceClass;
+ }
+
+ /**
+ * @param serviceName the serviceName to set
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+
+ /**
+ *
+ * @param wsdlLocation the wsdlLocation to set
+ */
+ public void setWsdlLocation(String wsdlLocation) {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ /**
+ * TODO implement validation
+ */
+ public void validate() throws InvalidPropertyException {
+ }
+
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationSpec.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationSpec.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,222 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.resource.spi.UnavailableException;
+import javax.resource.spi.endpoint.MessageEndpoint;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.resource.spi.work.Work;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.EndpointUtils;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+
+/**
+ *
+ * MDBActivationWork is a type of {@link Work} that is executed by
+ * {@link javax.resource.spi.work.WorkManager}. MDBActivationWork
+ * starts an CXF service endpoint to accept inbound calls for
+ * the JCA connector.
+ *
+ */
+public class MDBActivationWork implements Work {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(MDBActivationWork.class);
+ private static final int MAX_ATTEMPTS = 5;
+ private static final long RETRY_SLEEP = 5000;
+
+ private MDBActivationSpec spec;
+ private MessageEndpointFactory endpointFactory;
+ private boolean released;
+
+ private Map<String, InboundEndpoint> endpoints;
+
+ public MDBActivationWork(MDBActivationSpec spec,
+ MessageEndpointFactory endpointFactory,
+ Map<String, InboundEndpoint> endpoints) {
+ this.spec = spec;
+ this.endpointFactory = endpointFactory;
+ this.endpoints = endpoints;
+ }
+
+ public void release() {
+ released = true;
+ }
+
+ /**
+ * Performs the work
+ */
+ public void run() {
+ // get message driven bean proxy
+ MessageEndpoint endpoint = getMesssageEndpoint();
+ if (endpoint == null) {
+ // error has been logged.
+ return;
+ }
+
+ // get class loader
+ ClassLoader classLoader = endpoint.getClass().getClassLoader();
+ ClassLoader savedClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ activate(endpoint, classLoader);
+ } finally {
+ Thread.currentThread().setContextClassLoader(savedClassLoader);
+ }
+ }
+
+ /**
+ * @param endpoint
+ * @param classLoader
+ */
+ private void activate(MessageEndpoint endpoint, ClassLoader classLoader) {
+ Class<?> serviceClass = null;
+ if (spec.getServiceInterfaceClass() != null) {
+ try {
+ serviceClass = Class.forName(spec.getServiceInterfaceClass(),
+ false, classLoader);
+ } catch (ClassNotFoundException e) {
+ LOG.severe("Failed to activate service endpoint "
+ + spec.getDisplayName()
+ + " due to unable to endpoint listener.");
+ return;
+ }
+ }
+
+ // create server bean factory
+ ServerFactoryBean factory = null;
+ if (serviceClass != null && EndpointUtils.hasWebServiceAnnotation(serviceClass)) {
+ factory = new JaxWsServerFactoryBean();
+ } else {
+ factory = new ServerFactoryBean();
+ }
+
+ if (serviceClass != null) {
+ factory.setServiceClass(serviceClass);
+ }
+
+ if (spec.getWsdlLocation() != null) {
+ factory.setWsdlLocation(spec.getWsdlLocation());
+ }
+
+ if (spec.getAddress() != null) {
+ factory.setAddress(spec.getAddress());
+ }
+
+ if (spec.getBusConfigLocation() != null) {
+ factory.setBus(new SpringBusFactory().createBus(classLoader
+ .getResource(spec.getBusConfigLocation())));
+ }
+
+ if (spec.getEndpointName() != null) {
+ factory.setEndpointName(QName.valueOf(spec.getEndpointName()));
+ }
+
+ if (spec.getSchemaLocations() != null) {
+ factory.setSchemaLocations(getListOfString(spec.getSchemaLocations()));
+ }
+
+ if (spec.getServiceName() != null) {
+ factory.setServiceName(QName.valueOf(spec.getServiceName()));
+ }
+
+ MDBInvoker invoker = createInvoker(endpoint);
+ factory.setInvoker(invoker);
+
+
+ // create and start the server
+ factory.setStart(true);
+ Server server = factory.create();
+
+ // save the server for clean up later
+ endpoints.put(spec.getDisplayName(), new InboundEndpoint(server, invoker));
+ }
+
+
+ /**
+ * @param str
+ * @return
+ */
+ private List<String> getListOfString(String str) {
+ if (str == null) {
+ return null;
+ }
+
+ return Arrays.asList(str.split(","));
+ }
+
+ /**
+ * @param endpoint
+ * @return
+ */
+ private MDBInvoker createInvoker(MessageEndpoint endpoint) {
+ MDBInvoker answer = null;
+ if (spec instanceof DispatchMDBActivationSpec) {
+ answer = new DispatchMDBInvoker(endpoint,
+ ((DispatchMDBActivationSpec)spec).getTargetBeanJndiName());
+ } else {
+ answer = new MDBInvoker(endpoint);
+ }
+ return answer;
+ }
+
+ /**
+ * Invokes endpoint factory to create message endpoint (event driven bean).
+ * It will retry if the event driven bean is not yet available.
+ */
+ private MessageEndpoint getMesssageEndpoint() {
+ MessageEndpoint answer = null;
+ for (int i = 0; i < MAX_ATTEMPTS; i++) {
+
+ if (released) {
+ LOG.warning("CXF service activation has been stopped.");
+ return null;
+ }
+
+ try {
+ answer = endpointFactory.createEndpoint(null);
+ break;
+ } catch (UnavailableException e) {
+ LOG.fine("Target endpoint activation in progress. Will retry.");
+ try {
+ Thread.sleep(RETRY_SLEEP);
+ } catch (InterruptedException e1) {
+ // ignore
+ }
+ }
+ }
+
+ if (answer == null) {
+ LOG.severe("Failed to activate service endpoint "
+ + spec.getDisplayName()
+ + " due to unable to endpoint listener.");
+ }
+
+ return answer;
+ }
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBInvoker.java?rev=696227&view=auto
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBInvoker.java (added)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBInvoker.java Wed Sep 17 03:07:25 2008
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jca.inbound;
+
+import javax.resource.spi.endpoint.MessageEndpoint;
+
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.service.invoker.AbstractInvoker;
+
+/**
+ * An invoker that supports direct Message Driven Bean invocation.
+ * It get invoked in the context of the Message Driven Bean that
+ * activates the CXF service endpoint facade. Applications that put
+ * service implementation inside the Message Driven Bean that activates
+ * the inbound endpoint facade should choose this invoker. It is
+ * more straightforward and faster than {@link DispatchMBDInvoker} but
+ * it requires to modify resource adapter's deployment descriptor (ra.xml)
+ * as the <messaging-type> needs to be set to the Service Endpoint Interface
+ * (SEI) class.
+ */
+public class MDBInvoker extends AbstractInvoker {
+
+ private MessageEndpoint messageEndpoint;
+
+ /**
+ * @param messageEndpoint
+ */
+ public MDBInvoker(MessageEndpoint messageEndpoint) {
+ this.messageEndpoint = messageEndpoint;
+ }
+
+ /**
+ * @return the messageEndpoint
+ */
+ public MessageEndpoint getMessageEndpoint() {
+ return messageEndpoint;
+ }
+
+ @Override
+ public Object getServiceObject(Exchange context) {
+ return messageEndpoint;
+ }
+
+}
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBInvoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBInvoker.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java?rev=696227&r1=696226&r2=696227&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java Wed Sep 17 03:07:25 2008
@@ -35,7 +35,7 @@
// Utility class - never constructed
}
- private static boolean hasWebServiceAnnotation(Class<?> cls) {
+ public static boolean hasWebServiceAnnotation(Class<?> cls) {
if (cls == null) {
return false;
}