antelder 2002/11/01 09:17:41 Modified: java/src/org/apache/wsif/providers/jms WSIFPort_Jms.java WSIFOperation_Jms.java Log: Lazy initialise the JMS destination and change the order of precidence when setting JMS properties so that propertise in the context message have highest priority Revision Changes Path 1.13 +18 -10 xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFPort_Jms.java Index: WSIFPort_Jms.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFPort_Jms.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- WSIFPort_Jms.java 24 Oct 2002 16:09:07 -0000 1.12 +++ WSIFPort_Jms.java 1 Nov 2002 17:17:40 -0000 1.13 @@ -109,14 +109,6 @@ fieldDefinition = def; fieldPortModel = port; - jmsDest = - new WSIFJMSDestination( - WSIFJMSFinder.newFinder( - getObjectReference(), - fieldPortModel.getName()), - getObjectReference().getJmsProvDestName(), - WSIFProperties.getSyncTimeout()); - if (Trc.ON) Trc.exit(deep()); } @@ -186,8 +178,7 @@ new WSIFOperation_Jms( fieldPortModel, bindingOperationModel, - this, - jmsDest); + this); setDynamicWSIFOperation(name, inputName, outputName, operation); } } @@ -289,6 +280,23 @@ Trc.exit(wf); return wf; } + + /** + * Returns the jmsDestination for this WSIFPort. + * @return WSIFJMSDestination + */ + public WSIFJMSDestination getJmsDestination() throws WSIFException { + if (jmsDest==null) { + jmsDest = + new WSIFJMSDestination( + WSIFJMSFinder.newFinder( + getObjectReference(), + fieldPortModel.getName()), + getObjectReference().getJmsProvDestName(), + WSIFProperties.getSyncTimeout()); + } + return jmsDest; + } /** * helper 1.35 +18 -14 xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java Index: WSIFOperation_Jms.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- WSIFOperation_Jms.java 24 Oct 2002 16:09:07 -0000 1.34 +++ WSIFOperation_Jms.java 1 Nov 2002 17:17:40 -0000 1.35 @@ -142,7 +142,6 @@ private long syncTimeout; private long asyncTimeout; - transient private WSIFJMSDestination jmsDest; /** * ctor @@ -150,8 +149,7 @@ public WSIFOperation_Jms( Port basePort, BindingOperation bindingOperation, - WSIFPort_Jms jmsPort, - WSIFJMSDestination jmsDest) + WSIFPort_Jms jmsPort) throws WSIFException { Trc.entry(this, basePort, bindingOperation, jmsPort); @@ -159,7 +157,6 @@ fieldBasePort = basePort; fieldBindingOperation = bindingOperation; fieldJmsPort = jmsPort; - this.jmsDest = jmsDest; syncTimeout = WSIFProperties.getSyncTimeout(); asyncTimeout = WSIFProperties.getAsyncTimeout(); @@ -178,8 +175,7 @@ new WSIFOperation_Jms( fieldBasePort, fieldBindingOperation, - fieldJmsPort, - jmsDest); + fieldJmsPort); if (Trc.ON) Trc.exit(woj.deep()); return woj; @@ -212,6 +208,7 @@ // send the jms message String correlId = sendJmsMessage(input); + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); javax.jms.Message response = jmsDest.receive(correlId, syncTimeout); operationSucceeded = receiveJmsMessage(response, output, fault); @@ -407,6 +404,7 @@ private String sendJmsMessage(WSIFMessage input) throws WSIFException { String correlId = null; + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); setPropertyValues(); @@ -450,6 +448,9 @@ message.setObjectPart((String) i.next(), null); } + // properties from the context + setDestinationContext(); + Service serviceModel = null; Definition def = fieldJmsPort.getDefinition(); Map services = WSIFUtils.getAllItems(def, "Service"); @@ -560,8 +561,9 @@ return propertyParts; } - private void setPropertyValues() { + private void setPropertyValues() throws WSIFException { String value; + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); // First set the default properties identifying the JMS message try { value = fieldOperation.getName(); @@ -604,9 +606,6 @@ Trc.ignoredException(ex); } - // properties from the context - setDestinationContext(); - // propertyValues from the input message if (fieldInputJmsPropertyValues != null) { try { @@ -620,9 +619,10 @@ /** * sets the output message properties from the received JMS message. */ - private void setOutProperties(WSIFMessage output) { + private void setOutProperties(WSIFMessage output) throws WSIFException { if (output != null && fieldOutputProperties != null) { + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); for (Iterator i = fieldOutputProperties.keySet().iterator(); i.hasNext(); ) { @@ -641,10 +641,11 @@ private void setFaultProperties( WSIFMessage fault, - BindingFault bindingFault) { + BindingFault bindingFault) throws WSIFException{ Trc.entry(this, fault, bindingFault); + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); Iterator it = bindingFault.getExtensibilityElements().iterator(); while (it.hasNext()) { Object ele = it.next(); @@ -692,6 +693,7 @@ private void setJMSPropertyValues(List propertyValues) throws WSIFException { if (propertyValues != null) { + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); for (Iterator i = propertyValues.iterator(); i.hasNext();) { JMSPropertyValue pv = (JMSPropertyValue) i.next(); if (pv != null) { @@ -719,6 +721,7 @@ if (value != null) { Object o = getObjectValue(value.getType(), value.getValue()); if (!timeoutProperty(attName, o)) { + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); jmsDest.setProperty(attName, o); } } @@ -937,8 +940,8 @@ /** * This sets up any context JMS property values in the Destination */ - private void setDestinationContext() { - if (context == null || jmsDest == null) { + private void setDestinationContext() throws WSIFException{ + if (context == null) { return; } HashMap jmsProps = new HashMap(); @@ -960,6 +963,7 @@ } } if (jmsProps.size() > 0) { + WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); jmsDest.setProperties(jmsProps); } }