ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wer...@apache.org
Subject svn commit: r355099 - in /webservices/commons/trunk/policy/src/org/apache/ws/policy: model/PolicyConstants.java util/PolicyReader.java util/PolicyReaderDOM.java
Date Thu, 08 Dec 2005 14:33:04 GMT
Author: werner
Date: Thu Dec  8 06:32:59 2005
New Revision: 355099

URL: http://svn.apache.org/viewcvs?rev=355099&view=rev
Log:
Synchronizing with Sanka's modifications in reader module.

Modified:
    webservices/commons/trunk/policy/src/org/apache/ws/policy/model/PolicyConstants.java
    webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReader.java
    webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReaderDOM.java

Modified: webservices/commons/trunk/policy/src/org/apache/ws/policy/model/PolicyConstants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/policy/src/org/apache/ws/policy/model/PolicyConstants.java?rev=355099&r1=355098&r2=355099&view=diff
==============================================================================
--- webservices/commons/trunk/policy/src/org/apache/ws/policy/model/PolicyConstants.java (original)
+++ webservices/commons/trunk/policy/src/org/apache/ws/policy/model/PolicyConstants.java Thu
Dec  8 06:32:59 2005
@@ -42,5 +42,8 @@
     
     /** */
     public static final String WSU_NAMESPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+ 
+    /** */
+    public static final String XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
     
 }

Modified: webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReader.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReader.java?rev=355099&r1=355098&r2=355099&view=diff
==============================================================================
--- webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReader.java (original)
+++ webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReader.java Thu Dec
 8 06:32:59 2005
@@ -96,9 +96,10 @@
         if (attri != null) {
             policy.setId(attri.getAttributeValue());
         }
-
-        attri = element.getAttribute(new QName("base", "", "xml"));
+        System.out.println("Searching base attribute");
+        attri = element.getAttribute(new QName(PolicyConstants.XML_NAMESPACE_URI, "base"));
         if (attri != null) {
+        	System.out.println("found base attribute: " + attri.getAttributeValue());      
 	
             policy.setBase(attri.getAttributeValue());
         }
 

Modified: webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReaderDOM.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReaderDOM.java?rev=355099&r1=355098&r2=355099&view=diff
==============================================================================
--- webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReaderDOM.java (original)
+++ webservices/commons/trunk/policy/src/org/apache/ws/policy/util/PolicyReaderDOM.java Thu
Dec  8 06:32:59 2005
@@ -36,6 +36,7 @@
 import org.w3c.dom.NamedNodeMap;
 import org.xml.sax.SAXException;
 
+import org.apache.axis2.om.OMAttribute;
 import org.apache.ws.policy.model.AndCompositeAssertion;
 import org.apache.ws.policy.model.Assertion;
 import org.apache.ws.policy.model.Policy;
@@ -116,6 +117,17 @@
 	
 	private Policy readPolicy(Element element) {
 		Policy policy = new Policy();
+        Attr attri;
+        attri = element.getAttributeNodeNS(PolicyConstants.WSU_NAMESPACE_URI, "Id");
+        if (attri != null) {
+            policy.setId(attri.getValue());
+        }
+
+    	attri = element.getAttributeNodeNS(PolicyConstants.XML_NAMESPACE_URI, "base");
+        if (attri != null) {
+            policy.setBase(attri.getValue());
+        }
+		
 		policy.addTerms(readTerms(element));
 		return policy;
 	}
@@ -142,16 +154,12 @@
         PrimitiveAssertion result = new PrimitiveAssertion(qname);
         
         result.setAttributes(getAttributes(element));
-        
-        // setting the text value ..
-//        String strValue = element.getTextContent();
-//     
-//        if (strValue != null && strValue.length() != 0) {
-//        	System.out.println("Seen a text content at " + element.getLocalName() +
-//        			", value: " + strValue);
-//            result.setStrValue(strValue);            
-//        }
-        
+        String isOptional = result.getAttribute(new QName(
+                PolicyConstants.WS_POLICY_NAMESPACE_URI, "Optional"));
+        if (isOptional != null && Boolean.getBoolean(isOptional)) {
+            result.setOptional(true);
+        }        
+                
         //CHECK ME
 		NodeList list = element.getChildNodes();
 		int length = list.getLength();



Mime
View raw message