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 jk...@apache.org on 2007/08/29 16:41:15 UTC
svn commit: r570822 - in /incubator/woden/trunk/java:
src/org/apache/woden/wsdl20/fragids/ src/org/apache/woden/xpointer/
test/org/apache/woden/wsdl20/fragids/
Author: jkaputin
Date: Wed Aug 29 07:41:12 2007
New Revision: 570822
URL: http://svn.apache.org/viewvc?rev=570822&view=rev
Log:
WODEN-32
Applied patch to use NS prefixes 'ns1, ns2, ...'
instead of actual infoset prefixes and improve javadoc.
Modified:
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/BindingPart.java
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/EndpointPart.java
incubator/woden/trunk/java/src/org/apache/woden/xpointer/XPointer.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java
Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/BindingPart.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/BindingPart.java?rev=570822&r1=570821&r2=570822&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/BindingPart.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/BindingPart.java Wed Aug 29 07:41:12 2007
@@ -66,23 +66,6 @@
return "wsdl.binding(" + binding + ")";
}
- /**
- * An Idea...
- *
- * @param string
- * @return
- */
- public static BindingPart fromString(String string) {
- //Properties to parse.
- NCName binding;
-
- //Parse and get values.
- binding = new NCName(string);
-
- //Return new BindingPart.
- return new BindingPart(binding);
- }
-
public void prefixNamespaces(XPointer xpointer) {
//This PointerPart does not have any namespaces.
}
Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/EndpointPart.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/EndpointPart.java?rev=570822&r1=570821&r2=570822&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/EndpointPart.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/fragids/EndpointPart.java Wed Aug 29 07:41:12 2007
@@ -35,7 +35,7 @@
* Constructs an EndpointPart class from the values given.
*
* @param service the local name of the parent Service component.
- * @param service the name of the Endpoint component.
+ * @param endpoint the name of the Endpoint component.
* @throws IllegalArgumentException if service or endpoint are null.
*/
public EndpointPart(NCName service, NCName endpoint) {
Modified: incubator/woden/trunk/java/src/org/apache/woden/xpointer/XPointer.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/xpointer/XPointer.java?rev=570822&r1=570821&r2=570822&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/xpointer/XPointer.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/xpointer/XPointer.java Wed Aug 29 07:41:12 2007
@@ -92,7 +92,7 @@
* @return a NCName of the prefix for the namespace.
*/
public NCName getXmlNamespacePrefix(QName qname) {
- return getXmlNamespacePrefix(qname.getNamespaceURI() , new NCName(qname.getPrefix()));
+ return getXmlNamespacePrefix(qname.getNamespaceURI());
}
/**
@@ -104,19 +104,6 @@
* @return a NCName of the prefix for the namespace.
*/
public NCName getXmlNamespacePrefix(String namespace) {
- return getXmlNamespacePrefix(namespace, null);
- }
-
- /**
- * Returns the prefix for the Xml namespace in the XPointer.
- * If the namespace does not have a prefix in the XPointer it will create a new prefix
- * with the prefix given or one of the form nsXX and add a xmlns Pointer Part, then return that.
- *
- * @param namespace The namespace to get the prefix for.
- * @param defaultPrefix The default prefix name to use if a prefix does not already exist.
- * @return a NCName of the prefix for the namespace.
- */
- public NCName getXmlNamespacePrefix(String namespace, NCName defaultPrefix) {
//If its the xml namespace no prefix is needed.
if (namespace.equals(NS_URI_XML)) {
return emptyNCName;
@@ -128,19 +115,12 @@
//Lookup prefix
NCName prefix = (NCName)xmlnses.get(namespace);
if (prefix == null) {
- //The namespace does not have a prefix let so lets add one.
- //Find name a valid prefix name that isn't used and is not xml or xmlns.
- if (defaultPrefix != null && !defaultPrefix.toString().equals("") && !defaultPrefix.equals("xml") && !defaultPrefix.equals("xmlns") && !xmlnses.containsValue(defaultPrefix)) {
- //Use default prefix given
- prefix = defaultPrefix;
- } else {
- //Find next available nsXXX prefix
- prefix = new NCName("ns" + Integer.toString(xmlnses.size()));
- for (int i = 1; xmlnses.containsKey(prefix); i++) {
- prefix = new NCName("ns" + Integer.toString(xmlnses.size() + i));
- }
+ //The namespace does not have a prefix yet so lets add one.
+ //Find next available nsXXX prefix
+ prefix = new NCName("ns" + Integer.toString(xmlnses.size()+1));
+ for (int i = 1; xmlnses.containsKey(prefix); i++) {
+ prefix = new NCName("ns" + Integer.toString(xmlnses.size() + i));
}
-
//Add prefix pointer part.
pointerParts.add(xmlnses.size(), new XmlnsPart(prefix, namespace));
Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java?rev=570822&r1=570821&r2=570822&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java Wed Aug 29 07:41:12 2007
@@ -57,17 +57,17 @@
assertEquals("wsdl.description()", desc.toString());
//Elements
- assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ghns:checkAvailability)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ns1:checkAvailability)",
desc.getElementDeclaration(new QName("http://greath.example.com/2004/schemas/resSvc","checkAvailability")).toString());
- assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ghns:checkAvailabilityResponse)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ns1:checkAvailabilityResponse)",
desc.getElementDeclaration(new QName("http://greath.example.com/2004/schemas/resSvc","checkAvailabilityResponse")).toString());
- assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ghns:invalidDataError)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ns1:invalidDataError)",
desc.getElementDeclaration(new QName("http://greath.example.com/2004/schemas/resSvc","invalidDataError")).toString());
//Types
- assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.typeDefinition(ghns:tCheckAvailability)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/schemas/resSvc)wsdl.typeDefinition(ns1:tCheckAvailability)",
desc.getTypeDefinition(new QName("http://greath.example.com/2004/schemas/resSvc","tCheckAvailability")).toString());
//Interface
@@ -86,26 +86,26 @@
assertEquals("wsdl.interfaceMessageReference(reservationInterface/opCheckAvailability/Out)",
desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).getInterfaceOperation(new QName("http://greath.example.com/2004/wsdl/resSvc", "opCheckAvailability")).getInterfaceMessageReferences()[1].toString());
- assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.interfaceFaultReference(reservationInterface/opCheckAvailability/Out/tns:invalidDataFault)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/wsdl/resSvc)wsdl.interfaceFaultReference(reservationInterface/opCheckAvailability/Out/ns1:invalidDataFault)",
desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).getInterfaceOperation(new QName("http://greath.example.com/2004/wsdl/resSvc", "opCheckAvailability", "tns")).getInterfaceFaultReferences()[0].toString());
//Binding
assertEquals("wsdl.binding(reservationSOAPBinding)",
desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).toString());
- assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingFault(reservationSOAPBinding/tns:invalidDataFault)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingFault(reservationSOAPBinding/ns1:invalidDataFault)",
desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingFaults()[0].toString());
- assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingOperation(reservationSOAPBinding/tns:opCheckAvailability)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingOperation(reservationSOAPBinding/ns1:opCheckAvailability)",
desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].toString());
- assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingMessageReference(reservationSOAPBinding/tns:opCheckAvailability/In)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingMessageReference(reservationSOAPBinding/ns1:opCheckAvailability/In)",
desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].getBindingMessageReferences()[0].toString());
- assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingMessageReference(reservationSOAPBinding/tns:opCheckAvailability/Out)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingMessageReference(reservationSOAPBinding/ns1:opCheckAvailability/Out)",
desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].getBindingMessageReferences()[1].toString());
- assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingFaultReference(reservationSOAPBinding/tns:opCheckAvailability/Out/tns:invalidDataFault)",
+ assertEquals("xmlns(ns1=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingFaultReference(reservationSOAPBinding/ns1:opCheckAvailability/Out/ns1:invalidDataFault)",
desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].getBindingFaultReferences()[0].toString());
//Service
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org