ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1608544 - in /webservices/axiom/trunk/modules: axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/ axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/ axiom-impl/src/ma...
Date Mon, 07 Jul 2014 18:29:25 GMT
Author: veithen
Date: Mon Jul  7 18:29:25 2014
New Revision: 1608544

URL: http://svn.apache.org/r1608544
Log:
Move state/builder management into aspects.

Added:
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNode.java
  (with props)
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNodeSupport.aj
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNode.java
  (with props)
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNodeSupport.aj
Modified:
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IDocument.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IElement.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
Mon Jul  7 18:29:25 2014
@@ -34,6 +34,8 @@ public interface CoreParentNode {
     int DISCARDED = 2;
     
     OMXMLParserWrapper getBuilder();
+    void coreSetBuilder(OMXMLParserWrapper builder);
     int getState();
+    void coreSetState(int state);
     boolean isComplete();
 }

Added: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNode.java?rev=1608544&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNode.java
(added)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNode.java
Mon Jul  7 18:29:25 2014
@@ -0,0 +1,26 @@
+/*
+ * 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.om.impl.common;
+
+/**
+ * Marker interface for {@link CoreParentNode} implementations that support deferred parsing.
+ */
+public interface DeferringParentNode extends CoreParentNode {
+
+}

Propchange: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNodeSupport.aj?rev=1608544&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNodeSupport.aj
(added)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/DeferringParentNodeSupport.aj
Mon Jul  7 18:29:25 2014
@@ -0,0 +1,45 @@
+/*
+ * 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.om.impl.common;
+
+import org.apache.axiom.om.OMXMLParserWrapper;
+
+public aspect DeferringParentNodeSupport {
+    private OMXMLParserWrapper DeferringParentNode.builder;
+    private int DeferringParentNode.state;
+
+    public final OMXMLParserWrapper DeferringParentNode.getBuilder() {
+        forceExpand();
+        return builder;
+    }
+
+    public void DeferringParentNode.forceExpand() {}
+    
+    public final void DeferringParentNode.coreSetBuilder(OMXMLParserWrapper builder) {
+        this.builder = builder;
+    }
+    
+    public int DeferringParentNode.getState() {
+        return state;
+    }
+
+    public final void DeferringParentNode.coreSetState(int state) {
+        this.state = state;
+    }
+}

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IDocument.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IDocument.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IDocument.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IDocument.java
Mon Jul  7 18:29:25 2014
@@ -20,6 +20,6 @@ package org.apache.axiom.om.impl.common;
 
 import org.apache.axiom.om.OMDocument;
 
-public interface IDocument extends OMDocument, IContainer {
+public interface IDocument extends OMDocument, IContainer, DeferringParentNode {
 
 }

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IElement.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IElement.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IElement.java
Mon Jul  7 18:29:25 2014
@@ -21,6 +21,6 @@ package org.apache.axiom.om.impl.common;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.OMElementEx;
 
-public interface IElement extends OMElementEx, IContainer, INode {
+public interface IElement extends OMElementEx, IContainer, INode, DeferringParentNode {
     void addNamespaceDeclaration(OMNamespace ns);
 }

Added: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNode.java?rev=1608544&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNode.java
(added)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNode.java
Mon Jul  7 18:29:25 2014
@@ -0,0 +1,26 @@
+/*
+ * 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.om.impl.common;
+
+/**
+ * Marker interface for {@link CoreParentNode} implementations that don't support deferred
parsing.
+ */
+public interface NonDeferringParentNode extends CoreParentNode {
+
+}

