wt.util.xml.jaxp
Class JAXPFactories

java.lang.Object
  extended bywt.util.xml.jaxp.JAXPFactories

public final class JAXPFactories
extends Object

Simple class to lazily instantiate and cache JAXP factories for a single thread (i.e. instances of this class are not thread safe).


Field Summary
private static String DEFAULT_DOC_BUILDER_FACTORY
           
private static String DEFAULT_SAX_PARSER_FACTORY
           
private static String DEFAULT_TRANSFORMER_FACTORY
           
private  DocumentBuilderFactory documentBuilderFactory
           
private  SAXParserFactory saxParserFactory
           
private  TransformerFactory transformerFactory
           
 
Constructor Summary
JAXPFactories()
          Public contructor.
JAXPFactories(SAXParserFactory saxParserFactory, DocumentBuilderFactory documentBuilderFactory, TransformerFactory transformerFactory)
          Public contructor.
 
Method Summary
 DocumentBuilderFactory getDocumentBuilderFactory()
          Fetches preferred DOM implementation or JAXP one if preferred implementation is not available.
private static Object getFactoryInstance(String defaultClassName)
           
 SAXParserFactory getSAXParserFactory()
          Fetches preferred SAX implementation or JAXP one if preferred implementation is not available.
 SAXTransformerFactory getSAXTransformerFactory()
          Fetches preferred XSLT implementation or JAXP one if preferred implementation is not available.
 TransformerFactory getTransformerFactory()
          Fetches preferred XSLT implementation or JAXP one if preferred implementation is not available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SAX_PARSER_FACTORY

private static final String DEFAULT_SAX_PARSER_FACTORY
See Also:
Constant Field Values

DEFAULT_DOC_BUILDER_FACTORY

private static final String DEFAULT_DOC_BUILDER_FACTORY
See Also:
Constant Field Values

DEFAULT_TRANSFORMER_FACTORY

private static final String DEFAULT_TRANSFORMER_FACTORY
See Also:
Constant Field Values

saxParserFactory

private SAXParserFactory saxParserFactory

documentBuilderFactory

private DocumentBuilderFactory documentBuilderFactory

transformerFactory

private TransformerFactory transformerFactory
Constructor Detail

JAXPFactories

public JAXPFactories()
Public contructor. As already noted, instances of this class should only be used within a single thread (at a time). Each instance caches instances of all factories found, so there is very little overhead in repeated method calls on the same JAXPFactories instance.


JAXPFactories

public JAXPFactories(SAXParserFactory saxParserFactory,
                     DocumentBuilderFactory documentBuilderFactory,
                     TransformerFactory transformerFactory)
Public contructor. As already noted, instances of this class should only be used within a single thread (at a time). Each instance caches instances of all factories found, so there is very little overhead in repeated method calls on the same JAXPFactories instance. This variation allows the caller to spell out the implementation factory instances to use. For any argument which is null, the Windchill default will be used.

Method Detail

getSAXParserFactory

public SAXParserFactory getSAXParserFactory()
Fetches preferred SAX implementation or JAXP one if preferred implementation is not available. Throws NullPointerException if no implementation is found.


getDocumentBuilderFactory

public DocumentBuilderFactory getDocumentBuilderFactory()
Fetches preferred DOM implementation or JAXP one if preferred implementation is not available. Throws NullPointerException if no implementation is found.


getTransformerFactory

public TransformerFactory getTransformerFactory()
Fetches preferred XSLT implementation or JAXP one if preferred implementation is not available. Throws NullPointerException if no implementation is found.


getSAXTransformerFactory

public SAXTransformerFactory getSAXTransformerFactory()
Fetches preferred XSLT implementation or JAXP one if preferred implementation is not available. Throws NullPointerException if no implementation is found. Throws a ClassCastException if the transformer factory in question is not an instance of SAXTransformerFactory.


getFactoryInstance

private static Object getFactoryInstance(String defaultClassName)