org.apache.xalan.xpath
Class ExtensionFunctionHandler

java.lang.Object
  |
  +--org.apache.xalan.xpath.ExtensionFunctionHandler
Direct Known Subclasses:
ExtensionNSHandler

public class ExtensionFunctionHandler
extends java.lang.Object

**For internal use only** Class handling an extension namespace for XPath. Provides functions to test a function's existence and call a function


Inner Class Summary
static interface ExtensionFunctionHandler.ExtensionLiaison
          **For internal use only** Interface for connecting extension functions to xalan.
 
Field Summary
static java.lang.String DEFAULT_EXTENSION_LIAISON
          **For internal use only**  
 java.lang.String namespaceUri
          **For internal use only**  
 java.lang.String scriptLang
          **For internal use only**  
 java.lang.String scriptSrc
          **For internal use only**  
 java.lang.String scriptSrcURL
          **For internal use only**  
 
Constructor Summary
ExtensionFunctionHandler(java.lang.String namespaceUri)
          **For internal use only** Construct a new extension namespace handler for a given extension NS.
ExtensionFunctionHandler(java.lang.String namespaceUri, java.lang.String funcNames, java.lang.String lang, java.lang.String srcURL, java.lang.String src)
          **For internal use only** Construct a new extension namespace handler given all the information needed.
 
Method Summary
 java.lang.Object callFunction(java.lang.String funcName, java.util.Vector args, java.lang.Object methodKey, java.lang.Class javaClass)
          **For internal use only** Process a call to a function.
 java.lang.Object callJava(java.lang.Object object, java.lang.String method, java.lang.Object[] args, java.lang.Object methodKey)
          **For internal use only** call the named method on the object that was loaded by eval.
 boolean isElementAvailable(java.lang.String element)
          **For internal use only** Tests whether a certain element name is known within this namespace.
 boolean isFunctionAvailable(java.lang.String function)
          **For internal use only** Tests whether a certain function name is known within this namespace.
 void setElements(java.lang.String elemNames)
          **For internal use only** Set element local parts of extension NS.
 void setFunctions(java.lang.String funcNames)
          **For internal use only** Set function local parts of extension NS.
 void setScript(java.lang.String lang, java.lang.String srcURL, java.lang.String scriptSrc)
          **For internal use only** Set the script data for this extension NS.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namespaceUri

public java.lang.String namespaceUri

scriptLang

public java.lang.String scriptLang

scriptSrc

public java.lang.String scriptSrc

scriptSrcURL

public java.lang.String scriptSrcURL

DEFAULT_EXTENSION_LIAISON

public static final java.lang.String DEFAULT_EXTENSION_LIAISON
Constructor Detail

ExtensionFunctionHandler

public ExtensionFunctionHandler(java.lang.String namespaceUri)
**For internal use only** Construct a new extension namespace handler for a given extension NS. This doesn't do anything - just hang on to the namespace URI.
Parameters:
namespaceUri - the extension namespace URI that I'm implementing

ExtensionFunctionHandler

public ExtensionFunctionHandler(java.lang.String namespaceUri,
                                java.lang.String funcNames,
                                java.lang.String lang,
                                java.lang.String srcURL,
                                java.lang.String src)
**For internal use only** Construct a new extension namespace handler given all the information needed.
Parameters:
namespaceUri - the extension namespace URI that I'm implementing
funcNames - string containing list of functions of extension NS
lang - language of code implementing the extension
srcURL - value of src attribute (if any) - treated as a URL or a classname depending on the value of lang. If srcURL is not null, then scriptSrc is ignored.
scriptSrc - the actual script code (if any)
Method Detail

setFunctions

public void setFunctions(java.lang.String funcNames)
**For internal use only** Set function local parts of extension NS.
Parameters:
functions - whitespace separated list of function names defined by this extension namespace.

setElements

public void setElements(java.lang.String elemNames)
**For internal use only** Set element local parts of extension NS.
Parameters:
elements - whitespace separated list of element names defined by this extension namespace.

setScript

public void setScript(java.lang.String lang,
                      java.lang.String srcURL,
                      java.lang.String scriptSrc)
**For internal use only** Set the script data for this extension NS. If srcURL is !null then the script body is read from that URL. If not the scriptSrc is used as the src. This method does not actually execute anything - that's done when the component is first hit by the user by an element or a function call.
Parameters:
lang - language of the script.
srcURL - value of src attribute (if any) - treated as a URL or a classname depending on the value of lang. If srcURL is not null, then scriptSrc is ignored.
scriptSrc - the actual script code (if any)

isFunctionAvailable

public boolean isFunctionAvailable(java.lang.String function)
**For internal use only** Tests whether a certain function name is known within this namespace.
Parameters:
function - name of the function being tested
Returns:
true if its known, false if not.

isElementAvailable

public boolean isElementAvailable(java.lang.String element)
**For internal use only** Tests whether a certain element name is known within this namespace.
Parameters:
function - name of the function being tested
Returns:
true if its known, false if not.

callJava

public java.lang.Object callJava(java.lang.Object object,
                                 java.lang.String method,
                                 java.lang.Object[] args,
                                 java.lang.Object methodKey)
                          throws XPathException
**For internal use only** call the named method on the object that was loaded by eval. The method selection stuff is very XSLT-specific, hence the custom engine.
Parameters:
object - ignored - should always be null

callFunction

public java.lang.Object callFunction(java.lang.String funcName,
                                     java.util.Vector args,
                                     java.lang.Object methodKey,
                                     java.lang.Class javaClass)
                              throws XPathException
**For internal use only** Process a call to a function.
Parameters:
funcName - Function name.
args - The arguments of the function call.
Returns:
the return value of the function evaluation.
Throws:
XSLProcessorException - thrown if something goes wrong while running the extension handler.
java.net.MalformedURLException - if loading trouble
java.io.FileNotFoundException - if loading trouble
java.io.IOException - if loading trouble
org.xml.sax.SAXException - if parsing trouble


Copyright © 2000 Apache XML Project. All Rights Reserved.