servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r690848 - /servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultServiceMixClient.java
Date Mon, 01 Sep 2008 05:28:34 GMT
Author: ffang
Date: Sun Aug 31 22:28:34 2008
New Revision: 690848

URL: http://svn.apache.org/viewvc?rev=690848&view=rev
Log:
[SM-1532]fix ServiceMixClientTest failure

Modified:
    servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultServiceMixClient.java

Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultServiceMixClient.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultServiceMixClient.java?rev=690848&r1=690847&r2=690848&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultServiceMixClient.java
(original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/client/DefaultServiceMixClient.java
Sun Aug 31 22:28:34 2008
@@ -347,47 +347,82 @@
     }
 
     public void send(org.apache.servicemix.client.Message message) throws MessagingException
{
-        
+        send(message.getExchange());
     }
 
-    public InOnly createInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver arg0)
+    public InOnly createInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
         throws JBIException {
-        // TODO Auto-generated method stub
-        return null;
+        InOnly exchange = createInOnlyExchange();
+        configureEndpoint(exchange, resolver);
+        return exchange;
     }
 
-    public InOptionalOut createInOptionalOutExchange(org.apache.servicemix.jbi.api.EndpointResolver
arg0)
+    public InOptionalOut createInOptionalOutExchange(org.apache.servicemix.jbi.api.EndpointResolver
resolver)
         throws JBIException {
-        // TODO Auto-generated method stub
-        return null;
+        InOptionalOut exchange = createInOptionalOutExchange();
+        configureEndpoint(exchange, resolver);
+        return exchange;
     }
 
-    public InOut createInOutExchange(org.apache.servicemix.jbi.api.EndpointResolver arg0)
throws JBIException {
-        // TODO Auto-generated method stub
-        return null;
+    public InOut createInOutExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
throws JBIException {
+        InOut exchange = createInOutExchange();
+        configureEndpoint(exchange, resolver);
+        return exchange;
     }
 
-    public RobustInOnly createRobustInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver
arg0)
+    public RobustInOnly createRobustInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver
resolver)
         throws JBIException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public Object request(org.apache.servicemix.jbi.api.EndpointResolver arg0, Map arg1,
Map arg2, Object arg3)
-        throws JBIException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public void send(org.apache.servicemix.jbi.api.EndpointResolver arg0, Map arg1, Map arg2,
Object arg3)
-        throws JBIException {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public boolean sendSync(org.apache.servicemix.jbi.api.EndpointResolver arg0, Map arg1,
Map arg2,
-                            Object arg3) throws JBIException {
-        // TODO Auto-generated method stub
-        return false;
+        RobustInOnly exchange = getExchangeFactory().createRobustInOnlyExchange();
+        configureEndpoint(exchange, resolver);
+        return exchange;
+    }
+
+    public Object request(org.apache.servicemix.jbi.api.EndpointResolver resolver, Map exchangeProperties,

+                          Map inMessageProperties, Object content) throws JBIException {
+        InOut exchange = createInOutExchange(resolver);
+        populateMessage(exchange, exchangeProperties, inMessageProperties, content);
+        boolean answer = sendSync(exchange);
+        if (!answer) {
+            throw new JBIException("Exchange aborted");
+        }
+        Exception error = exchange.getError();
+        if (error != null) {
+            throw new JBIException(error);
+        }
+        if (exchange.getFault() != null) {
+            done(exchange);
+            throw FaultException.newInstance(exchange);
+        }
+
+
+        NormalizedMessage outMessage = exchange.getOutMessage();
+        if (outMessage == null) {
+            throw new NoOutMessageAvailableException(exchange);
+        }
+        Object result = getMarshaler().unmarshal(exchange, outMessage);
+        done(exchange);
+        return result;
+    }
+
+    public void send(org.apache.servicemix.jbi.api.EndpointResolver resolver, Map exchangeProperties,

+                     Map inMessageProperties, Object content) throws JBIException {
+        InOnly exchange = createInOnlyExchange(resolver);
+        populateMessage(exchange, exchangeProperties, inMessageProperties, content);
+        send(exchange);        
+    }
+
+    public boolean sendSync(org.apache.servicemix.jbi.api.EndpointResolver resolver, 
+                            Map exchangeProperties, Map inMessageProperties,
+                            Object content) throws JBIException {
+        InOnly exchange = createInOnlyExchange(resolver);
+        populateMessage(exchange, exchangeProperties, inMessageProperties, content);
+        return sendSync(exchange);
+    }
+    
+    protected void configureEndpoint(MessageExchange exchange, 
+        org.apache.servicemix.jbi.api.EndpointResolver resolver) throws JBIException {
+        if (resolver != null) {
+            exchange.setEndpoint(resolver.resolveEndpoint(getContext(), exchange, filter));
+        }
     }
 }



Mime
View raw message