axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r350296 - in /webservices/axis2/trunk/java/modules: codegen/test-resources/xsd/ integration/test/org/apache/axis2/security/ saaj/src/org/apache/axis2/om/impl/dom/ saaj/src/org/apache/axis2/om/impl/dom/jaxp/ saaj/test/org/apache/axis2/om/imp...
Date Thu, 01 Dec 2005 18:56:50 GMT
Author: ruchithf
Date: Thu Dec  1 10:56:03 2005
New Revision: 350296

URL: http://svn.apache.org/viewcvs?rev=350296&view=rev
Log:
 - Updated DOOM to work with WSS4J+XMl-Sec to do enc/dec properly

 - Renamed the Simple_restriction.xsd to simple_restriction.xsd - build failed in linux since
file names are case sensitive
  

Added:
    webservices/axis2/trunk/java/modules/codegen/test-resources/xsd/simple_restriction.xsd
      - copied unchanged from r350290, webservices/axis2/trunk/java/modules/codegen/test-resources/xsd/Simple_restriction.xsd
Removed:
    webservices/axis2/trunk/java/modules/codegen/test-resources/xsd/Simple_restriction.xsd
Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/AttrImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ParentNode.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/DocumentImplTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
Thu Dec  1 10:56:03 2005
@@ -79,6 +79,7 @@
     protected static final String DEFAULT_CLIENT_REPOSITORY = "default_security_client_repo";
 
     private String targetEpr = "http://127.0.0.1:" +
+    		//5556 + 
     		UtilServer.TESTING_PORT +
     		"/axis2/services/PingPort";
 

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/AttrImpl.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/AttrImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/AttrImpl.java
Thu Dec  1 10:56:03 2005
@@ -111,7 +111,8 @@
 	 * Returns the name of this attribute 
 	 */
 	public String getNodeName() {
-		return this.attrName;
+		return (this.namespace != null) ? this.namespace.getPrefix() + ":"
+				+ this.attrName : this.attrName;
 	}
 	
 	/**
@@ -127,7 +128,7 @@
 	 * @see org.w3c.dom.Node#getNodeValue()
 	 */
 	public String getNodeValue() throws DOMException {
-		return (this.attrName==null) ? "" : this.attrValue.getData();
+		return (this.attrValue == null) ? "" : this.attrValue.getData();
 	}
 	
 	/**
@@ -311,7 +312,8 @@
 	 * @see org.w3c.dom.Node#getLocalName()
 	 */
     public String getLocalName() {
-        return (this.namespace == null) ? null : this.attrName;
+        return (this.namespace == null) ? null : DOMUtil.getLocalName(this.attrName);
+//    	return this.attrName;
     }
 
     /**
@@ -321,8 +323,11 @@
     public String getNamespaceURI() {
 		if(this.namespace != null) {
 			return namespace.getName();
-		}
-		
+		} 
+//		else if (this.attrName != null && this.attrName.startsWith(OMConstants.XMLNS_NS_PREFIX
+ ":")) {
+//			return OMConstants.XMLNS_NS_URI;
+//		}
+//		
 		return null;
 	}
     

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java
Thu Dec  1 10:56:03 2005
@@ -25,6 +25,7 @@
 import org.apache.axis2.om.OMText;
 import org.apache.axis2.om.OMXMLParserWrapper;
 import org.apache.axis2.om.impl.llom.exception.OMStreamingException;
+import org.w3c.dom.Attr;
 import org.w3c.dom.Node;
 
 import javax.xml.namespace.NamespaceContext;
@@ -562,14 +563,18 @@
             if (isStartElement() || (currentEvent == ATTRIBUTE)) {
                 OMAttribute attrib = getAttribute((OMElement) lastNode, i);
                 if (attrib != null) {
-                    returnString = attrib.getLocalName();
+                	if(attrib.getNamespace() != null) {
+                		returnString = attrib.getLocalName();
+                	} else {
+                		returnString = ((Attr)attrib).getNodeName();
+                	}
                 }
             } else {
                 throw new IllegalStateException(
                         "attribute localName accessed in illegal event!");
             }
         }
-        return returnString;
+         return returnString;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java
Thu Dec  1 10:56:03 2005
@@ -421,6 +421,11 @@
             null);
             throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
         }
+        
+		if(prefix == null || prefix.equals("")) {
+			String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR",
null);
+            throw new DOMException(DOMException.NAMESPACE_ERR, msg);
+		}
     }
     
     /*

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
Thu Dec  1 10:56:03 2005
@@ -146,7 +146,7 @@
 	 * Returns the value of the namespace URI
 	 */
 	public String getNamespaceURI() {
-		return this.namespace.getName();
+		return (this.namespace != null)?this.namespace.getName(): null;
 	}
 	
 	///
