[ 
https://issues.apache.org/jira/browse/TRINIDAD-1914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910806#action_12910806
 ] 

Jeanne Waldman commented on TRINIDAD-1914:
------------------------------------------

The API is decided on is:
1. Create a org.apache.myfaces.trinidad.resource.SkinResourceLoader class. I 
didn't want to use the current ResourceLoader because I thought that was too 
generic. I am loading these classes with the ClassLoaderUtils.getServices, and 
I didn't want to make it too generic.
    1a. for now it won't extend anything. later we can extend ResourceLoader if 
we need to.
    1b.    
public Iterator<URL> findResources(ExternalContext context, String filename)
  {
      return Collections.<URL>emptyList().iterator();
  }
2. usage in SkinUtils.java
    // register skins found in DT using the META-INF/services
    List<SkinResourceLoader> urlProviders = ClassLoaderUtils.getServices(
                                      
"org.apache.myfaces.trinidad.resource.SkinResourceLoader");
Iterator<URL> urlIterator = urlProvider.findResources(context, 
"trinidad-skins.xml");


>  provide a hook for external decorator to find  trinidad-skins.xml from a 
> location other than META-INF or WEB-INF.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1914
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1914
>             Project: MyFaces Trinidad
>          Issue Type: Improvement
>          Components: Skinning
>            Reporter: Jeanne Waldman
>            Assignee: Jeanne Waldman
>
> Our design time team needs a way to have the Trinidad Skinning Framework find 
>  trinidad-skins.xml from a location other than META-INF or WEB-INF.
> The implementation I have in mind is similar to 
> https://issues.apache.org/jira/browse/TRINIDAD-1729  provide a hook for for 
> an external decorator of Skin InputStreamProvider.
> I've mocked up a solution that works for our design time team. It is outlined 
> below with questions I'll ask on the dev list.
> 1. Add a public API
> public interface TrinidadSkinsURLProvider (name to be determined)
> {
>   // returns an Iterator of all the URLs that have this resource 
> (trinidad-skins.xml)
>   // Design time team needs the ExternalContext to be able to find their 
> trinidad-skins.xml files.
>   // They put a parameter on the ServletContext to help them.
>   public Iterator<URL> findResources(ExternalContext context);
> }
>  
> 2. Usage in SkinUtils.java
>   a.  Call   List<TrinidadSkinsURLProvider> urlProviders = 
> ClassLoaderUtils.getServices(
>                                       
> "org.apache.myfaces.trinidad.share.io.TrinidadSkinsURLProvider");
>        to get the List of TrinidadSkinsURLProviders.
>   b. Call findResources for each TrinidadSkinsURLProvider
>   c. Call the existing trinidad-skins.xml parse code.
> Questions I plan to ask on the dev list:
> a. Is this idea acceptable?
> b. Are there existing Trinidad APIs that I'm not aware of that I could use 
> instead, like an existing ResourceLoader? 
> org.apache.myfaces.trinidad.resource.ResourceLoader does not have a 
> findResources method of any kind.
> c. Should we have a more generic class name, like URLProvider? Or 
> URLResourceProvider? If so, then we can pass in the filename to 
> findResources().
> d. What package should this go in? My mockup is in 
> org.apache.myfaces.trinidad.share.io.
> e. ClassLoader#getResources returns an Enumeration<URL>. Should this new API 
> be Iterator<URL> or should it match ClassLoader#getResources?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to