Commit in servicemix/base/src/main on MAIN
java/org/servicemix/jbi/messaging/MessageExchangeFactoryImpl.java+33-101.9 -> 1.10
                                 /DeliveryChannelImpl.java+18-21.17 -> 1.18
java/org/servicemix/components/jms/JmsServiceComponent.java+1-561.2 -> 1.3
release/examples/bpel/JMSClient.java+2-41.2 -> 1.3
+54-72
4 modified files
tidy up setting defaults

servicemix/base/src/main/java/org/servicemix/jbi/messaging
MessageExchangeFactoryImpl.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- MessageExchangeFactoryImpl.java	2 Aug 2005 18:57:40 -0000	1.9
+++ MessageExchangeFactoryImpl.java	2 Aug 2005 19:55:16 -0000	1.10
@@ -30,19 +30,19 @@
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
 import org.activemq.util.IdGenerator;
-import org.servicemix.jbi.container.ActivationSpec;
-import org.servicemix.jbi.framework.ComponentContextImpl;
 import org.servicemix.client.Marshaler;
+import org.servicemix.jbi.framework.ComponentContextImpl;
 
 /**
  * Resolver for URI patterns
  *
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
  */
 public class MessageExchangeFactoryImpl implements MessageExchangeFactory {
 
     private QName interfaceName;
     private QName serviceName;
+    private QName operationName;
     private ServiceEndpoint endpoint;
     private IdGenerator idGenerator;
     private ComponentContextImpl context;
@@ -198,24 +198,47 @@
     public void setServiceName(QName serviceName) {
         this.serviceName = serviceName;
     }
+    
+    /**
+     * @return Returns the operationName.
+     */
+    public QName getOperationName() {
+        return operationName;
+    }
 
+
+    /**
+     * @param operationName The operationName to set.
+     */
+    public void setOperationName(QName operationName) {
+        this.operationName = operationName;
+    }
+
+    /**
+     * Get the Context 
+     * @return the context
+     */
     public ComponentContextImpl getContext() {
         return context;
     }
 
+    /**
+     * Set the Context
+     * @param context
+     */
     public void setContext(ComponentContextImpl context) {
         this.context = context;
     }
 
     protected void setDefaults(MessageExchangeImpl exchange) {
-        exchange.setService(serviceName);
-        exchange.setInterfaceName(getInterfaceName());
-        ActivationSpec activationSpec = context.getActivationSpec();
-        if (activationSpec != null) {
-            exchange.setOperation(activationSpec.getDestinationOperation());
-            exchange.setEndpointName(activationSpec.getDestinationEndpoint());
+        exchange.setOperation(getOperationName());
+        if (endpoint != null){
+            exchange.setEndpoint(getEndpoint());
+        }else {
+            exchange.setService(serviceName);
+            exchange.setInterfaceName(interfaceName);
         }
-        exchange.setEndpoint(getEndpoint());
+        
         exchange.setSourceContext(getContext());
         Marshaler marshaler = getContext().getActivationSpec().getMarshaler();
         if (marshaler != null) {

servicemix/base/src/main/java/org/servicemix/jbi/messaging
DeliveryChannelImpl.java 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- DeliveryChannelImpl.java	2 Aug 2005 17:10:09 -0000	1.17
+++ DeliveryChannelImpl.java	2 Aug 2005 19:55:16 -0000	1.18
@@ -41,7 +41,7 @@
 /**
  * DeliveryChannel implementation
  * 
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.18 $
  */
 public class DeliveryChannelImpl implements DeliveryChannel {
     private static final Log log = LogFactory.getLog(DeliveryChannel.class);
@@ -115,8 +115,24 @@
         ActivationSpec activationSpec = context.getActivationSpec();
         if (activationSpec != null) {
             // lets auto-default the container-routing information
-            result.setServiceName(activationSpec.getDestinationService());
+            QName serviceName = activationSpec.getDestinationService();
+            result.setServiceName(serviceName);
             result.setInterfaceName(activationSpec.getDestinationInterface());
+            String endpointName = activationSpec.getEndpoint();
+            log.info("default endpointName for factory to " + endpointName);
+            if (serviceName != null && endpointName != null){
+                endpointName = endpointName.trim();
+                ServiceEndpoint[] endpoints = container.getRegistry().getEndpointsForService(serviceName);
+                if (endpoints != null){
+                    for (int i = 0; i < endpoints.length; i++){
+                        if(endpoints[i].getEndpointName().equals(endpointName)){
+                            log.info("Set default endpoint for factory to " + endpoints[i]);
+                            result.setEndpoint(endpoints[i]);
+                            break;
+                        }
+                    }
+                }
+            }
         }
         return result;
     }

servicemix/base/src/main/java/org/servicemix/components/jms
JmsServiceComponent.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- JmsServiceComponent.java	1 Aug 2005 07:06:26 -0000	1.2
+++ JmsServiceComponent.java	2 Aug 2005 19:55:16 -0000	1.3
@@ -28,7 +28,6 @@
 import javax.jms.MessageConsumer;
 import javax.jms.MessageListener;
 import javax.jms.Session;
-import javax.xml.namespace.QName;
 import javax.xml.transform.TransformerException;
 import org.activemq.util.JMSExceptionHelper;
 import org.apache.commons.logging.Log;
@@ -46,25 +45,9 @@
  * container for processing, and send back the result to the JMS requestor - used for the TopipcRequestor and
  * QueueRequestor pattern
  * 
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
  */
 public class JmsServiceComponent extends ComponentSupport implements MessageListener, InitializingBean, DisposableBean {
-    /**
-     * property name for operation namespace
-     */
-    public String OPERATION_NAME_SPACE_PROP = "opNameSpace";
-    /**
-     * property name for operation local part
-     */
-    public String OPERATION_LOCAL_PROP = "opLocalPart";
-    /**
-     * property name for service namespace
-     */
-    public String SERVICE_NAME_SPACE_PROP = "servNameSpace";
-    /**
-     * property name for service local part
-     */
-    public String SERVICE_LOCAL_PROP = "servLocalPart";
     private static final Log log = LogFactory.getLog(JmsServiceComponent.class);
     private DestinationChooser destinationChooser;
     private JmsMarshaler marshaler = new JmsMarshaler();
@@ -167,14 +150,6 @@
             final InOut messageExchange = getDeliveryChannel().createExchangeFactory().createInOutExchange();
             NormalizedMessage inMessage = messageExchange.createMessage();
             try {
-                QName operation = getOperationFromMessage(jmsMessage);
-                QName service = getServiceFromMessage(jmsMessage);
-                if (operation != null){
-                    messageExchange.setOperation(operation);
-                }
-                if (service != null){
-                    messageExchange.setService(service);
-                }
                 marshaler.toNMS(inMessage, jmsMessage);
                 messageExchange.setInMessage(inMessage);
                 if (getDeliveryChannel().sendSync(messageExchange)) {
@@ -234,36 +209,6 @@
         if (result == null) {
             log.error("Coul not find an outbound destination for " + inboundMessage);
             throw new JMSException("No outbound JMS Destination can be found");
-        }
-        return result;
-    }
-    
-    protected QName getOperationFromMessage(Message message) throws JMSException{
-        QName result = null;
-        //get override defination for the operation
-        String operationName = message.getStringProperty(OPERATION_NAME_SPACE_PROP);
-        String operationLocal = message.getStringProperty(OPERATION_LOCAL_PROP);
-        if (operationLocal != null){
-            if (operationName != null){
-                result = new QName(operationName,operationLocal);
-            }else {
-                result = new QName(operationLocal);
-            }
-        }
-        return result;
-    }
-    
-    protected QName getServiceFromMessage(Message message) throws JMSException{
-        QName result = null;
-        //get override defination for the operation
-        String serviceName = message.getStringProperty(SERVICE_NAME_SPACE_PROP);
-        String seriviceLocal = message.getStringProperty(SERVICE_LOCAL_PROP);
-        if (seriviceLocal != null){
-            if (serviceName != null){
-                result = new QName(serviceName,seriviceLocal);
-            }else {
-                result = new QName(seriviceLocal);
-            }
         }
         return result;
     }

servicemix/base/src/main/release/examples/bpel
JMSClient.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- JMSClient.java	1 Aug 2005 21:00:10 -0000	1.2
+++ JMSClient.java	2 Aug 2005 19:55:16 -0000	1.3
@@ -26,11 +26,12 @@
 import org.activemq.message.ActiveMQTopic;
 
 /**
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
  */
 public class JMSClient {
     /**
      * main ...
+     * 
      * @param args
      * @throws Exception
      */
@@ -50,9 +51,6 @@
             payload += str;
         }
         Message out = session.createTextMessage(payload);
-        //set the specific operation for PXE to do ...
-        //out.setStringProperty("opNameSpace", "uri:fivesight.com/examples/AsyncProcessJBI");
-        out.setStringProperty("opLocalPart","Run");
         Message in = requestor.request(out);
         if (in == null) {
             System.out.println("Response timed out.");
CVSspam 0.2.8



Reply via email to