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