Author: hughesj
Date: Wed Jun 14 03:36:32 2006
New Revision: 414181
URL: http://svn.apache.org/viewvc?rev=414181&view=rev
Log:
WODEN-25 WODEN-29
* For elements that have a name attribute which is defined as an NCName in the
spec I have ensured that for all org.apache.woden.internal.wsdl20.Xxx.setName()
where Xxx is a class containing a setName() method, setName() now takes an
NCName as parameter instead of a QName.
Fixing WODEN-25 meant fixing WODEN-29 at the same time - in order to fix
failing unit tests. Which means:
* getName() methods continue to return a QName as this is useful to the client
code. The namespace of the QName is now taken from the 'root parent'. So in
effect DescriptionElement.setTargetNamespace() changes the namespace of all
name attributes on XxxElement objects it contains.
* in order that a component's {name} property is a correct QName the associated
XxxElement must have been added to a DescriptionElement (or the relevant child
of a DescriptionElement). So for example if you want to
InterfaceOperation.getName() then the InterfaceOperationElement must have been
added to an InterfaceElement and that must have been added to a
DescriptionElement and setTargetNamespace() must have been called on the
DescriptionElement. If one of those hasn't happened the namespace of the QName
returned by getName() will be the empty string.
Modified:
incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/ServiceImpl.java
incubator/woden/java/src/org/apache/woden/wsdl20/xml/BindingElement.java
incubator/woden/java/src/org/apache/woden/wsdl20/xml/ConfigurableElement.java
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceFaultElement.java
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceOperationElement.java
incubator/woden/java/src/org/apache/woden/wsdl20/xml/ServiceElement.java
incubator/woden/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
incubator/woden/java/test/org/apache/woden/tests/W3CTestSuiteTest.java
incubator/woden/java/test/org/apache/woden/wsdl20/xml/ServiceElementTest.java
Modified: incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
(original)
+++ incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java Wed
Jun 14 03:36:32 2006
@@ -737,8 +737,7 @@
if(name != null)
{
- QName qname = new QName(desc.getTargetNamespace().toString(),
name);
- intface.setName(qname);
+ intface.setName(new NCName(name));
}
String styleDefault = DOMUtils.getAttribute(interfaceEl,
Constants.ATTR_STYLE_DEFAULT);
@@ -834,8 +833,7 @@
String ns = desc.getTargetNamespace() != null ?
desc.getTargetNamespace().toString() :
Constants.VALUE_EMPTY_STRING;
- QName qname = new QName(ns, name);
- fault.setName(qname);
+ fault.setName(new NCName(name));
}
String element = DOMUtils.getAttribute(faultEl,
Constants.ATTR_ELEMENT);
@@ -895,8 +893,7 @@
String name = DOMUtils.getAttribute(operEl, Constants.ATTR_NAME);
if(name != null)
{
- QName qname = new QName(desc.getTargetNamespace().toString(),
name);
- oper.setName(qname);
+ oper.setName(new NCName(name));
}
String style = DOMUtils.getAttribute(operEl, Constants.ATTR_STYLE);
@@ -1157,8 +1154,7 @@
String name = DOMUtils.getAttribute(bindEl, Constants.ATTR_NAME);
if(name != null)
{
- QName qname = new QName(desc.getTargetNamespace().toString(),
name);
- binding.setName(qname);
+ binding.setName(new NCName(name));
}
QName intfaceQN = null;
@@ -1528,8 +1524,7 @@
String name = DOMUtils.getAttribute(serviceEl, Constants.ATTR_NAME);
if(name != null)
{
- QName qname = new QName(desc.getTargetNamespace().toString(),
name);
- service.setName(qname);
+ service.setName(new NCName(name));
}
QName intfaceQN = null;
@@ -1601,8 +1596,7 @@
String name = DOMUtils.getAttribute(endpointEl, Constants.ATTR_NAME);
if(name != null)
{
- NCName ncname = new NCName(name);
- endpoint.setName(ncname);
+ endpoint.setName(new NCName(name));
}
QName bindingQN = null;
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java
(original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java
Wed Jun 14 03:36:32 2006
@@ -22,6 +22,7 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.Binding;
import org.apache.woden.wsdl20.BindingFault;
import org.apache.woden.wsdl20.BindingOperation;
@@ -56,7 +57,7 @@
*/
private Description fDescriptionComponent = null;
- private QName fName = null;
+ private NCName fName = null;
private QName fInterfaceName = null;
private URI fType = null;
private List fFaults = new Vector();
@@ -71,7 +72,12 @@
* @see org.apache.woden.wsdl20.xml.BindingElement#getName()
*/
public QName getName() {
- return fName;
+ QName name = null;
+ if (fName != null) {
+ String tns = DescriptionImpl.getTargetNamespace(this);
+ name = new QName(tns, fName.toString());
+ }
+ return name;
}
/* (non-Javadoc)
@@ -125,8 +131,11 @@
/* (non-Javadoc)
* @see
org.apache.woden.wsdl20.xml.BindingElement#setName(javax.xml.namespace.QName)
*/
- public void setName(QName qname) {
- fName = qname;
+ public void setName(NCName name) {
+ if (name == null) {
+ throw new IllegalArgumentException("name cannot be null.");
+ }
+ fName = new NCName(name.toString());
}
/* (non-Javadoc)
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
(original)
+++
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
Wed Jun 14 03:36:32 2006
@@ -48,9 +48,11 @@
import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+import org.apache.woden.wsdl20.xml.NestedElement;
import org.apache.woden.wsdl20.xml.PropertyElement;
import org.apache.woden.wsdl20.xml.ServiceElement;
import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
/**
* This class provides the implementation for a Description component from
@@ -679,5 +681,34 @@
collectIncludedDescriptions(descs, includedDesc);
}
}
+
+ /**
+ * Nested elements within a <code><description></code> have
attributes of type
+ * <i>xs:NCName</i>. The setter method for the attribute will take an
NCName object as
+ * the input parameter. However, to be useful, the getter method returns a
QName. The
+ * namespace within the QName has to be the targetNamespace of the
<code><description></code>
+ * element. This method provides a way to retrieve the targetNamespace of
the
+ * enclosing <code><description></code> element.
+ * @param wElem instance of WSDLElement for which the targetNamespace is
required
+ * @return the targetNamespace of the DescriptionElement that is the root
element of wElem
+ */
+ static String getTargetNamespace(WSDLElement wElem) {
+ String namespace = "";
+
+ if (wElem instanceof NestedElement) {
+ WSDLElement parent = ((NestedElement)wElem).getParentElement();
+ return getTargetNamespace(parent);
+ }
+ if (wElem instanceof DescriptionElement) {
+ URI tns = ((DescriptionElement)wElem).getTargetNamespace();
+ if (tns != null) {
+ namespace = tns.toString();
+ }
+ return namespace;
+ }
+ // Huh!
+ throw new RuntimeException("dunno");
+ }
+
}
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
(original)
+++
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
Wed Jun 14 03:36:32 2006
@@ -17,6 +17,7 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.Description;
import org.apache.woden.wsdl20.ElementDeclaration;
import org.apache.woden.wsdl20.Interface;
@@ -38,7 +39,7 @@
InterfaceFaultElement
{
//WSDL Component model data
- private QName fName = null;
+ private NCName fName = null;
private ElementDeclaration fElementDeclaration = null;
//XML Element model data
@@ -54,7 +55,12 @@
*/
public QName getName()
{
- return fName;
+ QName name = null;
+ if (fName != null) {
+ String tns = DescriptionImpl.getTargetNamespace(this);
+ name = new QName(tns, fName.toString());
+ }
+ return name;
}
/*
@@ -79,11 +85,14 @@
* ************************************************************/
/*
- * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#setName(QName)
+ * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#setName(NCName)
*/
- public void setName(QName qname)
+ public void setName(NCName name)
{
- fName = qname;
+ if (name == null) {
+ throw new IllegalArgumentException("name cannot be null.");
+ }
+ fName = new NCName(name.toString());
}
/*
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
(original)
+++
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
Wed Jun 14 03:36:32 2006
@@ -24,6 +24,7 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.Description;
import org.apache.woden.wsdl20.Interface;
import org.apache.woden.wsdl20.InterfaceFault;
@@ -59,7 +60,7 @@
*/
private Description fDescriptionComponent = null;
- private QName fName = null;
+ private NCName fName = null;
private List fExtends = new Vector();
private List fStyleDefault = new Vector();
private List fInterfaceFaultElements = new Vector();
@@ -75,7 +76,12 @@
*/
public QName getName()
{
- return fName;
+ QName name = null;
+ if (fName != null) {
+ String tns = DescriptionImpl.getTargetNamespace(this);
+ name = new QName(tns, fName.toString());
+ }
+ return name;
}
/*
@@ -163,7 +169,8 @@
Interface other = (Interface)comp;
//compare {name}
- if(fName != null && !fName.equals(other.getName())) return false;
+ QName myName = getName();
+ if(myName != null && !myName.equals(other.getName())) return false;
/* To compare {extended interfaces} we cannot just retrieve and
compare the two sets
* of extended Interface components because we'd enter a recursive
loop. To get the
@@ -200,11 +207,16 @@
* ************************************************************/
/*
- * @see org.apache.woden.wsdl20.xml.InterfaceElement#setName(QName)
+ * @see org.apache.woden.wsdl20.xml.InterfaceElement#setName(NCName)
*/
- public void setName(QName qname)
- {
- fName = qname;
+ // TODO: need to store NCName and not QName because it is valid for somone
+ // to create an InterfaceImpl and set the name without first having added
+ // the interfaceimpl to the DescriptionElement.
+ public void setName(NCName name) {
+ if (name == null) {
+ throw new IllegalArgumentException("name cannot be null.");
+ }
+ fName = new NCName(name.toString());
}
/*
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java
(original)
+++
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java
Wed Jun 14 03:36:32 2006
@@ -21,6 +21,7 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.InterfaceFaultReference;
import org.apache.woden.wsdl20.InterfaceMessageReference;
import org.apache.woden.wsdl20.InterfaceOperation;
@@ -39,7 +40,7 @@
InterfaceOperationElement
{
//Component data
- private QName fName = null;
+ private NCName fName = null;
private URI fMessageExchangePattern = null;
private List fStyle = new Vector();
@@ -57,7 +58,12 @@
*/
public QName getName()
{
- return fName;
+ QName name = null;
+ if (fName != null) {
+ String tns = DescriptionImpl.getTargetNamespace(this);
+ name = new QName(tns, fName.toString());
+ }
+ return name;
}
/* (non-Javadoc)
@@ -111,11 +117,14 @@
* ************************************************************/
/*
- * @see
org.apache.woden.wsdl20.xml.InterfaceOperationElement#setName(QName)
+ * @see
org.apache.woden.wsdl20.xml.InterfaceOperationElement#setName(NCName)
*/
- public void setName(QName qname)
+ public void setName(NCName name)
{
- fName = qname;
+ if (name == null) {
+ throw new IllegalArgumentException("name cannot be null.");
+ }
+ fName = new NCName(name.toString());
}
/*
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/ServiceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/ServiceImpl.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/ServiceImpl.java
(original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/ServiceImpl.java
Wed Jun 14 03:36:32 2006
@@ -54,7 +54,7 @@
*/
private Description fDescriptionComponent = null;
- private QName fName = null;
+ private NCName fName = null;
private QName fInterfaceName = null;
private List fEndpoints = new Vector();
@@ -67,7 +67,12 @@
* @see org.apache.woden.wsdl20.xml.ServiceElement#getName()
*/
public QName getName() {
- return fName;
+ QName name = null;
+ if (fName != null) {
+ String tns = DescriptionImpl.getTargetNamespace(this);
+ name = new QName(tns, fName.toString());
+ }
+ return name;
}
/* (non-Javadoc)
@@ -126,10 +131,13 @@
* ************************************************************/
/* (non-Javadoc)
- * @see
org.apache.woden.wsdl20.xml.ServiceElement#setName(javax.xml.namespace.QName)
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#setName(NCName)
*/
- public void setName(QName qname) {
- fName = qname;
+ public void setName(NCName name) {
+ if (name == null) {
+ throw new IllegalArgumentException("name cannot be null.");
+ }
+ fName = new NCName(name.toString());
}
/* (non-Javadoc)
Modified:
incubator/woden/java/src/org/apache/woden/wsdl20/xml/BindingElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/wsdl20/xml/BindingElement.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/wsdl20/xml/BindingElement.java
(original)
+++ incubator/woden/java/src/org/apache/woden/wsdl20/xml/BindingElement.java
Wed Jun 14 03:36:32 2006
@@ -19,6 +19,8 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
+
/**
* This interface represents a WSDL <binding> element.
*
@@ -33,12 +35,12 @@
*/
/**
- * Set the QName that represents the <tt>name</tt> attribute of the
+ * Set the NCName that represents the <tt>name</tt> attribute of the
* <binding> element.
*
- * @param qname the QName that identifies the binding.
+ * @param name the NCName that identifies the binding.
*/
- public void setName(QName qname);
+ public void setName(NCName name);
public QName getName();
/**
Modified:
incubator/woden/java/src/org/apache/woden/wsdl20/xml/ConfigurableElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/wsdl20/xml/ConfigurableElement.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/wsdl20/xml/ConfigurableElement.java
(original)
+++
incubator/woden/java/src/org/apache/woden/wsdl20/xml/ConfigurableElement.java
Wed Jun 14 03:36:32 2006
@@ -37,5 +37,5 @@
public void addPropertyElement(PropertyElement property);
public PropertyElement[] getPropertyElements();
//TODO a remove method
-
+
}
Modified:
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java
(original)
+++ incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java
Wed Jun 14 03:36:32 2006
@@ -19,6 +19,8 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
+
/**
* This interface represents a <interface> XML element
* information item. It declares the behaviour required to support
@@ -34,7 +36,7 @@
* Attributes
*/
- public void setName(QName qname);
+ public void setName(NCName name);
public QName getName();
public void addExtendedInterfaceName(QName qname);
Modified:
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceFaultElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceFaultElement.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceFaultElement.java
(original)
+++
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceFaultElement.java
Wed Jun 14 03:36:32 2006
@@ -17,6 +17,7 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
import org.apache.ws.commons.schema.XmlSchemaElement;
/**
@@ -35,9 +36,9 @@
* Set the QName that represens the 'name' attribute of the interface
* <fault> element. This identifies the interface fault.
*
- * @param qname the QName that identifies the interface fault
+ * @param name the NCName that identifies the interface fault
*/
- public void setName(QName qname);
+ public void setName(NCName name);
public QName getName();
/**
Modified:
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceOperationElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceOperationElement.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceOperationElement.java
(original)
+++
incubator/woden/java/src/org/apache/woden/wsdl20/xml/InterfaceOperationElement.java
Wed Jun 14 03:36:32 2006
@@ -19,6 +19,8 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
+
/**
* This interface represents an <operation> child element
* of the WSDL <interface> element.
@@ -35,7 +37,7 @@
* Attributes
*/
- public void setName(QName qname);
+ public void setName(NCName name);
public QName getName();
public void setPattern(URI uri);
Modified:
incubator/woden/java/src/org/apache/woden/wsdl20/xml/ServiceElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/wsdl20/xml/ServiceElement.java?rev=414181&r1=414180&r2=414181&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/wsdl20/xml/ServiceElement.java
(original)
+++ incubator/woden/java/src/org/apache/woden/wsdl20/xml/ServiceElement.java
Wed Jun 14 03:36:32 2006
@@ -17,6 +17,8 @@
import javax.xml.namespace.QName;
+import org.apache.woden.types.NCName;
+
/**
* This interface represents the <service> element.
*
@@ -26,7 +28,7 @@
ConfigurableElement,
NestedElement
{
- public void setName(QName qname);
+ public void setName(NCName name);
public QName getName();
public void setInterfaceName(QName qname);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]