[jbossws-commits] JBossWS SVN: r1969 - in trunk: integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42 and 3 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Jan 15 10:07:44 EST 2007


Author: thomas.diesler at jboss.com
Date: 2007-01-15 10:07:36 -0500 (Mon, 15 Jan 2007)
New Revision: 1969

Modified:
   trunk/integration-jboss42/.classpath
   trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
   trunk/integration-jboss50/.classpath
   trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
   trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java
Log:
[JBWS-1443] - getMessageContext Not Implemented\nResolved for jboss50

Modified: trunk/integration-jboss42/.classpath
===================================================================
--- trunk/integration-jboss42/.classpath	2007-01-15 15:03:28 UTC (rev 1968)
+++ trunk/integration-jboss42/.classpath	2007-01-15 15:07:36 UTC (rev 1969)
@@ -21,8 +21,6 @@
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-xml-binding.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/wsdl4j.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/xmlsec.jar"/>
-	<classpathentry kind="lib" path="/build/thirdparty/ejb3.deployer/jboss-annotations-ejb3.jar"/>
-	<classpathentry kind="lib" path="/build/thirdparty/ejb3.deployer/jboss-ejb3x.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jaxb-xjc.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-dependency.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-microcontainer.jar"/>
@@ -31,7 +29,9 @@
 	<classpathentry kind="lib" path="/build/thirdparty/wstx-lgpl-2.0.6.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/xalan.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/xercesImpl.jar"/>
-	<classpathentry kind="lib" path="/build/thirdparty/ejb3.deployer/jboss-ejb3.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/mail.jar"/>
+	<classpathentry kind="lib" path="/home/tdiesler/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.0.CR1-ejb3/server/default/deploy/ejb3.deployer/jboss-annotations-ejb3.jar"/>
+	<classpathentry kind="lib" path="/home/tdiesler/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.0.CR1-ejb3/server/default/deploy/ejb3.deployer/jboss-ejb3.jar"/>
+	<classpathentry kind="lib" path="/home/tdiesler/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.0.CR1-ejb3/server/default/deploy/ejb3.deployer/jboss-ejb3x.jar"/>
 	<classpathentry kind="output" path="output-eclipse"/>
 </classpath>

Modified: trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
===================================================================
--- trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java	2007-01-15 15:03:28 UTC (rev 1968)
+++ trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java	2007-01-15 15:07:36 UTC (rev 1969)
@@ -27,18 +27,21 @@
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
-import javax.xml.rpc.soap.SOAPFaultException;
 
 import org.jboss.aop.Dispatcher;
 import org.jboss.ejb3.stateless.StatelessContainer;
 import org.jboss.logging.Logger;
 import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
 import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
 import org.jboss.ws.core.server.AbstractServiceEndpointInvoker;
 import org.jboss.ws.core.server.ServiceEndpointInfo;
 import org.jboss.ws.core.server.ServiceEndpointInvoker;
 import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
 import org.jboss.ws.core.utils.ObjectNameFactory;
 
 /**
@@ -98,20 +101,6 @@
    {
       log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
 
-      /* [FIXME] how to do this for EJB3
-       
-       // these are provided by the ServerLoginHandler
-       Principal principal = SecurityAssociation.getPrincipal();
-       Object credential = SecurityAssociation.getCredential();
-
-       CommonMessageContext msgContext = MessageContextAssociation.getMessageContext();
-       
-       Invocation inv = new Invocation(null, method, args, null, principal, credential);
-       inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
-       inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getMessage());
-       inv.setType(InvocationType.SERVICE_ENDPOINT);
-       */
-
       // invoke on the container
       try
       {
@@ -125,10 +114,26 @@
          if (container == null)
             throw new WSException("Cannot obtain container from Dispatcher: " + canonicalName);
 
-         Class implClass = container.getBeanClass();
-         Method implMethod = getImplMethod(implClass, seiMethod);
+         Class beanClass = container.getBeanClass();
+         
+         SOAPMessageContextJAXWS jaxwsMessageContext = null;
+         SOAPMessageContextJAXRPC jaxrpcMessageContext = null;
+         CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+         if (msgContext instanceof SOAPMessageContextJAXRPC)
+         {
+            jaxrpcMessageContext = (SOAPMessageContextJAXRPC)msgContext;
+            jaxwsMessageContext = new SOAPMessageContextJAXWS(msgContext);
+         }
+         else if (msgContext instanceof SOAPMessageContextJAXWS)
+         {
+            jaxwsMessageContext = (SOAPMessageContextJAXWS)msgContext;
+            jaxrpcMessageContext = new SOAPMessageContextJAXRPC(msgContext);
+         }
 
+         Method implMethod = getImplMethod(beanClass, seiMethod);
+         //BeanContextLifecycleCallback callback = new CallbackImpl(jaxrpcMessageContext, jaxwsMessageContext);
          Object retObj = container.localInvoke(implMethod, args);
+
          epInv.setReturnValue(retObj);
       }
       catch (Throwable e)
