net.sf.joost.stx
Class TransformerHandlerResolverImpl

java.lang.Object
  extended bynet.sf.joost.stx.TransformerHandlerResolverImpl
All Implemented Interfaces:
TransformerHandlerResolver

public final class TransformerHandlerResolverImpl
extends Object
implements TransformerHandlerResolver

The default implementation of an TransformerHandlerResolver. It supports currently only XSLT transformers.

Version:
$Revision: 2.7 $ $Date: 2004/09/29 06:09:36 $
Author:
Oliver Becker

Field Summary
 TransformerHandlerResolver customResolver
          A custom resolver object registered via Processor.setTransformerHandlerResolver(net.sf.joost.TransformerHandlerResolver)
static String HTTP_POST_METHOD
          The URI identifying the HTTP POST method
private static String[] knownMethods
           
private static int M_POST
           
private static int M_SAX
           
private static int M_STX
           
private static int M_XSLT
           
static String SAX_METHOD
          The URI identifying a SAX parser
static String XSLT_METHOD
          The URI identifying an XSLT transformation (the XSLT namespace)
 
Constructor Summary
TransformerHandlerResolverImpl()
           
 
Method Summary
 boolean available(String method)
          Determines whether a requested filter is available or not, used by the STX function filter-available.
private  Hashtable createExternalParameters(Hashtable params)
          Creates a new Hashtable with String values only
 TransformerHandler resolve(String method, String href, String base, Hashtable params)
          Resolves a TransformerHandler object for an external transformation.
private  TransformerHandler resolve(String method, String href, String base, XMLReader reader, Hashtable params)
           
 TransformerHandler resolve(String method, XMLReader reader, Hashtable params)
          Resolves a TransformerHandler object for an external transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSLT_METHOD

public static final String XSLT_METHOD
The URI identifying an XSLT transformation (the XSLT namespace)

See Also:
Constant Field Values

SAX_METHOD

public static final String SAX_METHOD
The URI identifying a SAX parser

See Also:
Constant Field Values

HTTP_POST_METHOD

public static final String HTTP_POST_METHOD
The URI identifying the HTTP POST method

See Also:
Constant Field Values

knownMethods

private static String[] knownMethods

M_STX

private static int M_STX

M_XSLT

private static int M_XSLT

M_SAX

private static int M_SAX

M_POST

private static int M_POST

customResolver

public TransformerHandlerResolver customResolver
A custom resolver object registered via Processor.setTransformerHandlerResolver(net.sf.joost.TransformerHandlerResolver)

Constructor Detail

TransformerHandlerResolverImpl

public TransformerHandlerResolverImpl()
Method Detail

createExternalParameters

private Hashtable createExternalParameters(Hashtable params)
Creates a new Hashtable with String values only


resolve

public TransformerHandler resolve(String method,
                                  String href,
                                  String base,
                                  Hashtable params)
                           throws SAXException
Description copied from interface: TransformerHandlerResolver
Resolves a TransformerHandler object for an external transformation. This method will be called if the filter-src attribute contains an URL, or if this attribute is missing at all.

Specified by:
resolve in interface TransformerHandlerResolver
Parameters:
method - an URI string provided in the filter-method attribute, identifying the type of the requested filter
href - the location of the source for the filter provided in the filter-src attribute (as pseudo-argument of the url(...) notation); null if the filter-src attribute is missing
base - the base URI of the transformation sheet
params - the set of parameters specified using stx:with-param elements, all values are Strings
Returns:
a TransformerHandler object that transforms a SAX stream, or null if the STX processor should try to resolve the handler itself
Throws:
SAXException - if an error occurs during the creation or initialization

resolve

public TransformerHandler resolve(String method,
                                  XMLReader reader,
                                  Hashtable params)
                           throws SAXException
Description copied from interface: TransformerHandlerResolver
Resolves a TransformerHandler object for an external transformation. This method will be called if the filter-src attribute contains a buffer specification.

Specified by:
resolve in interface TransformerHandlerResolver
Parameters:
method - an URI string provided in the filter-method attribute, identifying the type of the requested filter
reader - an XMLReader object that provides the source for the transformation as a stream of SAX events (the contents of an stx:buffer). Either parse method may be used, the required parameters systemId or input respectively will be ignored by this reader.
params - the set of parameters specified using stx:with-param elements, all values are Strings
Returns:
a TransformerHandler object that transforms a SAX stream, or null if the STX processor should try to resolve the handler itself
Throws:
SAXException - if an error occurs during the creation or initialization

resolve

private TransformerHandler resolve(String method,
                                   String href,
                                   String base,
                                   XMLReader reader,
                                   Hashtable params)
                            throws SAXException
Throws:
SAXException

available

public boolean available(String method)
Description copied from interface: TransformerHandlerResolver
Determines whether a requested filter is available or not, used by the STX function filter-available.

Specified by:
available in interface TransformerHandlerResolver
Parameters:
method - an URI string identifying the type of the requested filter
Returns:
true if this resolver will return a TransformerHandler object for this filter