com.novell.xsl.extensions
Class ExtensibleFunctionLibrary

java.lang.Object
  extended bycom.novell.xml.xpath.FunctionLibraryImpl
      extended bycom.novell.xsl.extensions.ExtensibleFunctionLibrary
All Implemented Interfaces:
FunctionLibrary
Direct Known Subclasses:
XsltFunctionLibrary

public class ExtensibleFunctionLibrary
extends FunctionLibraryImpl

Class implementing XPath FunctionLibrary interface for use with XPath Parser. This class adds support for java and ecmascript extension functions.


Field Summary
protected  ClassLoader loader
           
 
Constructor Summary
ExtensibleFunctionLibrary()
          Construct a function library for XSLT containing the built-in XPath and nxsl functions.
ExtensibleFunctionLibrary(ClassLoader loader)
          Construct a function library for XSLT containing the built-in XPath and XSLT functions.
 
Method Summary
 ClassLoader getClassLoader()
          Get the class loader to use for Java extension functions.
 Function getFunction(ExpandedQName name)
          Return an object of type Function given the function name.
 boolean isFunctionAvailable(ExpressionContext context, ExpandedQName name)
          Return true if a function under a given name is available
 void setClassLoader(ClassLoader loader)
          Set the class loader to use for Java extension functions.
 
Methods inherited from class com.novell.xml.xpath.FunctionLibraryImpl
addFunction, findFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loader

protected ClassLoader loader
Constructor Detail

ExtensibleFunctionLibrary

public ExtensibleFunctionLibrary()
Construct a function library for XSLT containing the built-in XPath and nxsl functions. This library also supports java extension functions.


ExtensibleFunctionLibrary

public ExtensibleFunctionLibrary(ClassLoader loader)
Construct a function library for XSLT containing the built-in XPath and XSLT functions. This library also supports java extension functions.

Parameters:
loader - ClassLoader instance to use to load extension functions.
Method Detail

setClassLoader

public void setClassLoader(ClassLoader loader)
Set the class loader to use for Java extension functions.

Parameters:
loader - ClassLoader instance to use to load extension functions.

getClassLoader

public ClassLoader getClassLoader()
Get the class loader to use for Java extension functions.

Returns:
ClassLoader instance to use to load extension functions.

getFunction

public Function getFunction(ExpandedQName name)
                     throws XPathParserException
Return an object of type Function given the function name. This overrides ExpressionContext.getFunction() so we can add java extension functions as needed. If the namespace of the passed function name starts with Stylesheet.EXTENSION_FUNCTION_MAGIC, the rest of the namespace URI is expected to be a java class name. The desired method is found and a Function object is added to the function library to represent it. If the namespace of the passed function name is ECMAScriptFunction.ECMASCRIPT_EXTENSION_FUNCTION_NAMESPACE, then a function object is added to the library to represent it

Specified by:
getFunction in interface FunctionLibrary
Overrides:
getFunction in class FunctionLibraryImpl
Parameters:
name - The name of the function
Returns:
a Function object
Throws:
XPathParserException

isFunctionAvailable

public boolean isFunctionAvailable(ExpressionContext context,
                                   ExpandedQName name)
Return true if a function under a given name is available

Specified by:
isFunctionAvailable in interface FunctionLibrary
Overrides:
isFunctionAvailable in class FunctionLibraryImpl
Parameters:
context - the expression context
name - name of the function