Author: scheu
Date: Thu Nov 15 04:42:47 2007
New Revision: 595292
URL: http://svn.apache.org/viewvc?rev=595292&view=rev
Log:
WSCOMMONS-280
Contributor:Rich Scheuerle
Performance Analysis Provided by: David Strite
Added capability to OMStAXWrapper to control interning of namespace uri Strings.
The default is false, due to performance concerns.
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java?rev=595292&r1=595291&r2=595292&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
Thu Nov 15 04:42:47 2007
@@ -96,6 +96,11 @@
/** Field switchingAllowed */
boolean switchingAllowed = false;
+
+ // namespaceURI interning
+ // default is false because most XMLStreamReader implementations don't do
interning
+ // due to performance impacts
+ boolean namespaceURIInterning = false;
/** Field elementStack */
private Stack elementStack = null;
@@ -141,6 +146,22 @@
}
/**
+ * Set namespace uri interning
+ * @param b
+ */
+ public void setNamespaceURIInterning(boolean b) {
+ this.namespaceURIInterning = b;
+ }
+
+ /**
+ * @return if namespace uri interning
+ */
+ public boolean isNamespaceURIInterning() {
+ return this.namespaceURIInterning;
+ }
+
+
+ /**
* When constructing the OMStaxWrapper, the creator must produce the
builder (an instance of the
* OMXMLparserWrapper of the input) and the Element Node to start parsing.
The wrapper will
* parse(proceed) until the end of the given element. Hence care should be
taken to pass the
@@ -218,7 +239,16 @@
: ns.getNamespaceURI();
}
}
- return (returnStr != null) ? returnStr.intern() : null;
+
+ // By default most parsers don't intern the namespace.
+ // Unfortunately the property to detect interning on the delegate
parsers is hard to detect.
+ // Woodstox has a proprietary property on the XMLInputFactory.
+ // IBM has a proprietary property on the XMLStreamReader.
+ // For now only force the interning if requested.
+ if (this.isNamespaceURIInterning()) {
+ returnStr = (returnStr != null) ? returnStr.intern() : null;
+ }
+ return returnStr;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]