tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r572341 - in /incubator/tuscany/java/sca/modules: binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/ core-spi/src/main/java/org/apache/tuscany/sca/invocation/ core/src/main/java/org/apache/tuscany/sca/core/invocation/ i...
Date Mon, 03 Sep 2007 14:00:36 GMT
Author: antelder
Date: Mon Sep  3 07:00:35 2007
New Revision: 572341

URL: http://svn.apache.org/viewvc?rev=572341&view=rev
Log:
TUSCANY-1522, support non String conversation IDs

Modified:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
    incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java
    incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
Mon Sep  3 07:00:35 2007
@@ -138,13 +138,13 @@
 
         // set conversation ID for WS-Addressing header
         //FIXME: get conversation ID from the message's callable reference
-        //FIXME: serialize conversation ID to XML in case it is not a string
-        String conversationId = msg.getConversationID();
-        if (conversationId != null && conversationId.length() != 0) {
+        Object conversationId = msg.getConversationID();
+        if (conversationId != null) {
             if (fromEPR == null) {
                 fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
             }
-            fromEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId);
+            //FIXME: serialize conversation ID to XML in case it is not a string
+            fromEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
         }
 
         // add WS-Addressing header

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
Mon Sep  3 07:00:35 2007
@@ -297,7 +297,7 @@
 
         String callbackAddress = null;
         String callbackID = null;
-        String conversationID = null;
+        Object conversationID = null;
 
         //FIXME: can we use the Axis2 addressing support for this?
         SOAPHeader header = inMC.getEnvelope().getHeader();

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
(original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
Mon Sep  3 07:00:35 2007
@@ -46,13 +46,13 @@
      * Get the conversation id
      * @return The conversation ID
      */
-    String getConversationID();
+    Object getConversationID();
 
     /**
      * Set the conversation id
      * @param conversationId The conversation ID
      */
-    void setConversationID(String conversationId);
+    void setConversationID(Object conversationId);
 
     /**
      * Get the end point reference of the source reference

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
Mon Sep  3 07:00:35 2007
@@ -35,7 +35,7 @@
     private Object correlationID;
     private boolean isFault;
     private ConversationSequence conversationSequence;
-    private String conversationId;
+    private Object conversationId;
     private Operation op;
     private CallableReference<?> callableReference;
     
@@ -61,11 +61,11 @@
         this.body = body;
     }
 
-    public String getConversationID() {
+    public Object getConversationID() {
         return conversationId;
     }
 
-    public void setConversationID(String conversationId) {
+    public void setConversationID(Object conversationId) {
         this.conversationId = conversationId;
     }
     

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
Mon Sep  3 07:00:35 2007
@@ -55,7 +55,7 @@
     public Message invoke(final Message msg) {
         // Retrieve conversation id to transfer to new thread
         // Notice that we cannot clear the conversation id from the current thread
-        final String conversationID = ThreadMessageContext.getMessageContext().getConversationID();
+        final Object conversationID = ThreadMessageContext.getMessageContext().getConversationID();
         // Schedule the invocation of the next interceptor in a new Work instance
         try {
             workScheduler.scheduleWork(new Runnable() {
@@ -100,7 +100,7 @@
             return null;
         }
 
-        public void setConversationID(String conversationId) {
+        public void setConversationID(Object conversationId) {
             throw new UnsupportedOperationException();
         }
 

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
Mon Sep  3 07:00:35 2007
@@ -21,12 +21,12 @@
 import org.apache.tuscany.sca.core.factory.ObjectFactory;
 import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
 
-public class ConversationIDObjectFactory implements ObjectFactory<String> {
+public class ConversationIDObjectFactory implements ObjectFactory {
 
     public ConversationIDObjectFactory() {
     }
 
-    public String getInstance() {
-        return (String)ThreadMessageContext.getMessageContext().getConversationID();
+    public Object getInstance() {
+        return ThreadMessageContext.getMessageContext().getConversationID();
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
Mon Sep  3 07:00:35 2007
@@ -47,17 +47,12 @@
         if (method.getParameterTypes().length != 1) {
             throw new IllegalContextException("ConversationID setter must have one parameter",
method);
         }
-        Class<?> paramType = method.getParameterTypes()[0];
         String name = JavaIntrospectionHelper.toPropertyName(method.getName());
-        if (String.class.equals(paramType)) {
-            JavaElementImpl element = new JavaElementImpl(method, 0);
-            element.setName(name);
-            element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
-            JavaResourceImpl resource = new JavaResourceImpl(element);
-            type.getResources().put(resource.getName(), resource);
-        } else {
-            throw new UnknownContextTypeException(paramType.getName());
-        }
+        JavaElementImpl element = new JavaElementImpl(method, 0);
+        element.setName(name);
+        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+        JavaResourceImpl resource = new JavaResourceImpl(element);
+        type.getResources().put(resource.getName(), resource);
     }
 
     @Override
@@ -65,14 +60,9 @@
         if (field.getAnnotation(ConversationID.class) == null) {
             return;
         }
-        Class<?> paramType = field.getType();
-        if (String.class.equals(paramType)) {
-            JavaElementImpl element = new JavaElementImpl(field);
-            element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
-            JavaResourceImpl resource = new JavaResourceImpl(element);
-            type.getResources().put(resource.getName(), resource);
-        } else {
-            throw new UnknownContextTypeException(paramType.getName());
-        }
+        JavaElementImpl element = new JavaElementImpl(field);
+        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+        JavaResourceImpl resource = new JavaResourceImpl(element);
+        type.getResources().put(resource.getName(), resource);
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java
Mon Sep  3 07:00:35 2007
@@ -50,6 +50,20 @@
         assertNotNull(type.getResources().get("cid"));
     }
 
+    public void testConversationIDMethodNotString() throws Exception {
+        Method method = Foo.class.getMethod("setConversationID", Long.class);
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        processor.visitMethod(method, type);
+        assertNotNull(type.getResources().get("conversationID"));
+    }
+
+    public void testConversationIDFieldNotString() throws Exception {
+        Field field = Foo.class.getDeclaredField("longCID");
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        processor.visitField(field, type);
+        assertNotNull(type.getResources().get("longCID"));
+    }
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -67,5 +81,12 @@
 
         }
 
+        @ConversationID
+        protected Long longCID;
+
+        @ConversationID
+        public void setConversationID(Long cid) {
+
+        }
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java?rev=572341&r1=572340&r2=572341&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
Mon Sep  3 07:00:35 2007
@@ -34,7 +34,7 @@
         return null;
     }
 
-    public String getConversationID() {
+    public Object getConversationID() {
         return null;
     }
 
@@ -70,7 +70,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public void setConversationID(String arg0) {
+    public void setConversationID(Object arg0) {
         throw new UnsupportedOperationException();
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message