The default implementation for the DTMManager.
%REVIEW% There is currently a reentrancy issue, since the finalizer
for XRTreeFrag (which runs in the GC thread) wants to call
DTMManager.release(), and may do so at the same time that the main
transformation thread is accessing the manager. Our current solution is
to make most of the manager's methods synchronized.
Early tests suggest that doing so is not causing a significant
performance hit in Xalan. However, it should be noted that there
is a possible alternative solution: rewrite release() so it merely
posts a request for release onto a threadsafe queue, and explicitly
process that queue on an infrequent basis during main-thread
activity (eg, when getDTM() is invoked). The downside of that solution
would be a greater delay before the DTM's storage is actually released
Map from DTM identifier numbers to DTM objects that this manager manages.
One DTM may have several prefix numbers, if extended node indexing
is in use; in that case, m_dtm_offsets will used to control which
prefix maps to which section of the DTM.
This array grows as necessary; see addDTM().
This array grows as necessary; see addDTM(). Growth is uncommon... but
access needs to be blindingly fast since it's used in node addressing.
offset - Integer addressing offset. The internal DTM Node ID is
obtained by adding this offset to the node-number field of the
public DTM Handle. For the first DTM ID accessing each DTM, this is 0;
for overflow addressing it will be a multiple of 1<
public int getFirstFreeDTMID()
Get the first free DTM ID available. %OPT% Linear search is inefficient!
Get an instance of a DTM, loaded with the content from the
specified source. If the unique flag is true, a new instance will
always be returned. Otherwise it is up to the DTMManager to return a
new instance or an instance that it already created and may be being used
by someone else.
A bit of magic in this implementation: If the source is null, unique is true,
and incremental and doIndexing are both false, we return an instance of
SAX2RTFDTM, which see.
(I think more parameters will need to be added for error handling, and entity
resolution, and more explicit control of the RTF situation).
This method returns the SAX2 parser to use with the InputSource
obtained from this URI.
It may return null if any SAX2-conformant XML parser can be used,
or if getInputSource() will also return null. The parser must
be free for use (i.e., not currently in use for another parse().
After use of the parser is completed, the releaseXMLReader(XMLReader)
must be called.
inputSource - The value returned from the URIResolver.
a SAX2 XMLReader to use to resolve the inputSource argument.
Indicates that the XMLReader object is no longer in use for the transform.
Note that the getXMLReader method may return an XMLReader that was
specified on the SAXSource object by the application code. Such a
reader should still be passed to releaseXMLReader, but the reader manager
will only re-use XMLReaders that it created.
shouldHardDelete - If false, this call is a suggestion rather than an
order, and we may not actually release the DTM. This is intended to
support intelligent caching of documents... which is not implemented
in this version of the DTM manager.
true if the DTM was released, false if shouldHardDelete was set
and we decided not to.
whatToShow - This flag specifies which node types may appear in
the logical view of the tree presented by the iterator. See the
description of NodeFilter for the set of possible
SHOW_ values.These flags can be combined using
filter - The NodeFilter to be used with this
DTMFilter, or null to indicate no filter.
entityReferenceExpansion - The value of this flag determines
whether entity reference nodes are expanded.