jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/DTMManager.java
author joehw
Tue, 14 Feb 2017 10:14:06 -0800
changeset 46005 49e2e73f90f6
parent 44797 8b3b3b911b8a
permissions -rw-r--r--
8172469: Transform Transformer Exceptions Reviewed-by: dfuchs, lancea, rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
46005
49e2e73f90f6 8172469: Transform Transformer Exceptions
joehw
parents: 44797
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
/*
44797
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     5
 * Licensed to the Apache Software Foundation (ASF) under one or more
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     6
 * contributor license agreements.  See the NOTICE file distributed with
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     7
 * this work for additional information regarding copyright ownership.
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     8
 * The ASF licenses this file to You under the Apache License, Version 2.0
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
     9
 * (the "License"); you may not use this file except in compliance with
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
    10
 * the License.  You may obtain a copy of the License at
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
44797
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
44797
8b3b3b911b8a 8162572: Update License Header for all JAXP sources
joehw
parents: 25868
diff changeset
    20
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xml.internal.dtm;
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
import com.sun.org.apache.xml.internal.utils.PrefixResolver;
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
 * A DTMManager instance can be used to create DTM and
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
 * DTMIterator objects, and manage the DTM objects in the system.
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 * <p>The system property that determines which Factory implementation
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * to create is named "com.sun.org.apache.xml.internal.utils.DTMFactory". This
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 * property names a concrete subclass of the DTMFactory abstract
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 *  class. If the property is not defined, a platform default is be used.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * <p>An instance of this class <emph>must</emph> be safe to use across
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * thread instances.  It is expected that a client will create a single instance
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * of a DTMManager to use across multiple threads.  This will allow sharing
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * of DTMs across multiple processes.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * <p>Note: this class is incomplete right now.  It will be pretty much
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * modeled after javax.xml.transform.TransformerFactory in terms of its
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * factory support.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * <p>State: In progress!!</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
public abstract class DTMManager
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
{
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
   * Factory for creating XMLString objects.
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
   *  %TBD% Make this set by the caller.
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
  protected XMLStringFactory m_xsf = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
    55
  private boolean _useServicesMechanism;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
   * Default constructor is protected on purpose.
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
  protected DTMManager(){}
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
   * Get the XMLStringFactory used for the DTMs.
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
   * @return a valid XMLStringFactory object, or null if it hasn't been set yet.
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
  public XMLStringFactory getXMLStringFactory()
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
    return m_xsf;
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
   * Set the XMLStringFactory used for the DTMs.
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
   * @param xsf a valid XMLStringFactory object, should not be null.
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
  public void setXMLStringFactory(XMLStringFactory xsf)
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
    m_xsf = xsf;
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
   * Obtain a new instance of a <code>DTMManager</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
   * This static method creates a new factory instance
18352
a1e183c996d6 8013434: Xalan and Xerces internal ObjectFactory need rework
dfuchs
parents: 16953
diff changeset
    86
   * using the default <code>DTMManager</code> implementation, which is
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
   * <code>com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
   * </li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
   * </ul>
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
   * Once an application has obtained a reference to a <code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
   * DTMManager</code> it can use the factory to configure
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
   * and obtain parser instances.
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
   * @return new DTMManager instance, never null.
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
   *
46005
49e2e73f90f6 8172469: Transform Transformer Exceptions
joehw
parents: 44797
diff changeset
    97
   * @throws DTMException
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
   * if the implementation is not available or cannot be instantiated.
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
  public static DTMManager newInstance(XMLStringFactory xsf)
46005
49e2e73f90f6 8172469: Transform Transformer Exceptions
joehw
parents: 44797
diff changeset
   101
           throws DTMException
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
  {
18352
a1e183c996d6 8013434: Xalan and Xerces internal ObjectFactory need rework
dfuchs
parents: 16953
diff changeset
   103
      final DTMManager factoryImpl = new com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault();
a1e183c996d6 8013434: Xalan and Xerces internal ObjectFactory need rework
dfuchs
parents: 16953
diff changeset
   104
      factoryImpl.setXMLStringFactory(xsf);
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   105
18352
a1e183c996d6 8013434: Xalan and Xerces internal ObjectFactory need rework
dfuchs
parents: 16953
diff changeset
   106
      return factoryImpl;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
   * Get an instance of a DTM, loaded with the content from the
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
   * specified source.  If the unique flag is true, a new instance will
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
   * always be returned.  Otherwise it is up to the DTMManager to return a
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
   * new instance or an instance that it already created and may be being used
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
   * by someone else.
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
   * (More parameters may eventually need to be added for error handling
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
   * and entity resolution, and to better control selection of implementations.)
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
   * @param source the specification of the source object, which may be null,
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
   *               in which case it is assumed that node construction will take
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
   *               by some other means.
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
   * @param unique true if the returned DTM must be unique, probably because it
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
   * is going to be mutated.
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
   * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
   *                         be null.
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
   * @param incremental true if the DTM should be built incrementally, if
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
   *                    possible.
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
   * @param doIndexing true if the caller considers it worth it to use
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
   *                   indexing schemes.
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
   * @return a non-null DTM reference.
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
  public abstract DTM getDTM(javax.xml.transform.Source source,
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
                             boolean unique, DTMWSFilter whiteSpaceFilter,
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
                             boolean incremental, boolean doIndexing);
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
   * Get the instance of DTM that "owns" a node handle.
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
   * @param nodeHandle the nodeHandle.
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
   * @return a non-null DTM reference.
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
  public abstract DTM getDTM(int nodeHandle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
   * Given a W3C DOM node, try and return a DTM handle.
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
   * Note: calling this may be non-optimal.
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
   * @param node Non-null reference to a DOM node.
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
   * @return a valid DTM handle.
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
  public abstract int getDTMHandleFromNode(org.w3c.dom.Node node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
   * Creates a DTM representing an empty <code>DocumentFragment</code> object.
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
   * @return a non-null DTM reference.
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
  public abstract DTM createDocumentFragment();
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
   * Release a DTM either to a lru pool, or completely remove reference.
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
   * DTMs without system IDs are always hard deleted.
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
   * State: experimental.
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
   * @param dtm The DTM to be released.
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
   * @param shouldHardDelete True if the DTM should be removed no matter what.
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
   * @return true if the DTM was removed, false if it was put back in a lru pool.
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
  public abstract boolean release(DTM dtm, boolean shouldHardDelete);
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
   * Create a new <code>DTMIterator</code> based on an XPath
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
   * a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
   * @param xpathCompiler ??? Somehow we need to pass in a subpart of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
   * expression.  I hate to do this with strings, since the larger expression
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
   * has already been parsed.
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
   * @param pos The position in the expression.
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
   * @return The newly created <code>DTMIterator</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
  public abstract DTMIterator createDTMIterator(Object xpathCompiler,
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
          int pos);
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
   * Create a new <code>DTMIterator</code> based on an XPath
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
   * a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
   * @param xpathString Must be a valid string expressing a
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
   * a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
   * @param presolver An object that can resolve prefixes to namespace URLs.
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
   * @return The newly created <code>DTMIterator</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
  public abstract DTMIterator createDTMIterator(String xpathString,
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
          PrefixResolver presolver);
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
   * Create a new <code>DTMIterator</code> based only on a whatToShow
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
   * and a DTMFilter.  The traversal semantics are defined as the
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
   * descendant access.
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
   * <p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
   * Note that DTMIterators may not be an exact match to DOM
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
   * NodeIterators. They are initialized and used in much the same way
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
   * as a NodeIterator, but their response to document mutation is not
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
   * currently defined.
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
   * @param whatToShow This flag specifies which node types may appear in
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
   *   the logical view of the tree presented by the iterator. See the
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
   *   description of <code>NodeFilter</code> for the set of possible
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
   *   <code>SHOW_</code> values.These flags can be combined using
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
   *   <code>OR</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
   * @param filter The <code>NodeFilter</code> to be used with this
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
   *   <code>DTMFilter</code>, or <code>null</code> to indicate no filter.
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
   * @param entityReferenceExpansion The value of this flag determines
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
   *   whether entity reference nodes are expanded.
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
   * @return The newly created <code>DTMIterator</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
  public abstract DTMIterator createDTMIterator(int whatToShow,
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
          DTMFilter filter, boolean entityReferenceExpansion);
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
   * Create a new <code>DTMIterator</code> that holds exactly one node.
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
   * @param node The node handle that the DTMIterator will iterate to.
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
   * @return The newly created <code>DTMIterator</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
  public abstract DTMIterator createDTMIterator(int node);
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
  /* Flag indicating whether an incremental transform is desired */
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
  public boolean m_incremental = false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
  /*
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
   * Flag set by FEATURE_SOURCE_LOCATION.
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
   * This feature specifies whether the transformation phase should
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
   * keep track of line and column numbers for the input source
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
   * document.
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
  public boolean m_source_location = false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
   * Get a flag indicating whether an incremental transform is desired
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
   * @return incremental boolean.
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
  public boolean getIncremental()
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
    return m_incremental;
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
   * Set a flag indicating whether an incremental transform is desired
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
   * This flag should have the same value as the FEATURE_INCREMENTAL feature
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
   * which is set by the TransformerFactory.setAttribut() method before a
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
   * DTMManager is created
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
   * @param incremental boolean to use to set m_incremental.
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
  public void setIncremental(boolean incremental)
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
    m_incremental = incremental;
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
   * Get a flag indicating whether the transformation phase should
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
   * keep track of line and column numbers for the input source
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
   * document.
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
   * @return source location boolean
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
  public boolean getSource_location()
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
    return m_source_location;
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
   * Set a flag indicating whether the transformation phase should
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
   * keep track of line and column numbers for the input source
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
   * document.
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
   * This flag should have the same value as the FEATURE_SOURCE_LOCATION feature
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
   * which is set by the TransformerFactory.setAttribut() method before a
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
   * DTMManager is created
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
   * @param sourceLocation boolean to use to set m_source_location
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
  public void setSource_location(boolean sourceLocation){
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
    m_source_location = sourceLocation;
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   297
    /**
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   298
     * Return the state of the services mechanism feature.
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   299
     */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   300
    public boolean useServicesMechnism() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   301
        return _useServicesMechanism;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   302
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   303
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   304
    /**
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   305
     * Set the state of the services mechanism feature.
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   306
     */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   307
    public void setServicesMechnism(boolean flag) {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   308
        _useServicesMechanism = flag;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents: 12457
diff changeset
   309
    }
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
  // -------------------- private methods --------------------
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
  /** This value, set at compile time, controls how many bits of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
   * DTM node identifier numbers are used to identify a node within a
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
   * document, and thus sets the maximum number of nodes per
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
   * document. The remaining bits are used to identify the DTM
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
   * document which contains this node.
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
   * If you change IDENT_DTM_NODE_BITS, be sure to rebuild _ALL_ the
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
   * files which use it... including the IDKey testcases.
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
   * (FuncGenerateKey currently uses the node identifier directly and
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
   * thus is affected when this changes. The IDKEY results will still be
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
   * _correct_ (presuming no other breakage), but simple equality
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
   * comparison against the previous "golden" files will probably
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
   * complain.)
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
   * */
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
  public static final int IDENT_DTM_NODE_BITS = 16;
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
  /** When this bitmask is ANDed with a DTM node handle number, the result
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
   * is the low bits of the node's index number within that DTM. To obtain
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
   * the high bits, add the DTM ID portion's offset as assigned in the DTM
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
   * Manager.
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
  public static final int IDENT_NODE_DEFAULT = (1<<IDENT_DTM_NODE_BITS)-1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
  /** When this bitmask is ANDed with a DTM node handle number, the result
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
   * is the DTM's document identity number.
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
  public static final int IDENT_DTM_DEFAULT = ~IDENT_NODE_DEFAULT;
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
  /** This is the maximum number of DTMs available.  The highest DTM is
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
    * one less than this.
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
  public static final int IDENT_MAX_DTMS = (IDENT_DTM_DEFAULT >>> IDENT_DTM_NODE_BITS) + 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
   * %TBD% Doc
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   353
   * NEEDSDOC @param dtm
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
   * NEEDSDOC ($objectName$) @return
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
  public abstract int getDTMIdentity(DTM dtm);
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
   * %TBD% Doc
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   362
   * NEEDSDOC ($objectName$) @return
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
  public int getDTMIdentityMask()
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
    return IDENT_DTM_DEFAULT;
7f561c08de6b Initial load
duke
parents:
diff changeset
   367
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   368
7f561c08de6b Initial load
duke
parents:
diff changeset
   369
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   370
   * %TBD% Doc
7f561c08de6b Initial load
duke
parents:
diff changeset
   371
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   372
   * NEEDSDOC ($objectName$) @return
7f561c08de6b Initial load
duke
parents:
diff changeset
   373
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   374
  public int getNodeIdentityMask()
7f561c08de6b Initial load
duke
parents:
diff changeset
   375
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   376
    return IDENT_NODE_DEFAULT;
7f561c08de6b Initial load
duke
parents:
diff changeset
   377
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   378
}