## org.exist.xquery
Class ExternalModuleImpl

    java.lang.Object
      org.exist.xquery.ExternalModuleImpl

All Implemented Interfaces:
  ExternalModule, Module

public class ExternalModuleImpl
extends java.lang.Object
implements ExternalModule

Default implementation of an `ExternalModule`.

Author:
  Wolfgang Meier (wolfgang@exist-db.org)

Field Summary

Fields inherited from interface org.exist.xquery.Module
`REQUEST_FUNCTION_NS, RESPONSE_FUNCTION_NS, SESSION_FUNCTION_NS, SYSTEM_FUNCTION_NS, TEXT_FUNCTION_NS, TRANSFORM_FUNCTION_NS, UTIL_FUNCTION_NS, XMLDB_FUNCTION_NS`

Constructor Summary
`ExternalModuleImpl(java.lang.String namespaceURI, java.lang.String prefix)`

Method Summary
`void` `declareFunction(UserDefinedFunction func)` Declare a new function.
`Variable` `declareVariable(QName qname, java.lang.Object value)`
`void` `declareVariable(QName qname, VariableDeclaration decl)`
`Variable` `declareVariable(Variable var)`
`java.lang.String` `getDefaultPrefix()` Returns an optional default prefix (used if no prefix is supplied with the "import module" directive).
`java.lang.String` `getDescription()` Return a short description of this module to be displayed to a user.
`UserDefinedFunction` `getFunction(QName qname, int arity)` Try to find the function identified by qname.
`java.lang.String` `getNamespaceURI()` Returns the namespace URI that uniquely identifies this module.
`java.util.Iterator` `getSignaturesForFunction(QName qname)` Try to find the signature of the function identified by its QName.
`Source` `getSource()` Get the source object this module has been read from.
`boolean` `isInternalModule()` Is this an internal module?
`boolean` `isVarDeclared(QName qname)`
`FunctionSignature[]` `listFunctions()` Returns the signatures of all functions defined within this module.
`boolean` `moduleIsValid()` Is this module still valid or should it be reloaded from its source?
`void` `reset()` Reset the module's internal state for being reused.
`Variable` `resolveVariable(QName qname)`
`void` `setContext(XQueryContext context)` Set the XQueryContext of this module.
`void` `setSource(Source source)` Set the source object this module has been read from.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ExternalModuleImpl

    public ExternalModuleImpl(java.lang.String namespaceURI,
                              java.lang.String prefix)

Method Detail

### getDescription

    public java.lang.String getDescription()

  Description copied from interface: `Module`
  Return a short description of this module to be displayed to a user.

  Specified by:
    `getDescription` in interface `Module`
  Returns:
    short description of this module

### getFunction

    public UserDefinedFunction getFunction(QName qname,
                                           int arity)

  Description copied from interface: `ExternalModule`
  Try to find the function identified by qname. Returns null if the function is undefined.

  Specified by:
    `getFunction` in interface `ExternalModule`
  Parameters:
    `qname` -

### declareFunction

    public void declareFunction(UserDefinedFunction func)

  Description copied from interface: `ExternalModule`
  Declare a new function. Called by the XQuery compiler when parsing a library module for every function declaration.

  Specified by:
    `declareFunction` in interface `ExternalModule`
  Parameters:
    `func` -

### getNamespaceURI

    public java.lang.String getNamespaceURI()

  Description copied from interface: `Module`
  Returns the namespace URI that uniquely identifies this module.

  Specified by:
    `getNamespaceURI` in interface `Module`
  Returns:
    namespace URI

### getDefaultPrefix

    public java.lang.String getDefaultPrefix()

  Description copied from interface: `Module`
  Returns an optional default prefix (used if no prefix is supplied with the "import module" directive).

  Specified by:
    `getDefaultPrefix` in interface `Module`
  Returns:
    optional default prefix

### isInternalModule

    public boolean isInternalModule()

  Description copied from interface: `Module`
  Is this an internal module?

  Specified by:
    `isInternalModule` in interface `Module`
  Returns:
    True if is internal module.

### listFunctions

    public FunctionSignature[] listFunctions()

  Description copied from interface: `Module`
  Returns the signatures of all functions defined within this module.

  Specified by:
    `listFunctions` in interface `Module`
  Returns:
    signatures of all functions

### getSignaturesForFunction

    public java.util.Iterator getSignaturesForFunction(QName qname)

  Description copied from interface: `Module`
  Try to find the signature of the function identified by its QName.

  Specified by:
    `getSignaturesForFunction` in interface `Module`
  Parameters:
    `qname` -
  Returns:
    the function signature or null if the function is not defined.

### declareVariable

    public Variable declareVariable(QName qname,
                                    java.lang.Object value)
                             throws XPathException

  Specified by:
    `declareVariable` in interface `Module`
  Throws:
    `XPathException`

### declareVariable

    public Variable declareVariable(Variable var)

  Specified by:
    `declareVariable` in interface `Module`

### declareVariable

    public void declareVariable(QName qname,
                                VariableDeclaration decl)
                         throws XPathException

  Specified by:
    `declareVariable` in interface `ExternalModule`
  Throws:
    `XPathException`

### isVarDeclared

    public boolean isVarDeclared(QName qname)

  Specified by:
    `isVarDeclared` in interface `Module`

### resolveVariable

    public Variable resolveVariable(QName qname)
                             throws XPathException

  Specified by:
    `resolveVariable` in interface `Module`
  Throws:
    `XPathException`

### getSource

    public Source getSource()

  Description copied from interface: `ExternalModule`
  Get the source object this module has been read from. This is required for query access control.

  Specified by:
    `getSource` in interface `ExternalModule`
  Returns:
    The source object this module has been read from.

### setSource

    public void setSource(Source source)

  Description copied from interface: `ExternalModule`
  Set the source object this module has been read from. This is required to check the validity of a compiled expression.

  Specified by:
    `setSource` in interface `ExternalModule`
  Parameters:
    `source` -

### setContext

    public void setContext(XQueryContext context)

  Description copied from interface: `ExternalModule`
  Set the XQueryContext of this module. This will be a sub-context of the main context as parts of the static context are shared.

  Specified by:
    `setContext` in interface `ExternalModule`
  Parameters:
    `context` -

### moduleIsValid

    public boolean moduleIsValid()

  Description copied from interface: `ExternalModule`
  Is this module still valid or should it be reloaded from its source?

  Specified by:
    `moduleIsValid` in interface `ExternalModule`

### reset

    public void reset()

  Description copied from interface: `Module`
  Reset the module's internal state for being reused.

  Specified by:
    `reset` in interface `Module`

Copyright (C) Wolfgang Meier. All rights reserved.