Author: jkaputin
Date: Mon Dec 3 06:01:23 2007
New Revision: 600540
URL: http://svn.apache.org/viewvc?rev=600540&view=rev
Log:
WODEN-181
Added the getInterfaceMessageReferenceElement()
method to BindingMessageReferenceElement.
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingMessageReferenceImpl.java
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/BindingMessageReferenceElement.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingMessageReferenceElementTest.java
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingMessageReferenceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingMessageReferenceImpl.java?rev=600540&r1=600539&r2=600540&view=diff
==============================================================================
---
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingMessageReferenceImpl.java
(original)
+++
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingMessageReferenceImpl.java
Mon Dec 3 06:01:23 2007
@@ -16,19 +16,21 @@
*/
package org.apache.woden.internal.wsdl20;
-import org.apache.woden.types.NCName;
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.Binding;
import org.apache.woden.wsdl20.BindingMessageReference;
import org.apache.woden.wsdl20.BindingOperation;
-import org.apache.woden.wsdl20.Binding;
import org.apache.woden.wsdl20.InterfaceMessageReference;
import org.apache.woden.wsdl20.InterfaceOperation;
import org.apache.woden.wsdl20.enumeration.Direction;
-import org.apache.woden.wsdl20.xml.BindingMessageReferenceElement;
-
-import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
import org.apache.woden.wsdl20.fragids.BindingMessageReferencePart;
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.xml.BindingMessageReferenceElement;
+import org.apache.woden.wsdl20.xml.BindingOperationElement;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
/**
* This class represents the BindingMessageReference component of the
* WSDL 2.0 Component model and the <input> and <output>
@@ -137,6 +139,43 @@
*/
public NCName getMessageLabel() {
return fMessageLabel;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.woden.wsdl20.xml.BindingMessageReferenceElement#getInterfaceMessageReferenceElement()
+ */
+ public InterfaceMessageReferenceElement
getInterfaceMessageReferenceElement() {
+ InterfaceMessageReferenceElement intMsgRef = null;
+ BindingOperationElement bindOp =
(BindingOperationElement)getParentElement();
+ InterfaceOperationElement intOp =
bindOp.getInterfaceOperationElement();
+ if(intOp != null)
+ {
+ //Determine the "effective" msg label for this binding msg ref.
+ NCName effectiveMsgLabel = null;
+ if(fMessageLabel != null)
+ {
+ effectiveMsgLabel = fMessageLabel;
+ }
+ else
+ {
+ //TODO: implement placeholder effective msg label, as per Part
1 of spec section 2.10.3
+ }
+
+ //Now match the effective msg label against the msg label of an
interface msg reference.
+ if(effectiveMsgLabel != null)
+ {
+ InterfaceMessageReferenceElement[] intMsgRefs =
intOp.getInterfaceMessageReferenceElements();
+ for(int i=0; i<intMsgRefs.length; i++)
+ {
+ if(
effectiveMsgLabel.equals(intMsgRefs[i].getMessageLabel()) )
+ {
+ intMsgRef = intMsgRefs[i];
+ break;
+ }
+ }
+ }
+ }
+ return intMsgRef;
}
/*
Modified:
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/BindingMessageReferenceElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/BindingMessageReferenceElement.java?rev=600540&r1=600539&r2=600540&view=diff
==============================================================================
---
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/BindingMessageReferenceElement.java
(original)
+++
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/BindingMessageReferenceElement.java
Mon Dec 3 06:01:23 2007
@@ -68,4 +68,16 @@
* @return NCName the message label
*/
public NCName getMessageLabel();
-}
+
+ /**
+ * Return the InterfaceMessageReferenceElement associated with this
BindingMessageReferenceElement.
+ * This equates to an <input> or <output> element of the
interface operation being
+ * bound whose message label is equal to the effective message label of
this binding message
+ * reference.
+ * If such an element does not exist, this method will return null.
+ *
+ * @return the InterfaceMessageReferenceElement
+ */
+ public InterfaceMessageReferenceElement
getInterfaceMessageReferenceElement();
+
+ }
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingMessageReferenceElementTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingMessageReferenceElementTest.java?rev=600540&r1=600539&r2=600540&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingMessageReferenceElementTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingMessageReferenceElementTest.java
Mon Dec 3 06:01:23 2007
@@ -16,10 +16,14 @@
*/
package org.apache.woden.wsdl20.xml;
+import javax.xml.namespace.QName;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.woden.WSDLException;
+import org.apache.woden.WSDLFactory;
import org.apache.woden.internal.wsdl20.BindingMessageReferenceImpl;
import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.enumeration.Direction;
@@ -80,4 +84,41 @@
assertEquals("The retrieved messageLabel is not that which was
set",
messageRefNCName,
fMessageReference.getMessageLabel());
}
+
+ /*
+ * Test that the associated InterfaceMessageReferenceElement can be
retrieved.
+ */
+ public void testGetInterfaceMessageReferenceElement()
+ {
+ WSDLFactory factory = null;
+ try {
+ factory = WSDLFactory.newInstance();
+ } catch (WSDLException e) {
+ fail("Can't instantiate the WSDLFactory object.");
+ }
+
+ DescriptionElement descriptionElement = factory.newDescription();
+
+ // Create the
BindingElement->InterfaceElement->InterfaceOperationElement->InterfaceMessageReferenceElement
+ BindingElement bindingElement = descriptionElement.addBindingElement();
+ bindingElement.setInterfaceName(new QName("interface1"));
+
+ InterfaceElement interfaceElement =
descriptionElement.addInterfaceElement();
+ interfaceElement.setName(new NCName("interface1"));
+
+ InterfaceOperationElement ifopElement =
interfaceElement.addInterfaceOperationElement();
+ ifopElement.setName(new NCName("operation1"));
+ InterfaceMessageReferenceElement ifmrElement =
ifopElement.addInterfaceMessageReferenceElement();
+ ifmrElement.setMessageLabel(new NCName("input1MessageLabel"));
+
+ // Create the BindingOperationElement->BindingMessageReferenceElement
+ BindingOperationElement bopElement =
bindingElement.addBindingOperationElement();
+ bopElement.setRef(new QName("operation1"));
+ fMessageReference = bopElement.addBindingMessageReferenceElement();
+ fMessageReference.setMessageLabel(new NCName("input1MessageLabel"));
+
+ InterfaceMessageReferenceElement retrievedMsgRef =
fMessageReference.getInterfaceMessageReferenceElement();
+ assertEquals("The InterfaceMessageReferenceElement is not the expected
one.",
+ ifmrElement, retrievedMsgRef);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]