You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by sa...@apache.org on 2007/04/02 19:51:40 UTC
svn commit: r524854 - in
/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi:
Policy.java PolicyReference.java PolicyRegistryImpl.java
Author: sanka
Date: Mon Apr 2 10:51:39 2007
New Revision: 524854
URL: http://svn.apache.org/viewvc?view=rev&rev=524854
Log:
Fixed: WSCOMMONS-178 (Applied the patch - thanks Saminda)
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java
Modified: webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java?view=diff&rev=524854&r1=524853&r2=524854
==============================================================================
--- webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java (original)
+++ webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java Mon Apr 2 10:51:39 2007
@@ -102,32 +102,48 @@
Constants.URI_POLICY_NS);
QName key;
- String prefix;
+
+ String prefix = null;
+ String namespaceURI = null;
+ String localName = null;
HashMap prefix2ns = new HashMap();
for (Iterator iterator = getAttributes().keySet().iterator(); iterator
.hasNext();) {
+
key = (QName) iterator.next();
-
- prefix = writer.getPrefix(key.getNamespaceURI());
- if (prefix == null) {
- prefix = key.getPrefix();
-
- if (prefix != null) {
- writer.setPrefix(prefix, key.getNamespaceURI());
+ localName = key.getLocalPart();
+
+ namespaceURI = key.getNamespaceURI();
+ namespaceURI = (namespaceURI == null || namespaceURI.length() == 0) ? null : namespaceURI;
+
+ if (namespaceURI != null) {
+
+ String writerPrefix = writer.getPrefix(namespaceURI);
+ writerPrefix = (writerPrefix == null || writerPrefix.length() == 0) ? null : writerPrefix;
+
+ if (writerPrefix == null) {
+ prefix = key.getPrefix();
+ prefix = (prefix == null || prefix.length() == 0) ? null : prefix;
+
+ } else {
+ prefix = writerPrefix;
}
- }
-
- if (prefix != null) {
- writer.writeAttribute(prefix, key.getNamespaceURI(), key
- .getLocalPart(), getAttribute(key));
- prefix2ns.put(prefix, key.getNamespaceURI());
+
+ if (prefix != null) {
+ writer.writeAttribute(prefix, namespaceURI, localName, getAttribute(key));
+ prefix2ns.put(prefix, key.getNamespaceURI());
+ } else {
+ writer.writeAttribute(namespaceURI, localName, getAttribute(key));
+ }
+
} else {
- writer.writeAttribute(key.getNamespaceURI(),
- key.getLocalPart(), getAttribute(key));
+ writer.writeAttribute(localName, getAttribute(key));
}
+
+
}
// writes xmlns:wsp=".."
Modified: webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java?view=diff&rev=524854&r1=524853&r2=524854
==============================================================================
--- webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java (original)
+++ webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java Mon Apr 2 10:51:39 2007
@@ -42,7 +42,16 @@
}
public boolean equal(PolicyComponent policyComponent) {
- throw new UnsupportedOperationException("TODO");
+ if (Constants.TYPE_POLICY_REF != policyComponent.getType()) {
+ return false;
+ }
+
+ String URI = ((PolicyReference) policyComponent).getURI();
+ if (URI != null && URI.length() != 0) {
+ return URI.equals(this.uri);
+ }
+
+ return false;
}
Modified: webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java?view=diff&rev=524854&r1=524853&r2=524854
==============================================================================
--- webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java (original)
+++ webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java Mon Apr 2 10:51:39 2007
@@ -57,4 +57,12 @@
public void remove(String key) {
reg.remove(key);
}
+
+ public void setParent(PolicyRegistry parent) {
+ this.parent = parent;
+ }
+
+ public PolicyRegistry getParent() {
+ return parent;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org