You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/07/19 01:06:49 UTC
svn commit: r1691781 - in /webservices/axiom/trunk:
aspects/core-aspects/src/main/java/org/apache/axiom/core/
aspects/dom-aspects/src/main/java/org/apache/axiom/dom/
aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/
implementations/axio...
Author: veithen
Date: Sat Jul 18 23:06:48 2015
New Revision: 1691781
URL: http://svn.apache.org/r1691781
Log:
Further unify the attribute implementations.
Added:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java (with props)
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttribute.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttributeSupport.aj
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttribute.java
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomAttributeSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomNamespaceDeclarationSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/Policies.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/Attribute.java
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java Sat Jul 18 23:06:48 2015
@@ -23,48 +23,6 @@ package org.apache.axiom.core;
*/
public interface AttributeMatcher {
/**
- * {@link AttributeMatcher} that matches {@link CoreNamespaceDeclaration} attributes based on
- * the declared prefix. Parameters are defined as follows:
- * <dl>
- * <dt><code>namespaceURI</code>
- * <dd>Not used.
- * <dt><code>name</code>
- * <dd>The prefix declared by the namespace declaration, or the empty string for the default
- * namespace declaration.
- * <dt><code>value</code>
- * <dd>The namespace URI of the namespace declaration.
- * <dt><code>prefix</code>
- * <dd>Not used.
- * </dl>
- */
- AttributeMatcher NAMESPACE_DECLARATION = new AttributeMatcher() {
- public boolean matches(CoreAttribute attr, String namespaceURI, String name) {
- if (attr instanceof CoreNamespaceDeclaration) {
- String prefix = ((CoreNamespaceDeclaration)attr).coreGetDeclaredPrefix();
- return name.equals(prefix);
- } else {
- return false;
- }
- }
-
- public CoreAttribute createAttribute(NodeFactory nodeFactory, CoreDocument document, String namespaceURI, String name, String prefix, String value) {
- return nodeFactory.createNamespaceDeclaration(document, name, value);
- }
-
- public String getNamespaceURI(CoreAttribute attr) {
- return null;
- }
-
- public String getName(CoreAttribute attr) {
- return ((CoreNamespaceDeclaration)attr).coreGetDeclaredPrefix();
- }
-
- public void update(CoreAttribute attr, String prefix, String value) {
- attr.coreSetValue(value);
- }
- };
-
- /**
* Check if the given attribute matches. The values of the <code>namespaceURI</code> and
* <code>name</code> parameters are those passed to
* {@link CoreElement#coreGetAttribute(AttributeMatcher, String, String)} or
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttribute.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttribute.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttribute.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttribute.java Sat Jul 18 23:06:48 2015
@@ -18,7 +18,7 @@
*/
package org.apache.axiom.core;
-public interface CoreAttribute extends CoreNode {
+public interface CoreAttribute extends NonDeferringParentNode {
/**
* Get the owner element of this attribute.
*
@@ -69,5 +69,4 @@ public interface CoreAttribute extends C
CoreAttribute coreGetPreviousAttribute();
String coreGetValue();
- void coreSetValue(String value);
}
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttributeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttributeSupport.aj?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttributeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreAttributeSupport.aj Sat Jul 18 23:06:48 2015
@@ -131,4 +131,8 @@ public aspect CoreAttributeSupport {
public final void CoreAttribute.coreSetSpecified(boolean specified) {
setFlag(Flags.DEFAULT_ATTR, !specified);
}
+
+ public final String CoreAttribute.coreGetValue() {
+ return coreGetTextContent(ElementAction.FAIL);
+ }
}
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java Sat Jul 18 23:06:48 2015
@@ -36,12 +36,16 @@ package org.apache.axiom.core;
* {@link AttributeMatcher#NAMESPACE_DECLARATION} can be used).
*/
public final class NSAwareAttributeMatcher implements AttributeMatcher {
+ private final DetachPolicy detachPolicy;
private final boolean matchNSUnawareAttributes;
private final boolean updatePrefix;
/**
* Constructor.
*
+ * @param detachPolicy
+ * Specifies the {@link DetachPolicy} to be used by
+ * {@link #update(CoreAttribute, String, String)}.
* @param matchNSUnawareAttributes
* Specifies if {@link CoreNSUnawareAttribute} instances can also be matched. Only
* applies to the case where <code>namespaceURI</code> is the empty string.
@@ -51,7 +55,9 @@ public final class NSAwareAttributeMatch
* <code>prefix</prefix> is only used when creating new attributes and prefixes of
* existing attributes are preserved (i.e. only their value is updated).
*/
- public NSAwareAttributeMatcher(boolean matchNSUnawareAttributes, boolean updatePrefix) {
+ public NSAwareAttributeMatcher(DetachPolicy detachPolicy, boolean matchNSUnawareAttributes,
+ boolean updatePrefix) {
+ this.detachPolicy = detachPolicy;
this.matchNSUnawareAttributes = matchNSUnawareAttributes;
this.updatePrefix = updatePrefix;
}
@@ -83,7 +89,7 @@ public final class NSAwareAttributeMatch
}
public void update(CoreAttribute attr, String prefix, String value) {
- attr.coreSetValue(value);
+ attr.coreSetTextContent(value, detachPolicy);
if (updatePrefix && attr instanceof CoreNSAwareAttribute) {
((CoreNSAwareAttribute)attr).coreSetPrefix(prefix);
}
Added: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java?rev=1691781&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java (added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java Sat Jul 18 23:06:48 2015
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.core;
+
+/**
+ * {@link AttributeMatcher} that matches {@link CoreNamespaceDeclaration} attributes based on the
+ * declared prefix. Parameters are defined as follows:
+ * <dl>
+ * <dt><code>namespaceURI</code>
+ * <dd>Not used.
+ * <dt><code>name</code>
+ * <dd>The prefix declared by the namespace declaration, or the empty string for the default
+ * namespace declaration.
+ * <dt><code>value</code>
+ * <dd>The namespace URI of the namespace declaration.
+ * <dt><code>prefix</code>
+ * <dd>Not used.
+ * </dl>
+ */
+public final class NamespaceDeclarationMatcher implements AttributeMatcher {
+ private final DetachPolicy detachPolicy;
+
+ public NamespaceDeclarationMatcher(DetachPolicy detachPolicy) {
+ this.detachPolicy = detachPolicy;
+ }
+
+ public boolean matches(CoreAttribute attr, String namespaceURI, String name) {
+ if (attr instanceof CoreNamespaceDeclaration) {
+ String prefix = ((CoreNamespaceDeclaration)attr).coreGetDeclaredPrefix();
+ return name.equals(prefix);
+ } else {
+ return false;
+ }
+ }
+
+ public CoreAttribute createAttribute(NodeFactory nodeFactory, CoreDocument document, String namespaceURI, String name, String prefix, String value) {
+ return nodeFactory.createNamespaceDeclaration(document, name, value);
+ }
+
+ public String getNamespaceURI(CoreAttribute attr) {
+ return null;
+ }
+
+ public String getName(CoreAttribute attr) {
+ return ((CoreNamespaceDeclaration)attr).coreGetDeclaredPrefix();
+ }
+
+ public void update(CoreAttribute attr, String prefix, String value) {
+ attr.coreSetTextContent(value, detachPolicy);
+ }
+}
\ No newline at end of file
Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttribute.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttribute.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttribute.java (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttribute.java Sat Jul 18 23:06:48 2015
@@ -19,9 +19,8 @@
package org.apache.axiom.dom;
import org.apache.axiom.core.CoreAttribute;
-import org.apache.axiom.core.NonDeferringParentNode;
import org.w3c.dom.Attr;
-public interface DOMAttribute extends DOMRootNode, Attr, CoreAttribute, NonDeferringParentNode {
+public interface DOMAttribute extends DOMRootNode, Attr, CoreAttribute {
}
Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMAttributeSupport.aj Sat Jul 18 23:06:48 2015
@@ -48,18 +48,18 @@ public aspect DOMAttributeSupport {
}
public final String DOMAttribute.getTextContent() {
- return coreGetTextContent(ElementAction.FAIL);
+ return getValue();
}
public final void DOMAttribute.setTextContent(String textContent) {
- coreSetTextContent(textContent, Policies.DETACH_POLICY);
+ setValue(textContent);
}
public final String DOMAttribute.getValue() {
- return getTextContent();
+ return coreGetValue();
}
public final void DOMAttribute.setValue(String value) {
- setTextContent(value);
+ coreSetTextContent(value, Policies.DETACH_POLICY);
}
}
Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj Sat Jul 18 23:06:48 2015
@@ -85,7 +85,7 @@ public aspect DOMElementSupport {
public final Attr DOMElement.getAttributeNodeNS(String namespaceURI, String localName) {
if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
- return (DOMAttribute)coreGetAttribute(AttributeMatcher.NAMESPACE_DECLARATION, null, localName.equals(XMLConstants.XMLNS_ATTRIBUTE) ? "" : localName);
+ return (DOMAttribute)coreGetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, null, localName.equals(XMLConstants.XMLNS_ATTRIBUTE) ? "" : localName);
} else {
return (DOMAttribute)coreGetAttribute(Policies.DOM2_ATTRIBUTE_MATCHER, namespaceURI == null ? "" : namespaceURI, localName);
}
@@ -126,7 +126,7 @@ public aspect DOMElementSupport {
localName = qualifiedName.substring(i+1);
}
if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
- coreSetAttribute(AttributeMatcher.NAMESPACE_DECLARATION, null, NSUtil.getDeclaredPrefix(localName, prefix), null, value);
+ coreSetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, null, NSUtil.getDeclaredPrefix(localName, prefix), null, value);
} else {
namespaceURI = NSUtil.normalizeNamespaceURI(namespaceURI);
NSUtil.validateAttributeName(namespaceURI, localName, prefix);
@@ -149,7 +149,7 @@ public aspect DOMElementSupport {
if (newAttr instanceof CoreNSAwareAttribute) {
matcher = Policies.DOM2_ATTRIBUTE_MATCHER;
} else if (newAttr instanceof CoreNamespaceDeclaration) {
- matcher = AttributeMatcher.NAMESPACE_DECLARATION;
+ matcher = Policies.NAMESPACE_DECLARATION_MATCHER;
} else {
// Must be a DOM1 (namespace unaware) attribute
matcher = Policies.DOM1_ATTRIBUTE_MATCHER;
@@ -180,7 +180,7 @@ public aspect DOMElementSupport {
public final void DOMElement.removeAttributeNS(String namespaceURI, String localName) throws DOMException {
// Specs: "If no attribute with this local name and namespace URI is found, this method has no effect."
if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
- coreRemoveAttribute(AttributeMatcher.NAMESPACE_DECLARATION, null, localName.equals(XMLConstants.XMLNS_ATTRIBUTE) ? "" : localName);
+ coreRemoveAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, null, localName.equals(XMLConstants.XMLNS_ATTRIBUTE) ? "" : localName);
} else {
coreRemoveAttribute(Policies.DOM2_ATTRIBUTE_MATCHER, namespaceURI == null ? "" : namespaceURI, localName);
}
Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/Policies.java Sat Jul 18 23:06:48 2015
@@ -24,12 +24,19 @@ import org.apache.axiom.core.CoreDocumen
import org.apache.axiom.core.CoreParentNode;
import org.apache.axiom.core.DetachPolicy;
import org.apache.axiom.core.NSAwareAttributeMatcher;
+import org.apache.axiom.core.NamespaceDeclarationMatcher;
import org.apache.axiom.core.NodeFactory;
import org.apache.axiom.core.NodeMigrationPolicy;
public final class Policies {
private Policies() {}
+ public static final DetachPolicy DETACH_POLICY = new DetachPolicy() {
+ public CoreDocument getNewOwnerDocument(CoreParentNode parent) {
+ return parent.coreGetOwnerDocument(true);
+ }
+ };
+
/**
* {@link AttributeMatcher} implementation that matches attributes based on their name, i.e.
* based on the prefix and local name for namespace aware attributes. Parameters are defined as
@@ -66,12 +73,14 @@ public final class Policies {
}
public void update(CoreAttribute attr, String prefix, String value) {
- attr.coreSetValue(value);
+ attr.coreSetTextContent(value, DETACH_POLICY);
}
};
- public static final AttributeMatcher DOM2_ATTRIBUTE_MATCHER = new NSAwareAttributeMatcher(true, true);
+ public static final AttributeMatcher DOM2_ATTRIBUTE_MATCHER = new NSAwareAttributeMatcher(DETACH_POLICY, true, true);
+ public static final AttributeMatcher NAMESPACE_DECLARATION_MATCHER = new NamespaceDeclarationMatcher(DETACH_POLICY);
+
public static final NodeMigrationPolicy ATTRIBUTE_MIGRATION_POLICY = new NodeMigrationPolicy() {
public Action getAction(boolean hasParent, boolean isForeignDocument, boolean isForeignModel) {
return Action.REJECT;
@@ -83,10 +92,4 @@ public final class Policies {
return isForeignDocument ? Action.REJECT : Action.MOVE;
}
};
-
- public static final DetachPolicy DETACH_POLICY = new DetachPolicy() {
- public CoreDocument getNewOwnerDocument(CoreParentNode parent) {
- return parent.coreGetOwnerDocument(true);
- }
- };
}
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomAttributeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomAttributeSupport.aj?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomAttributeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomAttributeSupport.aj Sat Jul 18 23:06:48 2015
@@ -42,7 +42,7 @@ public aspect AxiomAttributeSupport {
}
public final void AxiomAttribute.setAttributeValue(String value) {
- coreSetValue(value);
+ coreSetTextContent(value, Policies.DETACH_POLICY);
}
public final String AxiomAttribute.getAttributeType() {
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj Sat Jul 18 23:06:48 2015
@@ -365,7 +365,7 @@ public aspect AxiomElementSupport {
public final void AxiomElement.addNamespaceDeclaration(OMNamespace ns) {
try {
- coreSetAttribute(AttributeMatcher.NAMESPACE_DECLARATION,
+ coreSetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER,
((AxiomNodeFactory)getOMFactory()).createNamespaceDeclaration(ns),
NodeMigrationPolicy.MOVE_ALWAYS, true, null, ReturnValue.NONE);
} catch (NodeMigrationException ex) {
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomNamespaceDeclarationSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomNamespaceDeclarationSupport.aj?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomNamespaceDeclarationSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomNamespaceDeclarationSupport.aj Sat Jul 18 23:06:48 2015
@@ -37,6 +37,6 @@ public aspect AxiomNamespaceDeclarationS
public final void AxiomNamespaceDeclaration.setDeclaredNamespace(OMNamespace declaredNamespace) {
this.declaredNamespace = declaredNamespace;
- coreSetValue(declaredNamespace.getNamespaceURI());
+ coreSetTextContent(declaredNamespace.getNamespaceURI(), Policies.DETACH_POLICY);
}
}
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/Policies.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/Policies.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/Policies.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/Policies.java Sat Jul 18 23:06:48 2015
@@ -23,15 +23,25 @@ import org.apache.axiom.core.CoreDocumen
import org.apache.axiom.core.CoreParentNode;
import org.apache.axiom.core.DetachPolicy;
import org.apache.axiom.core.NSAwareAttributeMatcher;
+import org.apache.axiom.core.NamespaceDeclarationMatcher;
import org.apache.axiom.core.NodeMigrationPolicy;
public final class Policies {
private Policies() {}
+ public static final DetachPolicy DETACH_POLICY = new DetachPolicy() {
+ public CoreDocument getNewOwnerDocument(CoreParentNode parent) {
+ return null;
+ }
+ };
+
public static final AttributeMatcher ATTRIBUTE_MATCHER = new NSAwareAttributeMatcher(
+ DETACH_POLICY,
false, // Axiom doesn't support namespace unaware attributes
false);
+ public static final AttributeMatcher NAMESPACE_DECLARATION_MATCHER = new NamespaceDeclarationMatcher(DETACH_POLICY);
+
public static final NodeMigrationPolicy ATTRIBUTE_MIGRATION_POLICY = new NodeMigrationPolicy() {
public Action getAction(boolean hasParent, boolean isForeignDocument, boolean isForeignModel) {
// TODO: doesn't look correct for foreign documents
@@ -44,10 +54,4 @@ public final class Policies {
return isForeignModel ? Action.CLONE : Action.MOVE;
}
};
-
- public static final DetachPolicy DETACH_POLICY = new DetachPolicy() {
- public CoreDocument getNewOwnerDocument(CoreParentNode parent) {
- return null;
- }
- };
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java Sat Jul 18 23:06:48 2015
@@ -51,10 +51,6 @@ public abstract class AttrImpl extends P
return coreGetSpecified();
}
- public final String coreGetValue() {
- return getValue();
- }
-
public final void coreSetValue(String value) {
setValue(value);
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java Sat Jul 18 23:06:48 2015
@@ -28,6 +28,7 @@ import org.apache.axiom.dom.DOMAttribute
import org.apache.axiom.dom.DOMConfigurationImpl;
import org.apache.axiom.dom.DOMExceptionUtil;
import org.apache.axiom.dom.DOMNSAwareElement;
+import org.apache.axiom.dom.Policies;
import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMConstants;
import org.apache.axiom.om.OMElement;
@@ -85,7 +86,7 @@ public class ElementImpl extends ParentN
declare = declare && !namespaceURI.equals(existingNamespaceURI);
}
if (declare) {
- coreSetAttribute(AttributeMatcher.NAMESPACE_DECLARATION, null, prefix, null, namespaceURI);
+ coreSetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, null, prefix, null, namespaceURI);
}
return prefix;
}
Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java Sat Jul 18 23:06:48 2015
@@ -46,6 +46,7 @@ import org.apache.axiom.om.impl.OMContai
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.common.AxiomNamespaceDeclaration;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
+import org.apache.axiom.om.impl.common.Policies;
import org.apache.axiom.om.impl.common.factory.AxiomNodeFactory;
import org.apache.axiom.om.impl.dom.CDATASectionImpl;
import org.apache.axiom.om.impl.dom.CommentImpl;
@@ -320,7 +321,7 @@ public class OMDOMFactory implements Axi
public final CoreNSUnawareAttribute createAttribute(CoreDocument document, String name, String value, String type) {
NSUnawareAttribute attr = new NSUnawareAttribute((DocumentImpl)document, this);
attr.coreSetName(name);
- attr.coreSetValue(value);
+ attr.coreSetTextContent(value, Policies.DETACH_POLICY);
// attr.coreSetType(type);
return attr;
}
Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/Attribute.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/Attribute.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/Attribute.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/Attribute.java Sat Jul 18 23:06:48 2015
@@ -23,7 +23,6 @@ import org.apache.axiom.om.OMFactory;
public abstract class Attribute extends OMInformationItemImpl implements CoreAttribute {
private OMFactory factory;
- private String value;
public Attribute(OMFactory factory) {
this.factory = factory;
@@ -32,12 +31,4 @@ public abstract class Attribute extends
public final OMFactory getOMFactory() {
return factory;
}
-
- public final String coreGetValue() {
- return value;
- }
-
- public final void coreSetValue(String value) {
- this.value = value;
- }
}
Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java?rev=1691781&r1=1691780&r2=1691781&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java Sat Jul 18 23:06:48 2015
@@ -25,6 +25,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMInformationItem;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.impl.common.AxiomAttribute;
+import org.apache.axiom.om.impl.common.Policies;
/** Class OMAttributeImpl */
public class OMAttributeImpl extends Attribute implements AxiomAttribute {
@@ -54,7 +55,7 @@ public class OMAttributeImpl extends Att
}
internalSetLocalName(localName);
- coreSetValue(value);
+ coreSetTextContent(value, Policies.DETACH_POLICY);
internalSetNamespace(ns);
coreSetType(OMConstants.XMLATTRTYPE_CDATA);
}