@@ -177,7 +177,7 @@
 	 * @see org.w3c.dom.Element#getTagName()
 	 */
 	public String getTagName() {
-		return this.localName;
+		return (this.namespace != null) ? this.namespace.getPrefix() + ":" + this.localName : this.localName;
 	}
 
 	/**
@@ -325,6 +325,10 @@
             throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, msg);
 		}
 		
+		if(attr.getName().startsWith(OMConstants.XMLNS_NS_PREFIX + ":")) {
+			//This is a ns declaration
+			this.declareNamespace(attr.getNodeValue(), DOMUtil.getLocalName(attr.getName()));
+		}
 		if(this.attributes == null) {
 			this.attributes = new AttributeMap(this);
 		}
@@ -342,8 +346,13 @@
 			String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR",
null);
             throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
 		}
-		
-		this.setAttributeNode(new AttrImpl(this.ownerNode, name, value));
+		if(name.startsWith(OMConstants.XMLNS_NS_PREFIX + ":")) {
+			//This is a ns declaration
+			this.declareNamespace(value, DOMUtil.getLocalName(name));
+		} else {
+			this.setAttributeNode(new AttrImpl(this.ownerNode, name, value));			
+		}
+
 	}
 
 	/* (non-Javadoc)
@@ -493,7 +502,6 @@
 	 * @see org.apache.axis2.om.OMElement#addAttribute(org.apache.axis2.om.OMAttribute)
 	 */
 	public OMAttribute addAttribute(OMAttribute attr) {
-		
         OMNamespace namespace = attr.getNamespace();
         if ( namespace != null && this.findNamespace(namespace.getName(), namespace.getPrefix())
== null) {
             this.declareNamespace(namespace.getName(), namespace.getPrefix());
@@ -511,17 +519,12 @@
 	 * @see org.apache.axis2.om.OMElement#addAttribute(java.lang.String, java.lang.String, org.apache.axis2.om.OMNamespace)
 	 */
 	public OMAttribute addAttribute(String attributeName, String value, OMNamespace ns) {
-		
         if (ns != null && findNamespace(ns.getName(), ns.getPrefix()) != null){
             declareNamespace(ns);
         }
-//        if(ns != null) {
-//        	return this.addAttribute(ns.getName(),attributeName,value);
-//        } else {
-//        	return this.addAttribute(null,attributeName,value);
-//        }
         if(ns != null) {
-        	return this.addAttribute(ns.getName(),attributeName,value);
+        	return this.addAttribute(ns.getName(), ns.getPrefix() + ":"
+					+ attributeName, value);
         } else {
         	return this.addAttribute(null,attributeName,value);
         }
@@ -538,7 +541,10 @@
             this.namespaces = new HashMap(5);
         }
         if(namespace != null) {
-        	namespaces.put(namespace.getPrefix(), namespace);
+        	if(!namespace.getPrefix().startsWith(OMConstants.XMLNS_NS_PREFIX)) {
+        		namespaces.put(namespace.getPrefix(), namespace);
+        	}
+        	
         }
         return namespace;
 	}
@@ -962,8 +968,8 @@
     	AttributeMap attributeMap =  new AttributeMap(this);
     	
     	//Add the set of existing attrs
-    	for(int i = 0; i < attributeMap.getLength(); i++) {
-        	attributeMap.setNamedItem((Attr)attributeMap.getItem(i));
+    	for(int i = 0; i < this.attributes.getLength(); i++) {
+        	attributeMap.addItem((Attr)this.attributes.getItem(i));
     	}
     	
     	//Add the NS declarations
@@ -971,9 +977,12 @@
 	    	Iterator nsDecls = this.namespaces.keySet().iterator();
 			while (nsDecls.hasNext()) {
 				String prefix = (String) nsDecls.next();
-				OMNamespace ns = (OMNamespace)this.namespaces.get(prefix);
-				AttrImpl attr = new AttrImpl(this.ownerNode, OMConstants.XMLNS_NS_PREFIX + ":" + prefix,
ns.getName());
-				attributeMap.addItem(attr);
+				if(!prefix.equals(OMConstants.XMLNS_NS_PREFIX)){
+					OMNamespace ns = (OMNamespace)this.namespaces.get(prefix);
+					AttrImpl attr = new AttrImpl(this.ownerNode,prefix, ns.getName());
+					attr.setOMNamespace(new NamespaceImpl(OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX));
+					attributeMap.addItem(attr);
+				}
 			}
     	}
     	

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ParentNode.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ParentNode.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ParentNode.java
Thu Dec  1 10:56:03 2005
@@ -298,8 +298,12 @@
 			if(tempNode.equals(oldChild)) {
 				if(newChild instanceof DocumentFragmentimpl) {
 					DocumentFragmentimpl docFrag = (DocumentFragmentimpl)newDomChild;
-					docFrag.firstChild.previousSubling = oldDomChild.previousSubling;
-					
+					ChildNode child = (ChildNode)docFrag.getFirstChild();
+					child.parentNode = this;
+					this.replaceChild(child, oldChild);
+//					DocumentFragmentimpl docFrag = (DocumentFragmentimpl)newDomChild;
+//					docFrag.firstChild.previousSubling = oldDomChild.previousSubling;
+//					
 				} else {
 					newDomChild.nextSibling = oldDomChild.nextSibling;
 					newDomChild.previousSubling = oldDomChild.previousSubling;

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/jaxp/DocumentBuilderImpl.java
Thu Dec  1 10:56:03 2005
@@ -17,6 +17,7 @@
 
 import org.apache.axis2.om.impl.dom.DOMImplementationImpl;
 import org.apache.axis2.om.impl.dom.DocumentImpl;
+import org.apache.axis2.om.impl.dom.ElementImpl;
 import org.apache.axis2.om.impl.dom.factory.OMDOMFactory;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.w3c.dom.DOMImplementation;
@@ -91,6 +92,8 @@
 			//Not really sure whether this will work :-?
 			XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(inputSource.getCharacterStream());
 			StAXOMBuilder builder = new StAXOMBuilder(factory,reader);
+			DocumentImpl doc = (DocumentImpl)builder.getDocument();
+			((ElementImpl)doc.getDocumentElement()).build();
 			return (DocumentImpl)builder.getDocument();
 		}catch (XMLStreamException e) {
 			throw new SAXException(e);

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/DocumentImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/DocumentImplTest.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/DocumentImplTest.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/DocumentImplTest.java
Thu Dec  1 10:56:03 2005
@@ -37,9 +37,9 @@
 		DocumentImpl doc = new DocumentImpl();
 		Element elem = doc.createElement(tagName);
 		
-		assertEquals("Local name misnatch",tagName,elem.getNodeName());
+		assertEquals("Local name misnatch",tagName, elem.getNodeName());
 		
-		elem = doc.createElementNS(namespace, tagName);
+		elem = doc.createElementNS(namespace, "axis2:" + tagName);
 		assertEquals("Local name misnatch",tagName,elem.getLocalName());
 		assertEquals("Namespace misnatch",namespace,elem.getNamespaceURI());
 		

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java?rev=350296&r1=350295&r2=350296&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java
Thu Dec  1 10:56:03 2005
@@ -173,7 +173,7 @@
 			Element docElem = doc.getDocumentElement();
 			assertNull("The document element shoudl be null", docElem);
 			
-			docElem = doc.createElementNS("http://test.org", "Test");
+			docElem = doc.createElementNS("http://test.org", "test:Test");
 			
 			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
 			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));



Mime
View raw message