jkesselm 01/12/11 09:13:32
Modified: java/src/org/apache/xpath CachedXPathAPI.java
XPathContext.java
Log:
Changes requested by the xml-security group:
1) Provide something a constructor that allows sharing the
XPathContext object between CachedXPathAPI objects
2) Add getXPathContext(). I'm just a bit nervious about this
method, but they assure us they need it and the field isn't
private. We may need to discus this one further.
3) Make the XPathContext's m_dtmManager member
protected rather than private, so their subclass can get to it.
We may want to work with them to understand why they're
accessing this directly and whether there's a better solution.
Revision Changes Path
1.2 +38 -3 xml-xalan/java/src/org/apache/xpath/CachedXPathAPI.java
Index: CachedXPathAPI.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/CachedXPathAPI.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CachedXPathAPI.java 2001/11/29 16:30:47 1.1
+++ CachedXPathAPI.java 2001/12/11 17:13:31 1.2
@@ -100,10 +100,45 @@
* */
public class CachedXPathAPI
{
- /** XPathContext, and thus DTMManager and DTMs, persists through multiple
- calls to this object.
+ /** XPathContext, and thus the document model system (DTMs), persists
through multiple
+ calls to this object. This is set in the constructor.
*/
- XPathContext xpathSupport = new XPathContext();
+ protected XPathContext xpathSupport;
+
+ /** Default constructor. Establishes its own XPathContext, and hence
+ * its own DTMManager. Good choice for simple uses.
+ * */
+ public CachedXPathAPI()
+ {
+ xpathSupport = new XPathContext();
+ }
+
+ /** This constructor shares its XPathContext with a pre-existing
+ * CachedXPathAPI. That allows sharing document models (DTMs) and
+ * previously established location state.
+ *
+ * Note that the original CachedXPathAPI and the new one should not
+ * be operated concurrently; we do not support multithreaded access
+ * to a single DTM at this time.
+ *
+ * %REVIEW% Should this instead do a clone-and-reset on the XPathSupport
object?
+ * */
+ public CachedXPathAPI(CachedXPathAPI priorXPathAPI)
+ {
+ xpathSupport = priorXPathAPI.xpathSupport;
+ }
+
+
+ /** Returns the XPathSupport object used in this CachedXPathAPI
+ *
+ * %REVIEW% I'm somewhat concerned about the loss of encapsulation
+ * this causes, but the xml-security folks say they need it.
+ * */
+ public XPathContext getXPathContext()
+ {
+ return this.xpathSupport;
+ }
+
/**
* Use an XPath string to select a single node. XPath namespace
1.31 +1 -1 xml-xalan/java/src/org/apache/xpath/XPathContext.java
Index: XPathContext.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- XPathContext.java 2001/08/20 23:47:11 1.30
+++ XPathContext.java 2001/12/11 17:13:31 1.31
@@ -125,7 +125,7 @@
* the DTMManager, it really is a proxy for this object, which
* is the real DTMManager.
*/
- private DTMManager m_dtmManager = DTMManager.newInstance(
+ protected DTMManager m_dtmManager = DTMManager.newInstance(
org.apache.xpath.objects.XMLStringFactoryImpl.getFactory());
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]