@@ -142,4 +147,5 @@
    {
       // do nothing
    }
+
 }

Modified: trunk/integration-jboss50/.classpath
===================================================================
--- trunk/integration-jboss50/.classpath	2007-01-15 15:03:28 UTC (rev 1968)
+++ trunk/integration-jboss50/.classpath	2007-01-15 15:07:36 UTC (rev 1969)
@@ -2,9 +2,7 @@
 <classpath>
 	<classpathentry excluding="org/jboss/ws/integration/jboss50/ServiceRefHandler.java" kind="src" path="src/main/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/jbossws-core"/>
-	<classpathentry kind="lib" path="/build/thirdparty/ejb3.deployer/jboss-ejb3.jar" sourcepath="/home/tdiesler/svn/jbossas/trunk/ejb3/src/main"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-deployers.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-vfs.jar" sourcepath="/build/thirdparty/jboss-vfs-sources.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/ant.jar"/>
@@ -24,8 +22,6 @@
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-xml-binding.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/wsdl4j.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/xmlsec.jar"/>
-	<classpathentry kind="lib" path="/build/thirdparty/ejb3.deployer/jboss-annotations-ejb3.jar"/>
-	<classpathentry kind="lib" path="/build/thirdparty/ejb3.deployer/jboss-ejb3x.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jaxb-xjc.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-dependency.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/jboss-microcontainer.jar"/>
@@ -35,5 +31,10 @@
 	<classpathentry kind="lib" path="/build/thirdparty/xalan.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/xercesImpl.jar"/>
 	<classpathentry kind="lib" path="/build/thirdparty/mail.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x"/>
+	<classpathentry kind="lib" path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/ejb3.deployer/jboss-annotations-ejb3.jar"/>
+	<classpathentry kind="lib" path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/ejb3.deployer/jboss-ejb3.jar" sourcepath="/home/tdiesler/svn/jbossas/trunk/ejb3/src/main"/>
+	<classpathentry kind="lib" path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/ejb3.deployer/jboss-ejb3x.jar"/>
+	<classpathentry kind="lib" path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/jboss-aop-jboss5.deployer/jboss-aspect-library-jdk50.jar"/>
 	<classpathentry kind="output" path="output-eclipse"/>
 </classpath>

Modified: trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
===================================================================
--- trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java	2007-01-15 15:03:28 UTC (rev 1968)
+++ trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java	2007-01-15 15:07:36 UTC (rev 1969)
@@ -1,24 +1,24 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss50;
 
 // $Id$
@@ -29,7 +29,9 @@
 import javax.xml.rpc.soap.SOAPFaultException;
 
 import org.jboss.aop.Dispatcher;
-import org.jboss.ejb3.BaseSessionContext;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.BeanContextLifecycleCallback;
+import org.jboss.ejb3.stateless.StatelessBeanContext;
 import org.jboss.ejb3.stateless.StatelessContainer;
 import org.jboss.logging.Logger;
 import org.jboss.ws.WSException;
@@ -60,13 +62,13 @@
    public ServiceEndpointInvokerEJB3()
    {
    }
-   
+
    /** Initialize the service endpoint */
    @Override
-   public void initServiceEndpoint(ServiceEndpointInfo seInfo) 
+   public void initServiceEndpoint(ServiceEndpointInfo seInfo)
    {
       super.initServiceEndpoint(seInfo);
-      
+
       String ejbName = seInfo.getServerEndpointMetaData().getLinkName();
       UnifiedDeploymentInfo udi = seInfo.getUnifiedDeploymentInfo();
       String nameStr = "jboss.j2ee:name=" + ejbName + ",service=EJB3,jar=" + udi.simpleName;
@@ -74,10 +76,10 @@
       {
          nameStr += ",ear=" + udi.parent.simpleName;
       }
-      
+
       objectName = ObjectNameFactory.create(nameStr.toString());
    }
