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 2011/10/15 00:27:56 UTC
svn commit: r1183531 - in
/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common:
OMStAXWrapper.java SwitchingWrapper.java
Author: veithen
Date: Fri Oct 14 22:27:55 2011
New Revision: 1183531
URL: http://svn.apache.org/viewvc?rev=1183531&view=rev
Log:
Removed some unused internal code and made the code in SwitchingWrapper a bit easier to understand.
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMStAXWrapper.java
webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMStAXWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMStAXWrapper.java?rev=1183531&r1=1183530&r2=1183531&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMStAXWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMStAXWrapper.java Fri Oct 14 22:27:55 2011
@@ -137,10 +137,6 @@ public class OMStAXWrapper extends Strea
return switchingWrapper.getBuilder();
}
- public boolean isAllowSwitching() {
- return switchingWrapper.isAllowSwitching();
- }
-
public boolean isClosed() {
return switchingWrapper.isClosed();
}
@@ -149,10 +145,6 @@ public class OMStAXWrapper extends Strea
switchingWrapper.releaseParserOnClose(value);
}
- public void setAllowSwitching(boolean b) {
- switchingWrapper.setAllowSwitching(b);
- }
-
public void setParser(XMLStreamReader parser) {
switchingWrapper.setParser(parser);
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java?rev=1183531&r1=1183530&r2=1183531&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java Fri Oct 14 22:27:55 2011
@@ -114,13 +114,11 @@ class SwitchingWrapper extends AbstractX
/** Field currentEvent Default set to START_DOCUMENT */
private int currentEvent = START_DOCUMENT;
- // SwitchingAllowed is set to false by default.
- // This means that unless the user explicitly states
- // that he wants things not to be cached, everything will
- // be cached.
-
- /** Field switchingAllowed */
- boolean switchingAllowed = false;
+ /**
+ * Specifies whether the original document content is cached (i.e. whether the object model is
+ * built) or can be consumed.
+ */
+ private final boolean cache;
// namespaceURI interning
// default is false because most XMLStreamReader implementations don't do interning
@@ -161,24 +159,6 @@ class SwitchingWrapper extends AbstractX
private OMNamespace[] namespaces = new OMNamespace[16];
/**
- * Method setAllowSwitching.
- *
- * @param b
- */
- public void setAllowSwitching(boolean b) {
- this.switchingAllowed = b;
- }
-
- /**
- * Method isAllowSwitching.
- *
- * @return Returns boolean.
- */
- public boolean isAllowSwitching() {
- return switchingAllowed;
- }
-
- /**
* Set namespace uri interning
* @param b
*/
@@ -207,6 +187,7 @@ class SwitchingWrapper extends AbstractX
this.navigator = new OMNavigator(startNode);
this.builder = builder;
this.rootNode = startNode;
+ this.cache = cache;
// initiate the next and current nodes
// Note - navigator is written in such a way that it first
@@ -226,11 +207,10 @@ class SwitchingWrapper extends AbstractX
} catch(Throwable t) {}
currentNode = navigator.getNext();
- updateNextNode();
+ updateNextNode(false);
if (resetCache) {
builder.setCache(cache);
}
- switchingAllowed = !cache;
if (startNode instanceof OMDocument) {
try {
@@ -1091,14 +1071,14 @@ class SwitchingWrapper extends AbstractX
namespaceCount = -1;
currentNode = nextNode;
try {
- updateNextNode();
+ updateNextNode(!cache);
} catch (Exception e) {
throw new XMLStreamException(e);
}
}
/** Method updateNextNode. */
- private void updateNextNode() {
+ private void updateNextNode(boolean switchingAllowed) {
if (navigator.isNavigable()) {
nextNode = navigator.getNext();
} else {