[jbossws-commits] JBossWS SVN: r3720 - in branches/jbossws-2.0/integration: spi/src/main/java/org/jboss/wsf/spi/invocation and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Tue Jun 26 02:04:27 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-06-26 02:04:26 -0400 (Tue, 26 Jun 2007)
New Revision: 3720

Modified:
   branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicEndpointInvocation.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicInvocationContext.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSMessageDispatcher.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSTransportSupport.java
Log:
More work on JMS transport

Modified: branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java
===================================================================
--- branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -29,6 +29,7 @@
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.spi.invocation.AbstractInvocationHandler;
 import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
 
 /**
  * Handles invocations on MDB EJB21 endpoints.
@@ -41,26 +42,14 @@
    // provide logging
    private static final Logger log = Logger.getLogger(InvocationHandlerMDB21.class);
    
-   private static ThreadLocal mdbAssociation = new ThreadLocal();
-   
-   public Object getTargetBean() 
-   {
-      Object targetBean = mdbAssociation.get();
-      return targetBean;
-   }
-   
-   public static void setTargetBean(Object targetBean)
-   {
-      mdbAssociation.set(targetBean);
-   }
-
    public void invoke(Endpoint ep, Invocation epInv) throws Exception
    {
       log.debug("Invoke: " + epInv.getJavaMethod().getName());
 
       try
       {
-         Object targetBean = getTargetBean();
+         InvocationContext invContext = epInv.getInvocationContext();
+         Object targetBean = invContext.getTargetBean();
          Class implClass = targetBean.getClass();
          Method seiMethod = epInv.getJavaMethod();
          Method implMethod = getImplMethod(implClass, seiMethod);
@@ -73,9 +62,5 @@
       {
          handleInvocationException(e);
       }
-      finally
-      {
-         setTargetBean(null);
-      }
    }
 }

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicEndpointInvocation.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicEndpointInvocation.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicEndpointInvocation.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -34,7 +34,6 @@
 public class BasicEndpointInvocation implements Invocation
 {
    private InvocationContext invocationContext;
-   private Object targetBean;
    private Method javaMethod;
    private Object[] args;
    private Object returnValue;
@@ -54,16 +53,6 @@
       this.invocationContext = invocationContext;
    }
 
-   public Object getTargetBean()
-   {
-      return targetBean;
-   }
-
-   public void setTargetBean(Object targetBean)
-   {
-      this.targetBean = targetBean;
-   }
-
    public Method getJavaMethod()
    {
       return javaMethod;

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicInvocationContext.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicInvocationContext.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/BasicInvocationContext.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -32,8 +32,20 @@
  */
 public class BasicInvocationContext implements InvocationContext
 {
+   private Object targetBean;
    private Map<Class, Object> attachments = new HashMap<Class, Object>();
+   
+   public Object getTargetBean()
+   {
+      return targetBean;
+   }
 
+   public void setTargetBean(Object targetBean)
+   {
+      this.targetBean = targetBean;
+   }
+
+
    public <T> T addAttachment(Class<T> key, Object value)
    {
       return (T)attachments.put(key, value);

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -37,10 +37,6 @@
    
    void setInvocationContext(InvocationContext context);
    
-   Object getTargetBean();
-   
-   void setTargetBean(Object targetBean);
-   
    Method getJavaMethod();
    
    void setJavaMethod(Method method);

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -31,6 +31,10 @@
  */
 public interface InvocationContext
 {
+   Object getTargetBean();
+   
+   void setTargetBean(Object targetBean);
+   
    /** Add arbitrary attachments */
    <T> T addAttachment(Class<T> key, Object value);
 

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -39,14 +39,15 @@
 {
    protected Object getTargetBean(Endpoint ep, Invocation epInv) 
    {
-      Object targetBean = epInv.getTargetBean();
+      InvocationContext invCtx = epInv.getInvocationContext();
+      Object targetBean = invCtx.getTargetBean();
       if (targetBean == null)
       {
          try
          {
             Class epImpl = ep.getTargetBeanClass();
             targetBean = epImpl.newInstance();
-            epInv.setTargetBean(targetBean);
+            invCtx.setTargetBean(targetBean);
          }
          catch (Exception ex)
          {

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSMessageDispatcher.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSMessageDispatcher.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSMessageDispatcher.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -63,13 +63,14 @@
       log.debug("dipatchMessage: " + endpoint.getName());
 
       RequestHandler reqHandler = endpoint.getRequestHandler();
-      InvocationHandler invHandler = endpoint.getInvocationHandler();
       
       try
       {
-         BasicInvocationContext context = new BasicInvocationContext();
-         reqHandler.handleRequest(endpoint, inputStream, null, context);
-         SOAPMessage resMessage = getResponseMessage(context);
+         BasicInvocationContext invContext = new BasicInvocationContext();
+         invContext.setTargetBean(targetBean);
+         
+         reqHandler.handleRequest(endpoint, inputStream, null, invContext);
+         SOAPMessage resMessage = getResponseMessage(invContext);
          return resMessage;
       }
       catch (Exception ex)

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSTransportSupport.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSTransportSupport.java	2007-06-25 20:39:39 UTC (rev 3719)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/transport/jms/JMSTransportSupport.java	2007-06-26 06:04:26 UTC (rev 3720)
@@ -97,15 +97,15 @@
          if (destination instanceof Topic)
             fromName = "topic/" + ((Topic)destination).getTopicName();
 
-         InputStream reqMessage = new ByteArrayInputStream(msgStr.getBytes());
-         SOAPMessage resMessage = processSOAPMessage(fromName, reqMessage);
+         InputStream inputStream = new ByteArrayInputStream(msgStr.getBytes());
+         SOAPMessage resMessage = processSOAPMessage(fromName, inputStream);
 
          if (resMessage != null)
          {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            resMessage.writeTo(baos);
+            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+            resMessage.writeTo(outputStream);
 
-            msgStr = new String(baos.toByteArray());
+            msgStr = new String(outputStream.toByteArray());
             log.debug("Outgoing SOAP message: " + msgStr);
 
             Queue replyQueue = getReplyQueue(message);
@@ -133,10 +133,10 @@
       }
    }
 
-   protected SOAPMessage processSOAPMessage(String fromName, InputStream reqMessage) throws SOAPException, IOException, RemoteException
+   protected SOAPMessage processSOAPMessage(String fromName, InputStream inputStream) throws SOAPException, IOException, RemoteException
    {
       MessageDispatcher msgDispatcher = new JMSMessageDispatcher();
-      SOAPMessage resMessage = msgDispatcher.dipatchMessage(fromName, this, reqMessage);
+      SOAPMessage resMessage = msgDispatcher.dipatchMessage(fromName, this, inputStream);
       return resMessage;
    }
 




More information about the jbossws-commits mailing list