You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by ry...@apache.org on 2006/04/15 00:08:04 UTC

svn commit: r394211 - /incubator/woden/java/src/org/apache/woden/wsdl20/interchange/WsdlCm.java

Author: ryman
Date: Fri Apr 14 15:07:59 2006
New Revision: 394211

URL: http://svn.apache.org/viewcvs?rev=394211&view=rev
Log:
Initial version of writer for W3C WSDL 2.0 Component Model interchange format.

Added:
    incubator/woden/java/src/org/apache/woden/wsdl20/interchange/WsdlCm.java

Added: incubator/woden/java/src/org/apache/woden/wsdl20/interchange/WsdlCm.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/wsdl20/interchange/WsdlCm.java?rev=394211&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/wsdl20/interchange/WsdlCm.java (added)
+++ incubator/woden/java/src/org/apache/woden/wsdl20/interchange/WsdlCm.java Fri Apr 14 15:07:59 2006
@@ -0,0 +1,897 @@
+/**
+ * Copyright 2006 Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.woden.wsdl20.interchange;
+
+/**
+ * This class writes a Woden WSDL 2.0 component model instance in the W3C interchange format
+ * which is an XML vocabulary for serializing component model instances in a canonical way so
+ * that different implementations can be easily compared for interoperability.
+ * 
+ * The schema for this format is available at the following URL:
+ * 
+ * http://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/interchange/wsdlcm.xsd?rev=1.1&content-type=text/xml
+ * 
+ * @author ryman@ca.ibm.com, aka arthur-ryman@gmail.com
+ */
+
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Stack;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.WSDLReader;
+import org.apache.woden.internal.ReaderFeatures;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.Binding;
+import org.apache.woden.wsdl20.BindingFault;
+import org.apache.woden.wsdl20.BindingFaultReference;
+import org.apache.woden.wsdl20.BindingMessageReference;
+import org.apache.woden.wsdl20.BindingOperation;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.woden.wsdl20.Endpoint;
+import org.apache.woden.wsdl20.Feature;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.InterfaceFault;
+import org.apache.woden.wsdl20.InterfaceFaultReference;
+import org.apache.woden.wsdl20.InterfaceMessageReference;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.Property;
+import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.TypeDefinition;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+
+public class WsdlCm {
+
+	private PrintWriter out;
+
+	private int indentation = 2;
+
+	private Stack tags = new Stack();
+
+	/** XML namespace */
+	public static String NS = "http://www.w3.org/2002/ws/desc/wsdl/component";
+
+	public WsdlCm(PrintWriter out) {
+
+		this.out = out;
+	}
+
+	private void indent() {
+
+		for (int i = 0; i < tags.size(); i++) {
+			for (int j = 0; j < indentation; j++) {
+				out.write(' ');
+			}
+		}
+	}
+
+	private void beginElement(String tag) {
+
+		beginElement(tag, "");
+	}
+
+	private void beginElement(String tag, String attributes) {
+
+		indent();
+		if (attributes.length() == 0) {
+			out.println("<" + tag + ">");
+
+		} else {
+			out.println("<" + tag + " " + attributes + ">");
+		}
+		tags.push(tag);
+	}
+
+	private void endElement() {
+
+		String tag = (String) tags.pop();
+		indent();
+		out.println("</" + tag + ">");
+	}
+
+	private void element(String tag, String content) {
+
+		indent();
+		out.println("<" + tag + ">" + content + "</" + tag + ">");
+	}
+
+	private void emptyElement(String tag, String attributes) {
+
+		indent();
+		out.println("<" + tag + " " + attributes + "/>");
+	}
+
+	public static void main(String[] args) {
+
+		// simple program to read a WSDL 2.0 file and then poke at the component
+		// model.
+
+		String wsdlLoc = "file:///D:/workspaces/woden-m4-test/test-project/test.wsdl";
+		String wsdlCmLoc = "D:\\workspaces\\woden-m4-test\\test-project\\test.xml";
+
+		System.out.println("Starting: " + wsdlLoc);
+
+		try {
+
+			WSDLFactory factory = WSDLFactory.newInstance();
+			WSDLReader reader = factory.newWSDLReader();
+
+			// <-- enable WSDL 2.0 validation (optional)
+			reader.setFeature(ReaderFeatures.VALIDATION_FEATURE_ID, true);
+
+			// <-- the <description> element
+			DescriptionElement desc = reader.readWSDL(wsdlLoc);
+
+			// <-- the Description component
+			Description descComp = desc.toComponent();
+
+			File xml = new File(wsdlCmLoc);
+			FileOutputStream fos = new FileOutputStream(xml);
+			PrintWriter out = new PrintWriter(fos);
+			WsdlCm wsdlCm = new WsdlCm(out);
+			wsdlCm.write(descComp);
+			out.flush();
+
+		} catch (WSDLException e) {
+
+			e.printStackTrace();
+		} catch (FileNotFoundException e) {
+
+			e.printStackTrace();
+		}
+
+		System.out.println("Finished.");
+
+	}
+
+	public void write(Description component) {
+
+		String attributes = "xmlns='" + NS + "'" + " " + idAttribute(component);
+		beginElement("descriptionComponent", attributes);
+
+		write("interfaces", component.getInterfaces());
+		write("bindings", component.getBindings());
+		write("services", component.getServices());
+		write("elementDeclarations", component.getElementDeclarations());
+		write("typeDefinitions", component.getTypeDefinitions());
+
+		endElement();
+	}
+
+	private void writeRefs(String tag, Interface[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((Interface) o1).getName();
+				QName x2 = ((Interface) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++) {
+			writeRef("interface", components[i]);
+		}
+
+		endElement();
+
+	}
+
+	private void write(String tag, Interface[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((Interface) o1).getName();
+				QName x2 = ((Interface) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("interfaceComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, Interface component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("name", component.getName());
+		writeRefs("extendedInterfaces", component.getExtendedInterfaces());
+		write("interfaceFaults", component.getInterfaceFaults());
+		write("interfaceOperations", component.getInterfaceOperations());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceFault[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((Interface) o1).getName();
+				QName x2 = ((Interface) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("interfaceFaultComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceFault component) {
+
+		beginElement("interfaceFaultComponent", idAttribute(component));
+
+		write("name", component.getName());
+		writeRef("elementDeclaration", component.getElementDeclaration());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceOperation[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((Interface) o1).getName();
+				QName x2 = ((Interface) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("interfaceOperationComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceOperation component) {
+
+		beginElement("interfaceOperationComponent", idAttribute(component));
+
+		write("name", component.getName());
+		write("messageExchangePattern", component.getMessageExchangePattern());
+		write("interfaceMessageReferences", component
+				.getInterfaceMessageReferences());
+		write("interfaceFaultReferences", component
+				.getInterfaceFaultReferences());
+		writeUris("style", component.getStyle());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceMessageReference[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				String x1 = ((InterfaceMessageReference) o1).getMessageLabel()
+						.toString();
+				String x2 = ((InterfaceMessageReference) o2).getMessageLabel()
+						.toString();
+				return x1.compareTo(x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("interfaceMessageReferenceComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceMessageReference component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("messageLabel", component.getMessageLabel().toString());
+		write("direction", component.getDirection().toString());
+		write("messageContentModel", component.getMessageContentModel());
+		writeRef("elementDeclaration", component.getElementDeclaration());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceFaultReference[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+
+				InterfaceFaultReference i1 = (InterfaceFaultReference) o1;
+				InterfaceFaultReference i2 = (InterfaceFaultReference) o2;
+
+				QName q1 = i1.getInterfaceFault().getName();
+				QName q2 = i2.getInterfaceFault().getName();
+
+				int result = compareQName(q1, q2);
+				if (result != 0)
+					return result;
+
+				String x1 = i1.getMessageLabel().toString();
+				String x2 = i2.getMessageLabel().toString();
+				return x1.compareTo(x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("interfaceFaultReferenceComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, InterfaceFaultReference component) {
+
+		beginElement(tag, idAttribute(component));
+
+		writeRef("interfaceFault", component.getInterfaceFault());
+		write("messageLabel", component.getMessageLabel().toString());
+		write("direction", component.getDirection().toString());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, Binding[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((Binding) o1).getName();
+				QName x2 = ((Binding) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("bindingComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, Binding component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("name", component.getName());
+		writeRef("interface", component.getInterface());
+		write("type", component.getType());
+		write("bindingFaults", component.getBindingFaults());
+		write("bindingOperations", component.getBindingOperations());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+
+		endElement();
+	}
+
+	private void write(String tag, BindingFault[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((BindingFault) o1).getInterfaceFault().getName();
+				QName x2 = ((BindingFault) o1).getInterfaceFault().getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("bindingFaultComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, BindingFault component) {
+
+		beginElement(tag, idAttribute(component));
+
+		writeRef("interfaceFault", component.getInterfaceFault());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, BindingOperation[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((BindingOperation) o1).getInterfaceOperation()
+						.getName();
+				QName x2 = ((BindingOperation) o1).getInterfaceOperation()
+						.getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("bindingOperationComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, BindingOperation component) {
+
+		beginElement(tag, idAttribute(component));
+
+		writeRef("interfaceOperation", component.getInterfaceOperation());
+		write("bindingFaultReferences", component.getBindingFaultReferences());
+		write("bindingMessageReferences", component
+				.getBindingMessageReferences());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, BindingMessageReference[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+
+				InterfaceMessageReference i1 = ((BindingMessageReference) o1)
+						.getInterfaceMessageReference();
+				InterfaceMessageReference i2 = ((BindingMessageReference) o2)
+						.getInterfaceMessageReference();
+
+				String x1 = i1.getMessageLabel().toString();
+				String x2 = i2.getMessageLabel().toString();
+				return x1.compareTo(x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("bindingMessageReferenceComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, BindingMessageReference component) {
+
+		beginElement(tag, idAttribute(component));
+
+		writeRef("interfaceMessageReference", component
+				.getInterfaceMessageReference());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, BindingFaultReference[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+
+				InterfaceFaultReference i1 = ((BindingFaultReference) o1)
+						.getInterfaceFaultReference();
+				InterfaceFaultReference i2 = ((BindingFaultReference) o2)
+						.getInterfaceFaultReference();
+
+				QName q1 = i1.getInterfaceFault().getName();
+				QName q2 = i2.getInterfaceFault().getName();
+
+				int result = compareQName(q1, q2);
+				if (result != 0)
+					return result;
+
+				String x1 = i1.getMessageLabel().toString();
+				String x2 = i2.getMessageLabel().toString();
+				return x1.compareTo(x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("bindingFaultReferenceComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, BindingFaultReference component) {
+
+		beginElement(tag, idAttribute(component));
+
+		writeRef("interfaceFaultReference", component.getInterfaceFaultReference());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, Service[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((Service) o1).getName();
+				QName x2 = ((Service) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("serviceComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, Service component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("name", component.getName());
+		writeRef("interface", component.getInterface());
+		write("endpoints", component.getEndpoints());
+		write("features", component.getFeatures());
+		write("properties", component.getProperties());
+
+		endElement();
+	}
+
+	private void write(String tag, Endpoint[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				String x1 = ((Endpoint) o1).getName().toString();
+				String x2 = ((Endpoint) o2).getName().toString();
+				return x1.compareTo(x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++) {
+			write("endpointComponent", components[i]);
+		}
+
+		endElement();
+
+	}
+
+	private void write(String tag, Endpoint component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("name", component.getName());
+		writeRef("binding", component.getBinding());
+		write("address", component.getAddress());
+		write("feaures", component.getFeatures());
+		write("properties", component.getProperties());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, ElementDeclaration[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((ElementDeclaration) o1).getName();
+				QName x2 = ((ElementDeclaration) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("elementDeclarationComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, ElementDeclaration component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("name", component.getName());
+		write("system", component.getSystem());
+
+		endElement();
+	}
+
+	private void write(String tag, TypeDefinition[] components) {
+
+		if (components.length == 0)
+			return;
+
+		Arrays.sort(components, new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				QName x1 = ((TypeDefinition) o1).getName();
+				QName x2 = ((TypeDefinition) o2).getName();
+				return compareQName(x1, x2);
+			}
+		});
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++)
+			write("typeDefinitionComponent", components[i]);
+
+		endElement();
+	}
+
+	private void write(String tag, TypeDefinition component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("name", component.getName());
+		write("system", component.getSystem());
+
+		endElement();
+	}
+
+	private void write(String tag, Feature[] components) {
+
+		if (components.length == 0)
+			return;
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++) {
+			write("featureComponent", components[i]);
+		}
+		endElement();
+	}
+
+	private void write(String tag, Feature component) {
+
+		beginElement(tag, idAttribute(component));
+		
+		write("ref", component.getRef());
+		write("required", component.isRequired());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, Property[] components) {
+
+		if (components.length == 0)
+			return;
+
+		beginElement(tag);
+
+		for (int i = 0; i < components.length; i++) {
+			write("propertyComponent", components[i]);
+		}
+
+		endElement();
+	}
+
+	private void write(String tag, Property component) {
+
+		beginElement(tag, idAttribute(component));
+
+		write("ref", component.getRef());
+		writeRef("valueConstraint", component.getValueConstraint());
+		writeAny("value", component.getValue());
+		writeRef("parent", component.getParent());
+
+		endElement();
+	}
+
+	private void write(String tag, NCName ncname) {
+
+		if (ncname == null)
+			return;
+
+		element(tag, ncname.toString());
+	}
+
+	private void write(String tag, String content) {
+
+		if (content == null)
+			return;
+
+		element(tag, content);
+	}
+	
+	private void write(String tag, boolean value) {
+		
+		element(tag, value ? "true" : "false");
+	}
+
+	private void write(String tag, QName qname) {
+
+		if (qname == null)
+			return;
+
+		beginElement(tag);
+
+		element("namespaceName", qname.getNamespaceURI());
+		element("localName", qname.getLocalPart());
+
+		endElement();
+	}
+	
+	private void write(String tag, URI uri) {
+
+		if (uri == null)
+			return;
+
+		element(tag, uri.toString());
+	}
+
+	private void writeAny(String tag, Object o) {
+		
+		if (o == null) return;
+		
+		// TODO: write element content correctly
+		element(tag, o.toString());
+	}
+
+	private void writeRef(String tag, Object o) {
+
+		if (o == null)
+			return;
+
+		emptyElement(tag, refAttribute(o));
+	}
+
+	private void writeUris(String tag, URI[] uris) {
+
+		if (uris.length == 0)
+			return;
+
+		beginElement(tag);
+
+		for (int i = 0; i < uris.length; i++)
+			write("uri", uris[i]);
+
+		endElement();
+	}
+
+	private static String id(Object o) {
+
+		if (o == null) {
+			return "id-null";
+		}
+
+		return "id-" + o.hashCode();
+	}
+
+	private static String idAttribute(Object o) {
+
+		return "xml:id='" + id(o) + "'";
+	}
+
+	private static String refAttribute(Object o) {
+
+		return "ref='" + id(o) + "'";
+	}
+
+	private static int compareQName(QName q1, QName q2) {
+
+		if (q1.equals(q2))
+			return 0;
+
+		String n1 = q1.getNamespaceURI();
+		String n2 = q2.getNamespaceURI();
+		if (n1.equals(n2)) {
+			String l1 = q1.getLocalPart();
+			String l2 = q2.getLocalPart();
+
+			return l1.compareTo(l2);
+		} else {
+			return n1.compareTo(n2);
+		}
+	}
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org