You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-dev@ws.apache.org by an...@apache.org on 2003/03/18 18:57:24 UTC
cvs commit: xml-axis-wsif/java/src/org/apache/wsif/util/jms WSIFJMSProperties.java
antelder 2003/03/18 09:57:24
Modified: java/src/org/apache/wsif/providers/jms Tag: pre1_2_0-patches
WSIFOperation_Jms.java JMSFormatter.java
java/test/jms Tag: pre1_2_0-patches Jms.wsdl
java/src/org/apache/wsif/util/jms Tag: pre1_2_0-patches
WSIFJMSProperties.java
Added: java/test/jms Tag: pre1_2_0-patches
ServerSidePropertiesTest.java
Log:
Add API for setting of JMS Message properties
Revision Changes Path
No revision
No revision
1.34.2.2 +94 -0 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.2.1
retrieving revision 1.34.2.2
diff -u -r1.34.2.1 -r1.34.2.2
--- WSIFOperation_Jms.java 4 Nov 2002 16:52:11 -0000 1.34.2.1
+++ WSIFOperation_Jms.java 18 Mar 2003 17:57:23 -0000 1.34.2.2
@@ -94,6 +94,7 @@
import org.apache.wsif.util.WSIFUtils;
import org.apache.wsif.util.jms.WSIFJMSCorrelationId;
import org.apache.wsif.util.jms.WSIFJMSDestination;
+import org.apache.wsif.util.jms.WSIFJMSProperties;
import org.apache.wsif.wsdl.extensions.jms.JMSAddress;
import org.apache.wsif.wsdl.extensions.jms.JMSBinding;
import org.apache.wsif.wsdl.extensions.jms.JMSConstants;
@@ -1005,6 +1006,99 @@
}
return wsdlOutputParts;
}
+
+
+ /**
+ * Sets JMS properties on a JMS message
+ * @param targetMsg the JMS message where properties will be set
+ * @param srcMsg WSIF message containing the JMS property values
+ * @param formatter JMSFormatter holding WSDL definitions defining
+ * which JMS properties should be set
+ */
+ public static void setJMSMessageOutputHeaderProperties(
+ javax.jms.Message targetMsg,
+ WSIFMessage srcMsg,
+ JMSFormatter formatter)
+ throws WSIFException {
+
+ Trc.entry(null, targetMsg, srcMsg, formatter);
+
+ if (targetMsg == null) {
+ throw new IllegalArgumentException("targetMsg is null");
+ }
+ if (srcMsg == null) {
+ throw new IllegalArgumentException("srcMsg is null");
+ }
+ if (formatter == null) {
+ throw new IllegalArgumentException("formatter is null");
+ }
+
+ WSIFJMSProperties jmsProps = new WSIFJMSProperties(WSIFJMSProperties.OUT);
+
+ Map properties = getJMSOutputProperties(formatter);
+ for (Iterator i = properties.keySet().iterator(); i.hasNext(); ) {
+ String wsifMsgPart = (String) i.next();
+ String jmsProperty = (String) properties.get(wsifMsgPart);
+ Object value = null;
+ try {
+ value = srcMsg.getObjectPart(wsifMsgPart);
+ jmsProps.put(jmsProperty, value);
+ } catch (WSIFException e) {
+ Trc.ignoredException(e);
+ }
+ }
+
+ jmsProps.set(null, targetMsg);
+
+ Trc.exit();
+ }
+
+ /**
+ * Gets the output jms:property's defined in a WSDL JMS binding
+ */
+ protected static Map getJMSOutputProperties(JMSFormatter f) throws WSIFException {
+ Map jmsProperties = new HashMap();
+
+ BindingOperation bop = getFormatterOperation(f);
+ BindingOutput bout = bop.getBindingOutput();
+ if (bout != null) {
+ List extEls = bout.getExtensibilityElements();
+ for (Iterator i = extEls.iterator(); i.hasNext(); ) {
+ ExtensibilityElement ele = (ExtensibilityElement) i.next();
+ if (ele instanceof JMSProperty) {
+ jmsProperties.put(
+ ((JMSProperty) ele).getPart(),
+ ((JMSProperty) ele).getName());
+ }
+ }
+ }
+
+ return jmsProperties;
+ }
+
+ /**
+ * Gets the WSDL binding operation associated with a JMSFormatter
+ */
+ protected static BindingOperation getFormatterOperation(JMSFormatter f) throws WSIFException {
+
+ Port port = f.getPort();
+ if (port == null) {
+ throw new WSIFException("formatter contains a null Port");
+ }
+
+ BindingOperation bop =
+ WSIFUtils.getBindingOperation(
+ port.getBinding(),
+ f.getOperationName(),
+ f.getInputName(),
+ f.getOutputName());
+
+ if (bop == null) {
+ throw new WSIFException("cannot find binding operation for formatter");
+ }
+
+ return bop;
+ }
public String deep() {
String buff = "";
1.11.2.1 +19 -3 xml-axis-wsif/java/src/org/apache/wsif/providers/jms/JMSFormatter.java
Index: JMSFormatter.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/jms/JMSFormatter.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- JMSFormatter.java 24 Oct 2002 16:09:07 -0000 1.11
+++ JMSFormatter.java 18 Mar 2003 17:57:23 -0000 1.11.2.1
@@ -631,7 +631,7 @@
return list;
}
- private String getOperationName() {
+ public String getOperationName() {
return reqOpName;
}
@@ -639,7 +639,7 @@
reqOpName = s;
}
- private String getInputName() {
+ public String getInputName() {
return reqInputName;
}
@@ -647,7 +647,7 @@
reqInputName = s;
}
- private String getOutputName() {
+ public String getOutputName() {
return reqOutputName;
}
@@ -659,6 +659,22 @@
Trc.entry(this);
Trc.exit(lastBindingFault);
return lastBindingFault;
+ }
+
+ /**
+ * Returns the WSDL Definition.
+ * @return javax.wsdl.Definition
+ */
+ public javax.wsdl.Definition getDefinition() {
+ return fieldDefinition;
+ }
+
+ /**
+ * Returns the WSDL Port.
+ * @return javax.wsdl.Port
+ */
+ public javax.wsdl.Port getPort() {
+ return fieldPort;
}
}
No revision
No revision
1.7.2.1 +57 -0 xml-axis-wsif/java/test/jms/Jms.wsdl
Index: Jms.wsdl
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/jms/Jms.wsdl,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- Jms.wsdl 3 Oct 2002 10:45:56 -0000 1.7
+++ Jms.wsdl 18 Mar 2003 17:57:23 -0000 1.7.2.1
@@ -433,6 +433,56 @@
</operation>
</binding>
+ <binding name="SSOutProperties" type="tns:AddressBook">
+ <jms:binding type="ObjectMessage"/>
+ <format:typeMapping encoding="Java" style="Java">
+ <format:typeMap typeName="typens:address" formatType="com.ibm.www.namespace.wsif.samples.ab.types.Address" />
+ <format:typeMap typeName="xsd:string" formatType="java.lang.String" />
+ </format:typeMapping>
+ <operation name="addEntry">
+ <input name="AddEntryRequest">
+ <jms:property name="JMSDeliveryMode" part="requestDeliveryMode" />
+ </input>
+ <output name="AddEntryResponse">
+ </output>
+ </operation>
+ <operation name="addEntry">
+ <input name="AddEntryJmsPropRequest">
+ <jms:property name="JMSPriority" part="requestPriority" />
+ <jms:property name="JMSReplyTo" part="requestReplyTo" />
+ <jms:property name="JMSDeliveryMode" part="requestDeliveryMode" />
+ <jms:property name="JMSTimeToLive" part="requestTimeToLive" />
+ </input>
+ <output name="AddEntryJmsPropResponse">
+ </output>
+ </operation>
+ <operation name="addEntry">
+ <input name="AddEntryUserPropRequest">
+ <jms:property name="JMSDeliveryMode" part="requestDeliveryMode" />
+ <jms:property name="MyBooleanProperty" part="requestUPBoolean" />
+ <jms:property name="MyByteProperty" part="requestUPByte" />
+ <jms:property name="MyShortProperty" part="requestUPShort" />
+ <jms:property name="MyIntProperty" part="requestUPInt" />
+ <jms:property name="MyLongProperty" part="requestUPLong" />
+ <jms:property name="MyFloatProperty" part="requestUPFloat" />
+ <jms:property name="MyDoubleProperty" part="requestUPDouble" />
+ <jms:property name="MyStringProperty" part="requestUPString" />
+ <jms:property name="MyObjectProperty" part="requestUPObject" />
+ </input>
+ <output name="AddEntryUserPropResponse">
+ </output>
+ </operation>
+ <operation name="getAddressFromName">
+ <input name="GetAddressFromNameRequest">
+ <jms:property name="JMSDeliveryMode" part="requestDeliveryMode" />
+ </input>
+ <output name="GetAddressFromNameResponse">
+ <jms:property name="userOutProperty1" part="userOutPropPart1" />
+ <jms:property name="userOutProperty2" part="userOutPropPart2" />
+ </output>
+ </operation>
+ </binding>
+
<!-- service decln -->
<service name="AddressBookService">
<port name="default" binding="tns:SOAPJmsBinding">
@@ -857,6 +907,13 @@
</jms:address>
</port>
<port name="NJtimeout" binding="tns:NativeJmsBinding">
+ <jms:address jmsProviderDestinationName="SYSTEM.DEAD.LETTER.QUEUE"
+ destinationStyle="queue"
+ jndiConnectionFactoryName="WSIFSampleQCF"
+ initialContextFactory="com.sun.jndi.fscontext.RefFSContextFactory"
+ jndiProviderURL="file:///JNDI-Directory"/>
+ </port>
+ <port name="SSOutProperties" binding="tns:SSOutProperties">
<jms:address jmsProviderDestinationName="SYSTEM.DEAD.LETTER.QUEUE"
destinationStyle="queue"
jndiConnectionFactoryName="WSIFSampleQCF"
No revision
No revision
1.1.2.1 +3 -2 xml-axis-wsif/java/test/jms/ServerSidePropertiesTest.java
Index: ServerSidePropertiesTest.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/jms/ServerSidePropertiesTest.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- ServerSidePropertiesTest.java 18 Mar 2003 17:53:01 -0000 1.1
+++ ServerSidePropertiesTest.java 18 Mar 2003 17:57:23 -0000 1.1.2.1
@@ -87,8 +87,7 @@
* @author Ant Elder <an...@uk.ibm.com>
*/
public class ServerSidePropertiesTest extends TestCase {
- String wsdlLocation =
- TestUtilities.getWsdlPath("java\\test\\jms") + "jms2.wsdl";
+ String wsdlLocation = TestUtilities.getWsdlPath("java\\test\\jms") + "jms.wsdl";
public ServerSidePropertiesTest(String name) {
super(name);
@@ -166,3 +165,5 @@
}
}
+
+
No revision
No revision
1.5.2.4 +10 -4 xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSProperties.java
Index: WSIFJMSProperties.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSProperties.java,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- WSIFJMSProperties.java 18 Nov 2002 15:46:06 -0000 1.5.2.3
+++ WSIFJMSProperties.java 18 Mar 2003 17:57:23 -0000 1.5.2.4
@@ -137,7 +137,7 @@
public boolean set(MessageProducer producer, Message message)
throws WSIFException {
Trc.entry(this, producer, message);
- if (direction != IN)
+ if (producer != null && direction != IN)
throw new WSIFException("Only input properties can be set on a MessageProducer");
if (isEmpty()) {
@@ -158,14 +158,18 @@
} else if (prop.equals(DELIVERYMODE)) {
message.setJMSDeliveryMode(
((Integer) value).intValue());
- producer.setDeliveryMode(((Integer) value).intValue());
+ if (producer != null) {
+ producer.setDeliveryMode(((Integer) value).intValue());
+ }
} else if (prop.equals(DESTINATION)) {
message.setJMSDestination((Destination) value);
} else if (prop.equals(EXPIRATION)) {
message.setJMSExpiration(((Long) value).longValue());
} else if (prop.equals(PRIORITY)) {
message.setJMSPriority(((Integer) value).intValue());
- producer.setPriority(((Integer) value).intValue());
+ if (producer != null) {
+ producer.setPriority(((Integer) value).intValue());
+ }
} else if (prop.equals(REDELIVERED)) {
message.setJMSRedelivered(
((Boolean) value).booleanValue());
@@ -174,7 +178,9 @@
} else if (prop.equals(TIMESTAMP)) {
message.setJMSTimestamp(((Long) value).longValue());
} else if (prop.equals(TIMETOLIVE)) {
- producer.setTimeToLive(((Long) value).longValue());
+ if (producer != null) {
+ producer.setTimeToLive(((Long) value).longValue());
+ }
} else if(prop.equals(TYPE)) {
message.setJMSType((String)value);
}