Propchange: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNodeSupport.aj?rev=1608544&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNodeSupport.aj
(added)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/NonDeferringParentNodeSupport.aj
Mon Jul  7 18:29:25 2014
@@ -0,0 +1,39 @@
+/*
+ * 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.om.impl.common;
+
+import org.apache.axiom.om.OMXMLParserWrapper;
+
+public aspect NonDeferringParentNodeSupport {
+    public final OMXMLParserWrapper NonDeferringParentNode.getBuilder() {
+        return null;
+    }
+
+    public final void NonDeferringParentNode.coreSetBuilder(OMXMLParserWrapper builder) {
+        throw new UnsupportedOperationException();
+    }
+    
+    public final int NonDeferringParentNode.getState() {
+        return CoreParentNode.COMPLETE;
+    }
+
+    public final void NonDeferringParentNode.coreSetState(int state) {
+        throw new UnsupportedOperationException();
+    }
+}

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
Mon Jul  7 18:29:25 2014
@@ -26,8 +26,8 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMAttributeEx;
+import org.apache.axiom.om.impl.common.NonDeferringParentNode;
 import org.apache.axiom.om.impl.common.OMNamedInformationItemHelper;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
@@ -42,7 +42,7 @@ import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 
 /** Implementation of <code>org.w3c.dom.Attr</code> and <code>org.apache.axiom.om.OMAttribute</code>
*/
-public class AttrImpl extends RootNode implements OMAttributeEx, Attr, NamedNode {
+public class AttrImpl extends RootNode implements OMAttributeEx, Attr, NamedNode, NonDeferringParentNode
{
     private String localName;
 
     private String type;
@@ -489,14 +489,6 @@ public class AttrImpl extends RootNode i
         return new AttrImpl(localName, namespace, type, factory);
     }
 
-    public final OMXMLParserWrapper getBuilder() {
-        return null;
-    }
-
-    public final int getState() {
-        return COMPLETE;
-    }
-
     public final boolean isComplete() {
         return true;
     }

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
Mon Jul  7 18:29:25 2014
@@ -23,8 +23,8 @@ import org.apache.axiom.om.OMCloneOption
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.common.IContainer;
+import org.apache.axiom.om.impl.common.NonDeferringParentNode;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
@@ -34,7 +34,7 @@ import javax.xml.stream.XMLStreamWriter;
 
 // TODO: we should not implement IContainer here
 public class DocumentFragmentImpl extends RootNode implements
-        DocumentFragment, IContainer {
+        DocumentFragment, IContainer, NonDeferringParentNode {
 
     private ParentNode ownerNode;
     
@@ -89,14 +89,6 @@ public class DocumentFragmentImpl extend
         return new DocumentFragmentImpl(factory);
     }
 
-    public final OMXMLParserWrapper getBuilder() {
-        return null;
-    }
-
-    public final int getState() {
-        return COMPLETE;
-    }
-
     public final boolean isComplete() {
         return true;
     }

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Mon Jul  7 18:29:25 2014
@@ -62,10 +62,6 @@ import java.util.Iterator;
 import java.util.Vector;
 
 public class DocumentImpl extends RootNode implements Document, IDocument {
-    protected OMXMLParserWrapper builder;
-
-    protected int state;
-
     private String xmlVersion;
 
     private String xmlEncoding;
@@ -82,12 +78,12 @@ public class DocumentImpl extends RootNo
 
     public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) {
         super(factory);
-        this.builder = parserWrapper;
+        coreSetBuilder(parserWrapper);
     }
 
     public DocumentImpl(OMFactory factory) {
         super(factory);
-        state = COMPLETE;
+        coreSetState(COMPLETE);
     }
 
     ParentNode internalGetOwnerNode() {
@@ -573,24 +569,16 @@ public class DocumentImpl extends RootNo
         return new DocumentImpl(factory);
     }
     
-    public final OMXMLParserWrapper getBuilder() {
-        return builder;
-    }
-
-    public final int getState() {
-        return state;
-    }
-
     public final boolean isComplete() {
-        return state == COMPLETE;
+        return getState() == COMPLETE;
     }
 
     public final void setComplete(boolean complete) {
-        state = complete ? COMPLETE : INCOMPLETE;
+        coreSetState(complete ? COMPLETE : INCOMPLETE);
     }
 
     public final void discarded() {
-        state = DISCARDED;
+        coreSetState(DISCARDED);
     }
 
     public final void build() {

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Mon Jul  7 18:29:25 2014
@@ -64,10 +64,6 @@ public class ElementImpl extends ParentN
 
     private static final Log log = LogFactory.getLog(ElementImpl.class);
     
-    protected OMXMLParserWrapper builder;
-
-    protected int state;
-
     private ParentNode ownerNode;
     
     private NodeImpl previousSibling;
@@ -100,8 +96,8 @@ public class ElementImpl extends ParentN
                        OMFactory factory, boolean generateNSDecl) {
         super(factory);
         this.localName = localName;
-        this.builder = builder;
-        state = builder == null ? COMPLETE : INCOMPLETE;
+        coreSetBuilder(builder);
+        coreSetState(builder == null ? COMPLETE : INCOMPLETE);
         if (parentNode != null) {
             ((IContainer)parentNode).addChild(this, builder != null);
         }
@@ -1034,7 +1030,7 @@ public class ElementImpl extends ParentN
       * @see org.apache.axiom.om.OMNode#buildAll()
       */
     public void buildWithAttachments() {
-        if (state == INCOMPLETE) {
+        if (getState() == INCOMPLETE) {
             this.build();
         }
         Iterator iterator = getChildren();
@@ -1061,20 +1057,12 @@ public class ElementImpl extends ParentN
         super.normalize(config);
     }
 
-    public final OMXMLParserWrapper getBuilder() {
-        return builder;
-    }
-
-    public final int getState() {
-        return state;
-    }
-
     public final boolean isComplete() {
-        return state == COMPLETE;
+        return getState() == COMPLETE;
     }
 
     public final void setComplete(boolean complete) {
-        state = complete ? COMPLETE : INCOMPLETE;
+        coreSetState(complete ? COMPLETE : INCOMPLETE);
         ParentNode parentNode = parentNode();
         if (parentNode != null) {
             if (!complete) {
@@ -1086,11 +1074,11 @@ public class ElementImpl extends ParentN
     }
 
     public final void discarded() {
-        state = DISCARDED;
+        coreSetState(DISCARDED);
     }
 
     OMNode detach(boolean useDomSemantics) {
-        if (state == INCOMPLETE) {
+        if (getState() == INCOMPLETE) {
             build();
         }
         return super.detach(useDomSemantics);

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
Mon Jul  7 18:29:25 2014
@@ -101,7 +101,7 @@ public class SOAPEnvelopeImpl extends SO
             // The SOAPHeader is added before the SOAPBody
             // We must be sensitive to the state of the parser.  It is possible that the
             // has not been processed yet.
-            if (state == COMPLETE) {
+            if (getState() == COMPLETE) {
                 // Parsing is complete, therefore it is safe to
                 // call getBody.
                 SOAPBody body = getBody();

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
Mon Jul  7 18:29:25 2014
@@ -41,10 +41,6 @@ import java.util.Iterator;
 
 /** Class OMDocumentImpl */
 public class OMDocumentImpl extends OMSerializableImpl implements IDocument {
-    protected OMXMLParserWrapper builder;
-
-    protected int state;
-
     /** Field charSetEncoding Default : UTF-8 */
     protected String charSetEncoding = "UTF-8";
 
@@ -62,7 +58,7 @@ public class OMDocumentImpl extends OMSe
      */
     public OMDocumentImpl(OMFactory factory) {
         super(factory);
-        state = COMPLETE;
+        coreSetState(COMPLETE);
     }
 
     /**
@@ -73,11 +69,7 @@ public class OMDocumentImpl extends OMSe
      */
     public OMDocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) {
         super(factory);
-        this.builder = parserWrapper;
-    }
-
-    public OMXMLParserWrapper getBuilder() {
-        return builder;
+        coreSetBuilder(parserWrapper);
     }
 
     public OMElement getOMDocumentElement() {
@@ -109,12 +101,8 @@ public class OMDocumentImpl extends OMSe
         }
     }
 
-    public int getState() {
-        return state;
-    }
-
     public boolean isComplete() {
-        return state == COMPLETE;
+        return getState() == COMPLETE;
     }
 
     /**
@@ -123,11 +111,11 @@ public class OMDocumentImpl extends OMSe
      * @param state
      */
     public void setComplete(boolean complete) {
-        state = complete ? COMPLETE : INCOMPLETE;
+        coreSetState(complete ? COMPLETE : INCOMPLETE);
     }
 
     public void discarded() {
-        state = DISCARDED;
+        coreSetState(DISCARDED);
     }
 
     public final void checkChild(OMNode child) {
@@ -185,7 +173,7 @@ public class OMDocumentImpl extends OMSe
     }
 
     void notifyChildComplete() {
-        if (state == INCOMPLETE && builder == null) {
+        if (getState() == INCOMPLETE && getBuilder() == null) {
             Iterator iterator = getChildren();
             while (iterator.hasNext()) {
                 OMNode node = (OMNode) iterator.next();

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
Mon Jul  7 18:29:25 2014
@@ -62,10 +62,6 @@ public class OMElementImpl extends OMNod
 
     private static final Log log = LogFactory.getLog(OMElementImpl.class);
     
-    protected OMXMLParserWrapper builder;
-
-    protected int state;
-
     /**
      * The namespace of this element. Possible values:
      * <ul>
@@ -101,8 +97,8 @@ public class OMElementImpl extends OMNod
             throw new OMException("localname can not be null or empty");
         }
         this.localName = localName;
-        this.builder = builder;
-        state = builder == null ? COMPLETE : INCOMPLETE;
+        coreSetBuilder(builder);
+        coreSetState(builder == null ? COMPLETE : INCOMPLETE);
         if (parent != null) {
             ((IContainer)parent).addChild(this, builder != null);
         }
@@ -118,7 +114,7 @@ public class OMElementImpl extends OMNod
     public OMElementImpl(QName qname, OMContainer parent, OMFactory factory)
             throws OMException {
         super(factory);
-        state = COMPLETE;
+        coreSetState(COMPLETE);
         if (parent != null) {
             parent.addChild(this);
         }
@@ -133,7 +129,7 @@ public class OMElementImpl extends OMNod
      */
     OMElementImpl(OMFactory factory) {
         super(factory);
-        state = COMPLETE;
+        coreSetState(COMPLETE);
     }
 
     /** Method handleNamespace. */
@@ -501,21 +497,12 @@ public class OMElementImpl extends OMNod
     }
 
     /**
-     * Method getBuilder.
-     *
-     * @return Returns OMXMLParserWrapper.
-     */
-    public OMXMLParserWrapper getBuilder() {
-        return builder;
-    }
-
-    /**
      * Removes this information item and its children, from the model completely.
      *
      * @throws OMException
      */
     public OMNode detach() throws OMException {
-        if (state == INCOMPLETE) {
+        if (getState() == INCOMPLETE) {
             build();
         }
         super.detach();
@@ -531,7 +518,7 @@ public class OMElementImpl extends OMNod
          * builder is null. Meaning this is a programatical created element but it has children
which are not completed
          * Build them all.
          */
-        if (builder == null && state == INCOMPLETE) {
+        if (getBuilder() == null && getState() == INCOMPLETE) {
             for (Iterator childrenIterator = this.getChildren(); childrenIterator.hasNext();)
{
                 OMNode omNode = (OMNode) childrenIterator.next();
                 omNode.build();
@@ -542,16 +529,12 @@ public class OMElementImpl extends OMNod
 
     }
 
-    public int getState() {
-        return state;
-    }
-
     public boolean isComplete() {
-        return state == COMPLETE;
+        return getState() == COMPLETE;
     }
 
     public void setComplete(boolean complete) {
-        state = complete ? COMPLETE : INCOMPLETE;
+        coreSetState(complete ? COMPLETE : INCOMPLETE);
         if (parent != null) {
             if (!complete) {
                 parent.setComplete(false);
@@ -564,7 +547,7 @@ public class OMElementImpl extends OMNod
     }
 
     public void discarded() {
-        state = DISCARDED;
+        coreSetState(DISCARDED);
     }
 
     public void setText(String text) {
@@ -754,7 +737,7 @@ public class OMElementImpl extends OMNod
             log.debug("cloneOMElement start");
             log.debug("  element string =" + getLocalName());
             log.debug(" isComplete = " + isComplete());
-            log.debug("  builder = " + builder);
+            log.debug("  builder = " + getBuilder());
         }
         return (OMElement)clone(new OMCloneOptions());
     }
@@ -796,7 +779,7 @@ public class OMElementImpl extends OMNod
       * @see org.apache.axiom.om.OMNode#buildAll()
       */
     public void buildWithAttachments() {
-        if (state == INCOMPLETE) {
+        if (getState() == INCOMPLETE) {
             this.build();
         }
         Iterator iterator = getChildren();
@@ -808,7 +791,7 @@ public class OMElementImpl extends OMNod
 
     /** This method will be called when one of the children becomes complete. */
     void notifyChildComplete() {
-        if (state == INCOMPLETE && builder == null) {
+        if (getState() == INCOMPLETE && getBuilder() == null) {
             Iterator iterator = getChildren();
             while (iterator.hasNext()) {
                 OMNode node = (OMNode) iterator.next();

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Mon Jul  7 18:29:25 2014
@@ -228,7 +228,7 @@ public class OMSourcedElementImpl extend
      * Set parser for OM, if not previously set. Since the builder is what actually constructs
the
      * tree on demand, this first creates a builder
      */
-    private void forceExpand() {
+    public void forceExpand() {
         // The dataSource != null is required because this method may be called indirectly
         // by the constructor before the data source is set. After the constructor has completed,
         // isExpanded is always true if dataSource is null.
@@ -283,7 +283,7 @@ public class OMSourcedElementImpl extend
                 isExpanded = true;
                 StAXOMBuilder builder = new StAXOMBuilder(getOMFactory(), readerFromDS, this,
characterEncoding);
                 builder.setAutoClose(true);
-                this.builder = builder;
+                coreSetBuilder(builder);
                 setComplete(false);
             }
         }
@@ -438,11 +438,6 @@ public class OMSourcedElementImpl extend
         super.removeAttribute(attr);
     }
 
-    public OMXMLParserWrapper getBuilder() {
-        forceExpand();
-        return super.getBuilder();
-    }
-
     public void coreSetFirstChild(CoreChildNode firstChild) {
         super.coreSetFirstChild(firstChild);
     }
@@ -935,7 +930,7 @@ public class OMSourcedElementImpl extend
     public void buildWithAttachments() {
         
         // If not done, force the parser to build the elements
-        if (state == INCOMPLETE) {
+        if (getState() == INCOMPLETE) {
             this.build();
         }
         
@@ -998,7 +993,7 @@ public class OMSourcedElementImpl extend
             this.dataSource = dataSource;
             setComplete(false);
             isExpanded = false;
-            builder = null;
+            coreSetBuilder(null);
             if (isLossyPrefix(dataSource)) {
                 // Create a deferred namespace that forces an expand to get the prefix
                 definedNamespace = new DeferredNamespace(definedNamespace.getNamespaceURI());
@@ -1013,7 +1008,7 @@ public class OMSourcedElementImpl extend
      * parent (which may have a different builder or no builder).
      */
     public void setComplete(boolean complete) {
-        state = complete ? COMPLETE : INCOMPLETE;
+        coreSetState(complete ? COMPLETE : INCOMPLETE);
         if (complete && dataSource != null) {
             if (dataSource instanceof OMDataSourceExt) {
                 ((OMDataSourceExt)dataSource).close();

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
Mon Jul  7 18:29:25 2014
@@ -144,7 +144,7 @@ public abstract class SOAPBodyImpl exten
             return lookAheadSuccessful;
         }
         lookAheadAttempted = true;
-        StAXSOAPModelBuilder soapBuilder = (StAXSOAPModelBuilder) this.builder;
+        StAXSOAPModelBuilder soapBuilder = (StAXSOAPModelBuilder)getBuilder();
         if (soapBuilder != null &&
             soapBuilder.isCache() &&
             !soapBuilder.isCompleted() &&

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java?rev=1608544&r1=1608543&r2=1608544&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
Mon Jul  7 18:29:25 2014
@@ -121,7 +121,7 @@ public class SOAPEnvelopeImpl extends SO
             // The SOAPHeader is added before the SOAPBody
             // We must be sensitive to the state of the parser.  It is possible that the
             // has not been processed yet.
-            if (state == COMPLETE) {
+            if (getState() == COMPLETE) {
                 // Parsing is complete, therefore it is safe to
                 // call getBody.
                 SOAPBody body = getBody();
@@ -204,6 +204,7 @@ public class SOAPEnvelopeImpl extends SO
             // let's try to close the builder/parser here since we are now done with the
             // non-caching code block serializing the top-level SOAPEnvelope element
             // TODO: should use 'instance of OMXMLParserWrapper' instead?  StAXBuilder is
more generic
+            OMXMLParserWrapper builder = getBuilder();
             if ((builder != null) && (builder instanceof StAXBuilder)) {
                 try {
                     if (log.isDebugEnabled()) {



Mime
View raw message