org.mozilla.javascript.commonjs.module.provider

## Class MultiModuleScriptProvider

- java.lang.Object
- - org.mozilla.javascript.commonjs.module.provider.MultiModuleScriptProvider

- All Implemented Interfaces:
    ModuleScriptProvider

      public class MultiModuleScriptProvider
      extends java.lang.Object
      implements ModuleScriptProvider

  A multiplexer for module script providers.
  Version:
    $Id: MultiModuleScriptProvider.java,v 1.4 2011/04/07 20:26:12 hannes%helma.at Exp $
  Author:
    Attila Szegedi

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiModuleScriptProvider(java.lang.Iterable<? extends ModuleScriptProvider> providers)` Creates a new multiplexing module script provider tht gathers the specified providers

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ModuleScript` | `getModuleScript(Context cx, java.lang.String moduleId, java.net.URI uri, java.net.URI base, Scriptable paths)` Returns a module script.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MultiModuleScriptProvider

          public MultiModuleScriptProvider(java.lang.Iterable<? extends ModuleScriptProvider> providers)

      Creates a new multiplexing module script provider tht gathers the specified providers
      Parameters:
        `providers` - the providers to multiplex.

  - ### Method Detail

    - #### getModuleScript

          public ModuleScript getModuleScript(Context cx,
                                     java.lang.String moduleId,
                                     java.net.URI uri,
                                     java.net.URI base,
                                     Scriptable paths)
                                       throws java.lang.Exception

      Description copied from interface: `ModuleScriptProvider`
      Returns a module script. It should attempt to load the module script if it is not already available to it, or return an already loaded module script instance if it is available to it.
      Specified by:
        `getModuleScript` in interface `ModuleScriptProvider`
      Parameters:
        `cx` - current context. Can be used to compile module scripts.
        `moduleId` - the ID of the module. An implementation must only accept an absolute ID, starting with a term.
        `uri` - the URI of the module. If this is not null, resolution of `moduleId` is bypassed and the script is directly loaded from `moduleUri`
        `base` - the module path base URI from which `moduleUri` was derived.
        `paths` - the value of the require() function's "paths" attribute. If the require() function is sandboxed, it will be null, otherwise it will be a JavaScript Array object. It is up to the provider implementation whether and how it wants to honor the contents of the array.
      Returns:
        a module script representing the compiled code of the module. Null should be returned if the script could not found.
      Throws:
        `java.lang.Exception` - if there was an unrecoverable problem obtaining the script
        `java.lang.IllegalArgumentException` - if the module ID is syntactically not a valid absolute module identifier.