Package org.apache.tapestry5.internal.services.javascript

## Class ModuleManagerImpl

- java.lang.Object
- - org.apache.tapestry5.internal.services.javascript.ModuleManagerImpl

- All Implemented Interfaces:
    `ModuleManager`

      public class ModuleManagerImpl
      extends java.lang.Object
      implements ModuleManager

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ModuleManagerImpl​(ResponseCompressionAnalyzer compressionAnalyzer, AssetSource assetSource, java.util.Map<java.lang.String,​JavaScriptModuleConfiguration> configuration, Messages globalMessages, StreamableResourceSource streamableResourceSource, boolean compactJSON, boolean productionMode, java.lang.String modulePathPrefix, PathConstructor pathConstructor)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Resource` | `findResourceForModule​(java.lang.String moduleName)` | Given a module name (which may be a path of names separated by slashes), locates the corresponding `Resource`.
    `void` | `setupInvalidation​(ResourceChangeTracker tracker)` |
    `void` | `writeConfiguration​(Element body, java.util.List<ModuleConfigurationCallback> callbacks)` | Invoked by the internal `DocumentLinker` service to write the configuration for the module system into the page.
    `void` | `writeInitialization​(Element body, java.util.List<java.lang.String> libraryURLs, java.util.List<?> inits)` | Invoked by the internal `DocumentLinker` service to write the initializations (as per `JavaScriptSupport.require(String)` into the page; this occurs after the module infrastructure has been written into the page, along with the core libraries.

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

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

- - ### Constructor Detail

    - #### ModuleManagerImpl

          public ModuleManagerImpl​(ResponseCompressionAnalyzer compressionAnalyzer,
                                   AssetSource assetSource,
                                   java.util.Map<java.lang.String,​JavaScriptModuleConfiguration> configuration,
                                   Messages globalMessages,
                                   StreamableResourceSource streamableResourceSource,
                                   @Symbol("tapestry.compact-json")
                                   boolean compactJSON,
                                   @Symbol("tapestry.production-mode")
                                   boolean productionMode,
                                   @Symbol("tapestry.module-path-prefix")
                                   java.lang.String modulePathPrefix,
                                   PathConstructor pathConstructor)

  - ### Method Detail

    - #### setupInvalidation

          @PostInjection
          public void setupInvalidation​(ResourceChangeTracker tracker)

    - #### writeConfiguration

          public void writeConfiguration​(Element body,
                                         java.util.List<ModuleConfigurationCallback> callbacks)

      Description copied from interface: `ModuleManager`
      Invoked by the internal `DocumentLinker` service to write the configuration for the module system into the page.
      Specified by:
        `writeConfiguration` in interface `ModuleManager`
      Parameters:
        `body` - `<body>` element of the page, to which new `<script>` element(s) will be added.
        `callbacks` - a list of `ModuleConfigurationCallback`s, which is used to customize the configuration before it is written.

    - #### writeInitialization

          public void writeInitialization​(Element body,
                                          java.util.List<java.lang.String> libraryURLs,
                                          java.util.List<?> inits)

      Description copied from interface: `ModuleManager`
      Invoked by the internal `DocumentLinker` service to write the initializations (as per `JavaScriptSupport.require(String)` into the page; this occurs after the module infrastructure has been written into the page, along with the core libraries.
      Specified by:
        `writeInitialization` in interface `ModuleManager`
      Parameters:
        `body` - `<body>` element of the page, to which new `<script>` element(s) will be added.
        `libraryURLs` - additional libraries that should be dynamically loaded before evaluating the inits
        `inits` - specify initialization on the page, based on loading modules, extacting functions from modules, and invoking those functions

    - #### findResourceForModule

          public Resource findResourceForModule​(java.lang.String moduleName)

      Description copied from interface: `ModuleManager`
      Given a module name (which may be a path of names separated by slashes), locates the corresponding `Resource`. First checks for contributed shim modules, then searches for possible matches among the defined library names. As a special case, the folder name "app" is mapped to the application's package.
      Specified by:
        `findResourceForModule` in interface `ModuleManager`
      Parameters:
        `moduleName` - name of module to locate
      Returns:
        corresponding resource, or null if not found