2.13.3. Module scopes

The previous name of a logical GateIn module is translated into an AMD name with a prefix among SHARED, PORTLET or PORTAL. Thus, a module is fully identified by its logical name and its scope. Scopes ensure that a module (and the underlying web resource) is loaded at the right time when it is effectively required.

Shared scope

The shared scope is not related to a specific GateIn entity, instead a shared module should be consumed by other modules. It is declared in gatein-resources.xml with the top level module tag:


<module>
  <name>core</name>
  <script>
    <path>/core.js</path>
  </script>
  <depends>
    <module>base</module>
  </depends>
</module>

Portal scope

The module is related to a GateIn portal and should be loaded when the related portal is accessed:


<portal>
  <name>classic</name>
  <module>
    <script>
      <path>/classic.js</path>
    </script>
    <depends>
      <module>core</module>
    </depends>
  </module>
</portal>

Portlet scope

The module will be loaded when the corresponding portlet is accessed:


<portlet>
  <name>sitemap</name>
  <module>
    <script>
      <path>/sitemap.js</path>
    </script>
    <depends>
      <module>core</module>
    </depends>
  </module>
</portlet>

Note

A module can only depend on a shared module, therefore any depends tag implicitly refers to a shared module.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus