Sharing GateIn resources with Gadgets

Version 2

    Status

    WIP.

     

    Specification

    We introduce a new gadget feature named gatein-resources which allows to specify shared resources from GateIn portal to be loaded inside the gadget ( today the only JavaScript is supported ). Refer to Javascript Loader implementation, GateIn provides two kinds of shared JavaScript Scripts and Module. It will be corresponding to params scripts and modules of the gadget feature.

     

    Here is the declaration format of the feature :

     

    <Require feature="gatein-resources">
         <Param name="scripts">[ An, array, of, shared, scripts, names ]</Param>
         <Param name="modules">[ An, array, of, shared, module, names ]</Param>
    </Require>
    

     

    For instance, if a gadget wants to load shared immediate scripts "Bootstrap", "Core" and shared modules "JQuery", "Common", "Portal", "WebUI" from GateIn portal. The declaration would look like :

     

    <Require feature="gatein-resources">
         <Param name="scripts">[ Bootstrap, Core ]</Param>
         <Param name="modules">[ JQuery, Common, Portal, WebUI ]</Param>
    </Require>
    

     

    You can also refer to the service management gadget in this link as an example which already used the gatein-resources feature

     

    Notice that in the case of using the shared modules, it will also embed the built-in AMD library from GateIn to ensure modular scripts hanlded properly