-   
+
    /** Load the SEI implementation bean if necessary 
     */
    public Class loadServiceEndpoint(ServiceEndpointInfo seInfo)
@@ -85,7 +87,7 @@
       Dispatcher dispatcher = Dispatcher.singleton;
       if (dispatcher.getRegistered(objectName.getCanonicalName()) == null)
          throw new WSException("Cannot find service endpoint target: " + objectName);
-      
+
       return null;
    }
 
@@ -110,32 +112,25 @@
          Dispatcher dispatcher = Dispatcher.singleton;
          StatelessContainer container = (StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
          Class beanClass = container.getBeanClass();
-         
-         SOAPMessageContextJAXWS jaxwsMessageContext;
-         SOAPMessageContextJAXRPC jaxrpcMessageContext;
+
+         SOAPMessageContextJAXWS jaxwsMessageContext = null;
+         SOAPMessageContextJAXRPC jaxrpcMessageContext = null;
          CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext instanceof SOAPMessageContextJAXRPC)
          {
             jaxrpcMessageContext = (SOAPMessageContextJAXRPC)msgContext;
             jaxwsMessageContext = new SOAPMessageContextJAXWS(msgContext);
          }
-         if (msgContext instanceof SOAPMessageContextJAXWS)
+         else if (msgContext instanceof SOAPMessageContextJAXWS)
          {
             jaxwsMessageContext = (SOAPMessageContextJAXWS)msgContext;
             jaxrpcMessageContext = new SOAPMessageContextJAXRPC(msgContext);
          }
-         
-         // WebServiceContext injection
-         // beanInstance = TODO get the bean instance somehow 
-         // WebServiceContextInjector.injectContext(beanInstance, (SOAPMessageContextJAXWS)msgContext);
-         
-         // MessageContext injection
-         //BaseSessionContext ejbContext = TODO get the bean base context somehow
-         //ejbContext.setMessageContext(jaxrpcMessageContext);
 
          Method implMethod = getImplMethod(beanClass, seiMethod);
-         Object retObj = container.localInvoke(implMethod, args);
-         
+         BeanContextLifecycleCallback callback = new CallbackImpl(jaxrpcMessageContext, jaxwsMessageContext);
+         Object retObj = container.localInvoke(implMethod, args, null, callback);
+
          epInv.setReturnValue(retObj);
       }
       catch (Throwable th)
@@ -149,4 +144,30 @@
    {
       // do nothing
    }
+
+   class CallbackImpl implements BeanContextLifecycleCallback
+   {
+      private SOAPMessageContextJAXWS jaxwsMessageContext;
+      private SOAPMessageContextJAXRPC jaxrpcMessageContext;
+
+      public CallbackImpl(SOAPMessageContextJAXRPC jaxrpcMessageContext, SOAPMessageContextJAXWS jaxwsMessageContext)
+      {
+         this.jaxwsMessageContext = jaxwsMessageContext;
+         this.jaxrpcMessageContext = jaxrpcMessageContext;
+      }
+
+      public void attached(BeanContext ctx)
+      {
+         StatelessBeanContext sbc = (StatelessBeanContext)ctx;
+         sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
+         sbc.setMessageContextJAXWS(jaxwsMessageContext);
+      }
+
+      public void released(BeanContext ctx)
+      {
+         StatelessBeanContext sbc = (StatelessBeanContext)ctx;
+         sbc.setMessageContextJAXRPC(null);
+         sbc.setMessageContextJAXWS(null);
+      }
+   }
 }

Modified: trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java
===================================================================
--- trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java	2007-01-15 15:03:28 UTC (rev 1968)
+++ trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java	2007-01-15 15:07:36 UTC (rev 1969)
@@ -52,7 +52,6 @@
 
    public void testWSDLAccess() throws MalformedURLException
    {
-      
       URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-context?wsdl");
       WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
       WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
@@ -66,7 +65,7 @@
       Service service = Service.create(wsdlURL, qname);
       EndpointInterface port = (EndpointInterface)service.getPort(EndpointInterface.class);
     
-      if (true)
+      if (isTargetJBoss50() == false)
       {
          System.out.println("FIXME: [JBWS-1443] - getMessageContext Not Implemented");
          return;




More information about the jbossws-commits mailing list