1 16 19 package org.apache.xml.dtm; 20 21 import org.apache.xml.res.XMLErrorResources; 22 import org.apache.xml.res.XMLMessages; 23 import org.apache.xml.utils.PrefixResolver; 24 import org.apache.xml.utils.XMLStringFactory; 25 26 46 public abstract class DTMManager 47 { 48 49 50 private static final String defaultPropName = 51 "org.apache.xml.dtm.DTMManager"; 52 53 54 private static String defaultClassName = 55 "org.apache.xml.dtm.ref.DTMManagerDefault"; 56 57 61 protected XMLStringFactory m_xsf = null; 62 63 66 protected DTMManager(){} 67 68 74 public XMLStringFactory getXMLStringFactory() 75 { 76 return m_xsf; 77 } 78 79 85 public void setXMLStringFactory(XMLStringFactory xsf) 86 { 87 m_xsf = xsf; 88 } 89 90 129 public static DTMManager newInstance(XMLStringFactory xsf) 130 throws DTMConfigurationException 131 { 132 DTMManager factoryImpl = null; 133 try 134 { 135 factoryImpl = (DTMManager) ObjectFactory 136 .createObject(defaultPropName, defaultClassName); 137 } 138 catch (ObjectFactory.ConfigurationError e) 139 { 140 throw new DTMConfigurationException(XMLMessages.createXMLMessage( 141 XMLErrorResources.ER_NO_DEFAULT_IMPL, null), e.getException()); 142 } 144 145 if (factoryImpl == null) 146 { 147 throw new DTMConfigurationException(XMLMessages.createXMLMessage( 148 XMLErrorResources.ER_NO_DEFAULT_IMPL, null)); 149 } 151 152 factoryImpl.setXMLStringFactory(xsf); 153 154 return factoryImpl; 155 } 156 157 181 public abstract DTM getDTM(javax.xml.transform.Source source, 182 boolean unique, DTMWSFilter whiteSpaceFilter, 183 boolean incremental, boolean doIndexing); 184 185 192 public abstract DTM getDTM(int nodeHandle); 193 194 202 public abstract int getDTMHandleFromNode(org.w3c.dom.Node node); 203 204 208 public abstract DTM createDocumentFragment(); 209 210 219 public abstract boolean release(DTM dtm, boolean shouldHardDelete); 220 221 233 public abstract DTMIterator createDTMIterator(Object xpathCompiler, 234 int pos); 235 236 249 public abstract DTMIterator createDTMIterator(String xpathString, 250 PrefixResolver presolver); 251 252 274 public abstract DTMIterator createDTMIterator(int whatToShow, 275 DTMFilter filter, boolean entityReferenceExpansion); 276 277 284 public abstract DTMIterator createDTMIterator(int node); 285 286 287 public static boolean m_incremental = false; 288 289 294 public synchronized static boolean getIncremental() 295 { 296 return m_incremental; 297 } 298 299 304 public synchronized static void setIncremental(boolean incremental) 305 { 306 m_incremental = incremental; 307 } 308 309 310 311 313 316 private static boolean debug; 317 318 static 319 { 320 try 321 { 322 debug = System.getProperty("dtm.debug") != null; 323 } 324 catch (SecurityException ex){} 325 } 326 327 342 public static final int IDENT_DTM_NODE_BITS = 16; 343 344 345 350 public static final int IDENT_NODE_DEFAULT = (1<<IDENT_DTM_NODE_BITS)-1; 351 352 353 356 public static final int IDENT_DTM_DEFAULT = ~IDENT_NODE_DEFAULT; 357 358 361 public static final int IDENT_MAX_DTMS = (IDENT_DTM_DEFAULT >>> IDENT_DTM_NODE_BITS) + 1; 362 363 364 371 public abstract int getDTMIdentity(DTM dtm); 372 373 378 public int getDTMIdentityMask() 379 { 380 return IDENT_DTM_DEFAULT; 381 } 382 383 388 public int getNodeIdentityMask() 389 { 390 return IDENT_NODE_DEFAULT; 391 } 392 393 } 394 | Popular Tags |