Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-2226

Provide mechanism to reload skin definitions from trinidad-skins.xml

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.2-core
    • 2.0.2-core
    • Skinning
    • None

    Description

      Currently there is no way to be able to update the skins to an app at runtime without needing to restart the app. Request here is to provide it in Trinidad's skinning framework.

      Requirement: Provide an API that complies to the following:
      -------------------------------------------------------------------------------------

      1. Reads (or marks it dirty so that it is read in next request) trinidad-skins.xml and update the new skin definitions as per its contents
      2. Subsequent requests on the webapp should reflect the skin definitions from trinidad-skins.xml that was re-read
      3. Should be statically called (because the clients of such API are usually deployment tools that work outside of JSF lifecycle)
      4. Cannot depend on any context object other than ServletContext (because that is what a non-JSF entry point to this API can provide)

      Proposed API:
      ---------------------

      1. New public non-static method in 'org.apache.myfaces.trinidad.skin.SkinFactory'

      /**

      • Reloads the skins that was registered with this factory.
      • Subclassers are expected to provide the implementation.
        */
        public void reload()
      • We implement this in 'org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl'. In this implementation we will preserve the order in which we register skins, which is the following:
        a) Register the base skins in Trinidad
        b) Give chance to all registered Configurator services to attach their skins to the SkinFactory programatically.
        c) Read trinidad-skins.xml from META-INF and WEB-INF, and for the skin definitions in there, create Skins and register with the SkinFactory
      • Clients will call 'SkinFactory.getFactory().reload();' after updating the trinidad-skins.xml to be able to reload the skins in the next request to the app (browser cache clearance / Ctrl+F5 is of course needed).

      2. New public method in 'org.apache.myfaces.trinidad.config.Configurator'

      /**

      • The skinning framework calls this method to notify Configurators that the specified SkinFactory has been reloaded.
      • The Configurator implementations may choose to reload skins here.
      • @param externalContext the external context
      • @param factory the SkinFactory instance to which the skins can be reloaded
        */
        public void reloadSkins(ExternalContext externalContext, SkinFactory factory){}
      • This method will be no-op in the Configurator class, and can optionally be implemented by any registered configurator services.
      • The reload() method noted in #1 above will call this method on all registered configurator services before attempting to register the skins from trinidad-skins.xml that it will re-read now.

      Attachments

        1. JIRA_2226_Patch_over_1_2_12_6_2_branch.patch
          12 kB
          Prakash Udupa
        2. JIRA_2226_Patch_over_trunk.patch
          13 kB
          Prakash Udupa

        Activity

          People

            gabrielle Gabrielle Crawford
            pudupa Prakash Udupa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 48h
                48h
                Remaining:
                Remaining Estimate - 48h
                48h
                Logged:
                Time Spent - Not Specified
                Not Specified