org.eclipse.xsd.util
Class DefaultJAXPPool

java.lang.Object
  extended by org.eclipse.xsd.util.DefaultJAXPPool
All Implemented Interfaces:
JAXPPool

public class DefaultJAXPPool
extends java.lang.Object
implements JAXPPool

The DefaultJAXPPool class provides a thread-safe implementation of JAXPPool interface.


Constructor Summary
DefaultJAXPPool()
          Creates an instance using DefaultJAXPConfiguration.
DefaultJAXPPool(JAXPConfiguration configuration)
          Creates an instance using the specified JAXPConfiguration.
 
Method Summary
 javax.xml.parsers.DocumentBuilder getDocumentBuilder(org.xml.sax.ErrorHandler errorHandler)
          Fetches a document builder and sets the given error handler.
 javax.xml.parsers.SAXParser getSAXParser(org.xml.sax.ext.LexicalHandler lexicalHandler)
          Fetches a SAX parser and set the given lexical handler.
 javax.xml.transform.Transformer getTransformer(java.lang.String encoding)
          Fetches a transformer and set the given encoding.
 void releaseDocumentBuilder(javax.xml.parsers.DocumentBuilder documentBuilder)
          Returns a document builder fetched from this pool back to the pool for subsequent reuse.
 void releaseSAXParser(javax.xml.parsers.SAXParser parser)
          Returns a SAX parser fetched from this pool back to the pool for subsequent reuse.
 void releaseTransformer(javax.xml.transform.Transformer transformer)
          Returns a transformer fetched from this pool back to the pool for subsequent reuse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJAXPPool

public DefaultJAXPPool()
Creates an instance using DefaultJAXPConfiguration.


DefaultJAXPPool

public DefaultJAXPPool(JAXPConfiguration configuration)
Creates an instance using the specified JAXPConfiguration.

Parameters:
configuration - the non-null configuration used to create new builders, parsers, and transformers.
Method Detail

getDocumentBuilder

public javax.xml.parsers.DocumentBuilder getDocumentBuilder(org.xml.sax.ErrorHandler errorHandler)
                                                     throws javax.xml.parsers.ParserConfigurationException,
                                                            org.xml.sax.SAXException
Description copied from interface: JAXPPool
Fetches a document builder and sets the given error handler.

Specified by:
getDocumentBuilder in interface JAXPPool
Parameters:
errorHandler - the error handler to use while build documents.
Returns:
a document builder.
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

releaseDocumentBuilder

public void releaseDocumentBuilder(javax.xml.parsers.DocumentBuilder documentBuilder)
Description copied from interface: JAXPPool
Returns a document builder fetched from this pool back to the pool for subsequent reuse.

Specified by:
releaseDocumentBuilder in interface JAXPPool
Parameters:
documentBuilder - the document builder to release.

getSAXParser

public javax.xml.parsers.SAXParser getSAXParser(org.xml.sax.ext.LexicalHandler lexicalHandler)
                                         throws javax.xml.parsers.ParserConfigurationException,
                                                org.xml.sax.SAXException
Description copied from interface: JAXPPool
Fetches a SAX parser and set the given lexical handler.

Specified by:
getSAXParser in interface JAXPPool
Parameters:
lexicalHandler - the lexical handler to use while parsing.
Returns:
a SAX parser.
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

releaseSAXParser

public void releaseSAXParser(javax.xml.parsers.SAXParser parser)
Description copied from interface: JAXPPool
Returns a SAX parser fetched from this pool back to the pool for subsequent reuse.

Specified by:
releaseSAXParser in interface JAXPPool
Parameters:
parser - the SAX parser to release.

getTransformer

public javax.xml.transform.Transformer getTransformer(java.lang.String encoding)
                                               throws javax.xml.transform.TransformerException
Description copied from interface: JAXPPool
Fetches a transformer and set the given encoding.

Specified by:
getTransformer in interface JAXPPool
Parameters:
encoding - the encoding used to convert characters to bytes.
Returns:
a transformer.
Throws:
javax.xml.transform.TransformerException

releaseTransformer

public void releaseTransformer(javax.xml.transform.Transformer transformer)
Description copied from interface: JAXPPool
Returns a transformer fetched from this pool back to the pool for subsequent reuse.

Specified by:
releaseTransformer in interface JAXPPool
Parameters:
transformer - the transformer to release.

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.