You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Pavitra Subramaniam <pa...@oracle.com> on 2010/09/17 04:24:50 UTC
Re: [TRINIDAD] public URLProvider API needed for TRINIDAD-1914
On 9/13/2010 5:13 PM, Jeanne Waldman wrote:
> Hi,
>
> Today I created a new jira issue,
> https://issues.apache.org/jira/browse/TRINIDAD-1914 provide a hook
> for external decorator to find trinidad-skins.xml from a location
> other than META-INF or WEB-INF.
>
> I have some questions I need help answering. I've listed them in the
> JIRA issue, but I'll reiterate here.
>
> 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.
>
> 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 *
>
> 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.
Could we add the findResources() method to this class and extend it
(SkinsResourceLoader) rather than have a custom TrinidadSkinsURLProvider?
> 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?
I would prefer an Iterator over Enumeration.
Thanks
Pavitra
>
> Thanks,
> Jeanne
Re: [TRINIDAD] public URLProvider API needed for TRINIDAD-1914
Posted by Pavitra Subramaniam <pa...@oracle.com>.
+1
Thanks
Pavitra
On 9/17/2010 2:29 PM, Jeanne Waldman wrote:
> Hi,
> This is what I'm going to do:
>
> 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");|
>
> Let me know if you have any objections.
> Thanks,
> Jeanne
>
> Jeanne Waldman wrote, On 9/17/2010 8:42 AM PT:
>> Thanks Pavitra. see inline
>>
>> Pavitra Subramaniam wrote, On 9/16/2010 7:24 PM PT:
>>> On 9/13/2010 5:13 PM, Jeanne Waldman wrote:
>>>> Hi,
>>>>
>>>> Today I created a new jira issue,
>>>> https://issues.apache.org/jira/browse/TRINIDAD-1914 provide a hook
>>>> for external decorator to find trinidad-skins.xml from a location
>>>> other than META-INF or WEB-INF.
>>>>
>>>> I have some questions I need help answering. I've listed them in
>>>> the JIRA issue, but I'll reiterate here.
>>>>
>>>> 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.
>>>>
>>>> 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 *
>>>>
>>>> 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.
>>> Could we add the findResources() method to this class and extend it
>>> (SkinsResourceLoader) rather than have a custom
>>> TrinidadSkinsURLProvider?
>> I was thinking this as well this morning, since it is a resource
>> loader. Let me investigate more along these lines today. I'd like to
>> not change existing code, so I'm wondering if I could add a
>> SkinsResourceLoader that only has findResources(). Later we could
>> extend an existing ResourceLoader - I'll see if this is possible.
>>>> 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?
>>> I would prefer an Iterator over Enumeration.
>> yes, me too. This is what I will do.
>>> Thanks
>>> Pavitra
>>>>
>>>> Thanks,
>>>> Jeanne