Nux 1.6

nux.xom.pool
Class XQueryFactory

java.lang.Object
  extended by nux.xom.pool.XQueryFactory

public class XQueryFactory
extends Object

Creates and returns new XQuery objects using flexible parametrization (thread-safe).

This implementation is thread-safe.

Author:
whoschek.AT.lbl.DOT.gov, $Author: hoschek3 $

Constructor Summary
XQueryFactory()
          Equivalent to new XQueryFactory(null, null).
XQueryFactory(Charset charset, DocumentURIResolver resolver)
          Creates a factory instance that uses the given DocumentURIResolver and character encoding.
 
Method Summary
 XQuery createXQuery(File query)
          Creates and returns a new XQuery for the given input query.
 XQuery createXQuery(File query, URI baseURI)
          Creates and returns a new XQuery for the given input query, using the given base URI.
 XQuery createXQuery(InputStream query, URI baseURI)
          Creates and returns a new XQuery for the given input query, using the given base URI.
 XQuery createXQuery(String query, URI baseURI)
          Creates and returns a new XQuery for the given input query, using the given base URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XQueryFactory

public XQueryFactory()
Equivalent to new XQueryFactory(null, null).


XQueryFactory

public XQueryFactory(Charset charset,
                     DocumentURIResolver resolver)
Creates a factory instance that uses the given DocumentURIResolver and character encoding.

Parameters:
charset - the charset to convert byte streams to a query string, e.g. Charset.forName("UTF-8"). May be null in which case the system's default platform encoding is used.
resolver - an object that is called by the XQuery processor to turn a URI passed to the XQuery doc() function into a XOM Document. May be null in which case non-validating default resolution is used.
Method Detail

createXQuery

public XQuery createXQuery(File query)
                    throws XQueryException,
                           IOException
Creates and returns a new XQuery for the given input query. Equivalent to createXQuery(query, query.toURI()).

Parameters:
query - the query to compile
Returns:
a new XQuery
Throws:
IOException - if an I/O error occured while reading the query from the file
XQueryException - if the query has a syntax error, or if it references namespaces, variables, or functions that have not been declared, or contains other static errors such as type mismatches.

createXQuery

public XQuery createXQuery(File query,
                           URI baseURI)
                    throws XQueryException,
                           IOException
Creates and returns a new XQuery for the given input query, using the given base URI.

Parameters:
query - the query to compile
baseURI - an absolute URI, used when necessary in the resolution of relative URIs found in the query. Used by the XQuery doc function, and hence the resolver. May be null in which case it defaults to the current working directory.
Returns:
a new XQuery
Throws:
IOException - if an I/O error occured while reading the query from the file
XQueryException - if the query has a syntax error, or if it references namespaces, variables, or functions that have not been declared, or contains other static errors such as type mismatches.

createXQuery

public XQuery createXQuery(String query,
                           URI baseURI)
                    throws XQueryException
Creates and returns a new XQuery for the given input query, using the given base URI.

If desired, overrride this default implementation to construct and return a custom object or a custom XQuery subclass.

Parameters:
query - the query to compile
baseURI - an absolute URI, used when necessary in the resolution of relative URIs found in the query. Used by the XQuery doc function, and hence the resolver. May be null in which case it defaults to the current
Returns:
a new XQuery working directory.
Throws:
XQueryException - if the query has a syntax error, or if it references namespaces, variables, or functions that have not been declared, or contains other static errors such as type mismatches.

createXQuery

public XQuery createXQuery(InputStream query,
                           URI baseURI)
                    throws XQueryException,
                           IOException
Creates and returns a new XQuery for the given input query, using the given base URI.

Parameters:
query - the query to compile
baseURI - an absolute URI, used when necessary in the resolution of relative URIs found in the query. Used by the XQuery doc function, and hence the resolver. May be null in which case it defaults to the current working directory. Need not be the stream's actual URI.
Returns:
a new XQuery
Throws:
IOException - if an I/O error occurs while reading the query from the stream
XQueryException - if the query has a syntax error, or if it references namespaces, variables, or functions that have not been declared, or contains other static errors such as type mismatches.

Nux 1.6