jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/DTMManager.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * reserved comment block |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT REMOVE OR ALTER! |
|
4 */ |
3 */ |
5 /* |
4 /* |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
5 * Licensed to the Apache Software Foundation (ASF) under one or more |
7 * contributor license agreements. See the NOTICE file distributed with |
6 * contributor license agreements. See the NOTICE file distributed with |
8 * this work for additional information regarding copyright ownership. |
7 * this work for additional information regarding copyright ownership. |
19 * limitations under the License. |
18 * limitations under the License. |
20 */ |
19 */ |
21 |
20 |
22 package com.sun.org.apache.xml.internal.dtm; |
21 package com.sun.org.apache.xml.internal.dtm; |
23 |
22 |
24 import com.sun.org.apache.xml.internal.res.XMLErrorResources; |
|
25 import com.sun.org.apache.xml.internal.res.XMLMessages; |
|
26 import com.sun.org.apache.xml.internal.utils.PrefixResolver; |
23 import com.sun.org.apache.xml.internal.utils.PrefixResolver; |
27 import com.sun.org.apache.xml.internal.utils.XMLStringFactory; |
24 import com.sun.org.apache.xml.internal.utils.XMLStringFactory; |
28 import com.sun.org.apache.xalan.internal.utils.ObjectFactory; |
|
29 import com.sun.org.apache.xalan.internal.utils.SecuritySupport; |
|
30 |
25 |
31 /** |
26 /** |
32 * A DTMManager instance can be used to create DTM and |
27 * A DTMManager instance can be used to create DTM and |
33 * DTMIterator objects, and manage the DTM objects in the system. |
28 * DTMIterator objects, and manage the DTM objects in the system. |
34 * |
29 * |
97 * DTMManager</code> it can use the factory to configure |
92 * DTMManager</code> it can use the factory to configure |
98 * and obtain parser instances. |
93 * and obtain parser instances. |
99 * |
94 * |
100 * @return new DTMManager instance, never null. |
95 * @return new DTMManager instance, never null. |
101 * |
96 * |
102 * @throws DTMConfigurationException |
97 * @throws DTMException |
103 * if the implementation is not available or cannot be instantiated. |
98 * if the implementation is not available or cannot be instantiated. |
104 */ |
99 */ |
105 public static DTMManager newInstance(XMLStringFactory xsf) |
100 public static DTMManager newInstance(XMLStringFactory xsf) |
106 throws DTMConfigurationException |
101 throws DTMException |
107 { |
102 { |
108 final DTMManager factoryImpl = new com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault(); |
103 final DTMManager factoryImpl = new com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault(); |
109 factoryImpl.setXMLStringFactory(xsf); |
104 factoryImpl.setXMLStringFactory(xsf); |
110 |
105 |
111 return factoryImpl; |
106 return factoryImpl; |
313 _useServicesMechanism = flag; |
308 _useServicesMechanism = flag; |
314 } |
309 } |
315 |
310 |
316 // -------------------- private methods -------------------- |
311 // -------------------- private methods -------------------- |
317 |
312 |
318 /** |
|
319 * Temp debug code - this will be removed after we test everything |
|
320 */ |
|
321 private static boolean debug; |
|
322 |
|
323 static |
|
324 { |
|
325 try |
|
326 { |
|
327 debug = SecuritySupport.getSystemProperty("dtm.debug") != null; |
|
328 } |
|
329 catch (SecurityException ex){} |
|
330 } |
|
331 |
|
332 /** This value, set at compile time, controls how many bits of the |
313 /** This value, set at compile time, controls how many bits of the |
333 * DTM node identifier numbers are used to identify a node within a |
314 * DTM node identifier numbers are used to identify a node within a |
334 * document, and thus sets the maximum number of nodes per |
315 * document, and thus sets the maximum number of nodes per |
335 * document. The remaining bits are used to identify the DTM |
316 * document. The remaining bits are used to identify the DTM |
336 * document which contains this node. |
317 * document which contains this node. |
392 */ |
373 */ |
393 public int getNodeIdentityMask() |
374 public int getNodeIdentityMask() |
394 { |
375 { |
395 return IDENT_NODE_DEFAULT; |
376 return IDENT_NODE_DEFAULT; |
396 } |
377 } |
397 |
|
398 // |
|
399 // Classes |
|
400 // |
|
401 |
|
402 /** |
|
403 * A configuration error. |
|
404 * Originally in ObjectFactory. This is the only portion used in this package |
|
405 */ |
|
406 static class ConfigurationError |
|
407 extends Error { |
|
408 static final long serialVersionUID = 5122054096615067992L; |
|
409 // |
|
410 // Data |
|
411 // |
|
412 |
|
413 /** Exception. */ |
|
414 private Exception exception; |
|
415 |
|
416 // |
|
417 // Constructors |
|
418 // |
|
419 |
|
420 /** |
|
421 * Construct a new instance with the specified detail string and |
|
422 * exception. |
|
423 */ |
|
424 ConfigurationError(String msg, Exception x) { |
|
425 super(msg); |
|
426 this.exception = x; |
|
427 } // <init>(String,Exception) |
|
428 |
|
429 // |
|
430 // Public methods |
|
431 // |
|
432 |
|
433 /** Returns the exception associated to this error. */ |
|
434 Exception getException() { |
|
435 return exception; |
|
436 } // getException():Exception |
|
437 |
|
438 } // class ConfigurationError |
|
439 |
|
440 } |
378 } |