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

                 Key: TRINIDAD-2226
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2226
             Project: MyFaces Trinidad
          Issue Type: Improvement
          Components: Skinning
    Affects Versions: 2.0.2-core
            Reporter: Prakash Udupa


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. 



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to