ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1734699 - in /webservices/axiom/trunk/aspects: core-aspects/src/main/java/org/apache/axiom/core/ om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/ om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/
Date Sat, 12 Mar 2016 12:34:27 GMT
Author: veithen
Date: Sat Mar 12 12:34:27 2016
New Revision: 1734699

URL: http://svn.apache.org/viewvc?rev=1734699&view=rev
Log:
Further decouple BuildableContext from the Axiom API.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareNamedNode.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNamespaceDeclaration.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamedInformationItemSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareNamedNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareNamedNode.java?rev=1734699&r1=1734698&r2=1734699&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareNamedNode.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSAwareNamedNode.java
Sat Mar 12 12:34:27 2016
@@ -22,6 +22,7 @@ package org.apache.axiom.core;
  * Represents a namespace aware named information item.
  */
 public interface CoreNSAwareNamedNode extends CoreNamedNode {
+    void initName(String namespaceURI, String localName, String prefix, Object namespaceHelper);
     String coreGetNamespaceURI();
     String coreGetPrefix();
     void coreSetPrefix(String prefix);

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNamespaceDeclaration.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNamespaceDeclaration.java?rev=1734699&r1=1734698&r2=1734699&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNamespaceDeclaration.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNamespaceDeclaration.java
Sat Mar 12 12:34:27 2016
@@ -22,6 +22,8 @@ package org.apache.axiom.core;
  * Represents a namespace declaration information item.
  */
 public interface CoreNamespaceDeclaration extends CoreAttribute {
+    void init(String prefix, String namespaceURI, Object namespaceHelper);
+    
     /**
      * Get the prefix declared by this namespace declaration.
      * 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java?rev=1734699&r1=1734698&r2=1734699&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java
Sat Mar 12 12:34:27 2016
@@ -25,26 +25,23 @@ import org.apache.axiom.core.CoreChildNo
 import org.apache.axiom.core.CoreComment;
 import org.apache.axiom.core.CoreDocument;
 import org.apache.axiom.core.CoreDocumentTypeDeclaration;
+import org.apache.axiom.core.CoreElement;
 import org.apache.axiom.core.CoreEntityReference;
 import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.core.CoreModelStreamException;
+import org.apache.axiom.core.CoreNSAwareAttribute;
+import org.apache.axiom.core.CoreNSAwareElement;
+import org.apache.axiom.core.CoreNamespaceDeclaration;
 import org.apache.axiom.core.CoreParentNode;
 import org.apache.axiom.core.CoreProcessingInstruction;
 import org.apache.axiom.core.InputContext;
 import org.apache.axiom.core.stream.NullXmlHandler;
 import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.XmlHandler;
-import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.common.AxiomSemantics;
-import org.apache.axiom.om.impl.common.OMNamespaceImpl;
-import org.apache.axiom.om.impl.intf.AxiomAttribute;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
-import org.apache.axiom.om.impl.intf.AxiomElement;
-import org.apache.axiom.om.impl.intf.AxiomNamespaceDeclaration;
 
 final class BuildableContext extends Context implements InputContext {
-    private static final OMNamespace DEFAULT_NS = new OMNamespaceImpl("", "");
-    
     private final Context parentContext;
 
     private CoreParentNode target;
@@ -183,10 +180,10 @@ final class BuildableContext extends Con
             passThroughHandler.startElement(namespaceURI, localName, prefix);
             return this;
         } else {
-            AxiomElement element = builderHandler.nodeFactory.createNode(builderHandler.model.determineElementType(
+            CoreNSAwareElement element = builderHandler.nodeFactory.createNode(builderHandler.model.determineElementType(
                     (AxiomContainer)target, depth+1, namespaceURI, localName));
             element.coreSetState(CoreParentNode.ATTRIBUTES_PENDING);
-            element.initName(localName, builderHandler.nsCache.getOMNamespace(namespaceURI,
prefix), false);
+            element.initName(namespaceURI, localName, prefix, builderHandler.nsCache);
             addChild(element);
             return newContext(element);
         }
@@ -207,18 +204,16 @@ final class BuildableContext extends Con
         if (passThroughHandler != null) {
             passThroughHandler.processAttribute(namespaceURI, localName, prefix, value, type,
specified);
         } else {
-            OMNamespace ns = builderHandler.nsCache.getOMNamespace(namespaceURI, prefix);
-            AxiomAttribute attr = builderHandler.nodeFactory.createNode(AxiomAttribute.class);
-            attr.internalSetLocalName(localName);
+            CoreNSAwareAttribute attr = builderHandler.nodeFactory.createNode(CoreNSAwareAttribute.class);
+            attr.initName(namespaceURI, localName, prefix, builderHandler.nsCache);
             try {
                 attr.coreSetCharacterData(value, AxiomSemantics.INSTANCE);
             } catch (CoreModelException ex) {
                 throw new CoreModelStreamException(ex);
             }
-            attr.internalSetNamespace(ns);
             attr.coreSetType(type);
             attr.coreSetSpecified(specified);
-            ((AxiomElement)target).coreAppendAttribute(attr);
+            ((CoreElement)target).coreAppendAttribute(attr);
         }
     }
     
@@ -227,13 +222,9 @@ final class BuildableContext extends Con
         if (passThroughHandler != null) {
             passThroughHandler.processNamespaceDeclaration(prefix, namespaceURI);
         } else {
-            OMNamespace ns = builderHandler.nsCache.getOMNamespace(namespaceURI, prefix);
-            if (ns == null) {
-                ns = DEFAULT_NS;
-            }
-            AxiomNamespaceDeclaration decl = builderHandler.nodeFactory.createNode(AxiomNamespaceDeclaration.class);
-            decl.setDeclaredNamespace(ns);
-            ((AxiomElement)target).coreAppendAttribute(decl);
+            CoreNamespaceDeclaration decl = builderHandler.nodeFactory.createNode(CoreNamespaceDeclaration.class);
+            decl.init(prefix, namespaceURI, builderHandler.nsCache);
+            ((CoreElement)target).coreAppendAttribute(decl);
         }
     }
     

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamedInformationItemSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamedInformationItemSupport.aj?rev=1734699&r1=1734698&r2=1734699&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamedInformationItemSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamedInformationItemSupport.aj
Sat Mar 12 12:34:27 2016
@@ -24,6 +24,7 @@ import org.apache.axiom.core.CoreNamedNo
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
+import org.apache.axiom.om.impl.common.builder.OMNamespaceCache;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomNamedInformationItem;
 import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
@@ -48,6 +49,11 @@ public aspect AxiomNamedInformationItemS
     private String AxiomNamedInformationItem.localName;
     private QName AxiomNamedInformationItem.qName;
     
+    public final void AxiomNamedInformationItem.initName(String namespaceURI, String localName,
String prefix, Object namespaceHelper) {
+        this.localName = localName;
+        namespace = ((OMNamespaceCache)namespaceHelper).getOMNamespace(namespaceURI, prefix);
+    }
+    
     /**
      * Set the namespace of the node without adding a corresponding namespace declaration.
      * 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj?rev=1734699&r1=1734698&r2=1734699&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj
Sat Mar 12 12:34:27 2016
@@ -23,11 +23,19 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.common.AxiomExceptionTranslator;
 import org.apache.axiom.om.impl.common.AxiomSemantics;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
+import org.apache.axiom.om.impl.common.builder.OMNamespaceCache;
 import org.apache.axiom.om.impl.intf.AxiomNamespaceDeclaration;
 
 public aspect AxiomNamespaceDeclarationSupport {
+    private static final OMNamespace DEFAULT_NS = new OMNamespaceImpl("", "");
+    
     private OMNamespace AxiomNamespaceDeclaration.declaredNamespace;
     
+    public final void AxiomNamespaceDeclaration.init(String prefix, String namespaceURI,
Object namespaceHelper) {
+        OMNamespace ns = ((OMNamespaceCache)namespaceHelper).getOMNamespace(namespaceURI,
prefix);
+        setDeclaredNamespace(ns == null ? DEFAULT_NS : ns);
+    }
+
     public final String AxiomNamespaceDeclaration.coreGetDeclaredPrefix() {
         return declaredNamespace.getPrefix();
     }



Mime
View raw message