dtmmanager.java
来自「java jdk 1.4的源码」· Java 代码 · 共 585 行 · 第 1/2 页
JAVA
585 行
* a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>. * * @param xpathString Must be a valid string expressing a * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or * a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>. * * @param presolver An object that can resolve prefixes to namespace URLs. * * @return The newly created <code>DTMIterator</code>. */ public abstract DTMIterator createDTMIterator(String xpathString, PrefixResolver presolver); /** * Create a new <code>DTMIterator</code> based only on a whatToShow * and a DTMFilter. The traversal semantics are defined as the * descendant access. * <p> * Note that DTMIterators may not be an exact match to DOM * NodeIterators. They are initialized and used in much the same way * as a NodeIterator, but their response to document mutation is not * currently defined. * * @param whatToShow This flag specifies which node types may appear in * the logical view of the tree presented by the iterator. See the * description of <code>NodeFilter</code> for the set of possible * <code>SHOW_</code> values.These flags can be combined using * <code>OR</code>. * @param filter The <code>NodeFilter</code> to be used with this * <code>DTMFilter</code>, or <code>null</code> to indicate no filter. * @param entityReferenceExpansion The value of this flag determines * whether entity reference nodes are expanded. * * @return The newly created <code>DTMIterator</code>. */ public abstract DTMIterator createDTMIterator(int whatToShow, DTMFilter filter, boolean entityReferenceExpansion); /** * Create a new <code>DTMIterator</code> that holds exactly one node. * * @param node The node handle that the DTMIterator will iterate to. * * @return The newly created <code>DTMIterator</code>. */ public abstract DTMIterator createDTMIterator(int node); /* Flag indicating whether an incremental transform is desired */ public static boolean m_incremental = false; /** * Set a flag indicating whether an incremental transform is desired * @param incremental boolean to use to set m_incremental. * */ public synchronized static boolean getIncremental() { return m_incremental; } /** * Set a flag indicating whether an incremental transform is desired * @param incremental boolean to use to set m_incremental. * */ public synchronized static void setIncremental(boolean incremental) { m_incremental = incremental; } // -------------------- private methods -------------------- /** * Avoid reading all the files when the findFactory * method is called the second time (cache the result of * finding the default impl). */ private static String foundFactory = null; /** * Temp debug code - this will be removed after we test everything */ private static boolean debug; static { try { debug = System.getProperty("dtm.debug") != null; } catch (SecurityException ex){} } /** * Private implementation method - will find the implementation * class in the specified order. * * @param factoryId Name of the factory interface. * @param xmlProperties Name of the properties file based on JAVA/lib. * @param defaultFactory Default implementation, if nothing else is found. * * @return The factory class name. */ private static String findFactory(String factoryId, String defaultFactory) { // Use the system property first try { String systemProp = null; try { systemProp = System.getProperty(factoryId); } catch (SecurityException se){} if (systemProp != null) { if (debug) { System.err.println("DTM: found system property" + systemProp); } return systemProp; } } catch (SecurityException se){} if (foundFactory != null) { return foundFactory; } // try to read from $java.home/lib/jaxp.properties try { String javah = System.getProperty("java.home"); String configFile = javah + File.separator + "lib" + File.separator + "jaxp.properties"; File f = new File(configFile); if (f.exists()) { Properties props = new Properties(); props.load(new FileInputStream(f)); foundFactory = props.getProperty(factoryId); if (debug) { System.err.println("DTM: found java.home property " + foundFactory); } if (foundFactory != null) { return foundFactory; } } } catch (Exception ex) { if (debug) { ex.printStackTrace(); } } String serviceId = "META-INF/services/" + factoryId; // try to find services in CLASSPATH try { ClassLoader cl = DTMManager.class.getClassLoader(); InputStream is = null; if (cl == null) { is = ClassLoader.getSystemResourceAsStream(serviceId); } else { is = cl.getResourceAsStream(serviceId); } if (is != null) { if (debug) { System.err.println("DTM: found " + serviceId); } BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); foundFactory = rd.readLine(); rd.close(); if (debug) { System.err.println("DTM: loaded from services: " + foundFactory); } if ((foundFactory != null) &&!"".equals(foundFactory)) { return foundFactory; } } } catch (Exception ex) { if (debug) { ex.printStackTrace(); } } return defaultFactory; } /** This value, set at compile time, controls how many bits of the * DTM node identifier numbers are used to identify a node within a * document, and thus sets the maximum number of nodes per * document. The remaining bits are used to identify the DTM * document which contains this node. * * If you change IDENT_DTM_NODE_BITS, be sure to rebuild _ALL_ the * files which use it... including the IDKey testcases. * * (FuncGenerateKey currently uses the node identifier directly and * thus is affected when this changes. The IDKEY results will still be * _correct_ (presuming no other breakage), but simple equality * comparison against the previous "golden" files will probably * complain.) * */ public static final int IDENT_DTM_NODE_BITS = 16; /** When this bitmask is ANDed with a DTM node handle number, the result * is the low bits of the node's index number within that DTM. To obtain * the high bits, add the DTM ID portion's offset as assigned in the DTM * Manager. */ public static final int IDENT_NODE_DEFAULT = (1<<IDENT_DTM_NODE_BITS)-1; /** When this bitmask is ANDed with a DTM node handle number, the result * is the DTM's document identity number. */ public static final int IDENT_DTM_DEFAULT = ~IDENT_NODE_DEFAULT; /** This is the maximum number of DTMs available. The highest DTM is * one less than this. */ public static final int IDENT_MAX_DTMS = (IDENT_DTM_DEFAULT >>> IDENT_DTM_NODE_BITS) + 1; /** * %TBD% Doc * * NEEDSDOC @param dtm * * NEEDSDOC ($objectName$) @return */ public abstract int getDTMIdentity(DTM dtm); /** * %TBD% Doc * * NEEDSDOC ($objectName$) @return */ public int getDTMIdentityMask() { return IDENT_DTM_DEFAULT; } /** * %TBD% Doc * * NEEDSDOC ($objectName$) @return */ public int getNodeIdentityMask() { return IDENT_NODE_DEFAULT; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?