|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.joost.stx.TransformerHandlerResolverImpl
public final class TransformerHandlerResolverImpl
The default implementation of an TransformerHandlerResolver
.
It supports pluggable TransformerHandlerResolver
implementations.
Plugin mechanism is based on Jakarta's Discovery library.
During instantiation it will scan for available handlers and cache them if
this was behavior was configured. Upon calling
resolve(String, String, String, URIResolver, ErrorListener, Hashtable)
or resolve(String, XMLReader, URIResolver, ErrorListener, Hashtable)
it will look for a handler supporting the given method URI and will delegate
the call to it.
Field Summary | |
---|---|
TransformerHandlerResolver |
customResolver
Custom handler provided via {link @Processor} interface |
private static int |
FLAG_FAIL
|
private static int |
FLAG_IGNORE
|
private static int |
FLAG_REPLACE
|
private static String |
flgName
Defines plugin factory behaviour when duplicated method implementations are discovered. |
private static org.apache.commons.logging.Log |
log
logging object |
private static boolean |
notInitializedYet
indicate whether plugins has been initialized or not |
private static Hashtable |
plugins
hashtable with available methods and their plugin implementations |
Fields inherited from interface net.sf.joost.Constants |
---|
DEBUG, DEFAULT_ENCODING, FEAT_NS, FEAT_NSPREFIX, FEATURE_URI_PREFIX, FUNC_NS, JOOST_EXT_NS, PR_ATTRIBUTES, PR_BUFFER, PR_CHILDREN, PR_CONTINUE, PR_ERROR, PR_SELF, PR_SIBLINGS, STX_NS |
Constructor Summary | |
---|---|
TransformerHandlerResolverImpl()
|
Method Summary | |
---|---|
boolean |
available(String method)
Lookup given method via searching for a plugin providing implementation for it. |
private Hashtable |
createExternalParameters(Hashtable params)
Creates a new Hashtable with String resp. |
private static void |
init()
Initialize the object It scans plugins directories and create a hashtable of all implemented filter-methods and their factories. |
TransformerHandler |
resolve(String method,
String href,
String base,
URIResolver uriResolver,
ErrorListener errorListener,
Hashtable params)
Resolve given method via searching for a plugin providing implementation for it. |
TransformerHandler |
resolve(String method,
XMLReader reader,
URIResolver uriResolver,
ErrorListener errorListener,
Hashtable params)
This is essentially same method as common resolve but it assumes that params are already "parsed" via createExternalParameters(Hashtable) |
String[] |
resolves()
Return all supported filter-method URIs Each one must return true when checked against available(String) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log log
private static Hashtable plugins
private static final String flgName
private static final int FLAG_FAIL
private static final int FLAG_IGNORE
private static final int FLAG_REPLACE
private static boolean notInitializedYet
plugins
has been initialized or not
public TransformerHandlerResolver customResolver
Constructor Detail |
---|
public TransformerHandlerResolverImpl()
Method Detail |
---|
private static void init() throws SAXException
SAXException
- when duplicated method implementation is found
and has been asked to raise an exceptionprivate Hashtable createExternalParameters(Hashtable params)
public TransformerHandler resolve(String method, String href, String base, URIResolver uriResolver, ErrorListener errorListener, Hashtable params) throws SAXException
resolve
in interface TransformerHandlerResolver
method
- an URI string provided in the filter-method
attribute, identifying the type of the requested filterhref
- 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
missingbase
- the base URI of the transformation sheeturiResolver
- the optional URIResolver configured for JoosterrorListener
- the optional ErrorListener configured for Joostparams
- the set of parameters specified using
stx:with-param
elements, all values are
String
s
SAXException
- if an error occurs during the creation or
initializationpublic TransformerHandler resolve(String method, XMLReader reader, URIResolver uriResolver, ErrorListener errorListener, Hashtable params) throws SAXException
createExternalParameters(Hashtable)
resolve
in interface TransformerHandlerResolver
method
- an URI string provided in the filter-method
attribute, identifying the type of the requested filterreader
- 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.uriResolver
- the optional URIResolver configured for JoosterrorListener
- the optional ErrorListener configured for Joostparams
- the set of parameters specified using
stx:with-param
elements, all values are
String
s
TransformerHandler
object that transforms a SAX
stream, or null
if the STX processor should try
to resolve the handler itself
SAXException
- if an error occurs during the creation or
initializationpublic boolean available(String method)
available
in interface TransformerHandlerResolver
method
- an URI string identifying the type of the requested filter
true
if this resolver will return a
TransformerHandler
object for this filterpublic String[] resolves()
available(String)
.
resolves
in interface TransformerHandlerResolver
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |