You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Mike Kienenberger <mk...@gmail.com> on 2007/12/19 17:56:55 UTC

Re: Cayenne XML Names [wildcard resource lookup]

On Dec 19, 2007 11:27 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
> > * Have Cayenne resolve all *.cayenne wrappers at the root of the
> > CLASSPATH upon startup.
>
> How are you planning to do that? The only environment independent way
> that I know of in Java is "ClassLoader.getResources(String)" which
> requires an exact name, not a pattern. This would work for multiple
> cayenne.xml in the root of different jars, but won't work for
> "*.cayenne" (there are some workarounds that may potentially limit
> portability).

I think other projects have done this.   Here's an issue I hit with it long ago.
Note that both Spring and Facelets have apparently made this work.  I
don't know a lot about the details, but it's covered somewhat for
facelets and spring in the following message.

---------- Forwarded message ----------
From:  <ja...@hookom.net>
Date: Dec 23, 2005 1:34 PM
Subject: Re: " Missing Built-in Tag Libraries!" under Oracle 10.1.2.0.0
To: users@facelets.dev.java.net
Cc: users@facelets.dev.java.net



There are actually two different ways of handling this:

1) Request the specific file, which works fine off of the resource
loader: /META-INF/faces-config.xml

2) Facelets needs to search for all taglib.xml files, so it does:

/META-INF/

Then walks through the classloader for each resource returned over
/META-INF/ for any taglib.xmls

This is working fine in all but OC4J :-/



Mike Kienenberger <mk...@gmail.com> wrote on 12/23/2005, 06:54:15 PM:
> On 12/23/05, Sebastián Fiorentini
>  wrote:
> >  Mike, I'm using OC4J and the only way to make things work is to specify the
> > fecelets taglib in web.xml with the
> >
> >
> >          facelets.LIBRARIES
> >
> >  There is a bug within OC4J ClassLoader.getResources that makes the things
> > go wrong (for example, the Spring guys are dealing with the same horrible
> > problem at
> > http://opensource2.atlassian.com/projects/spring/browse/SPR-665).
> > By the way it seems to be fixed by OC4J 10.1.3 (in EA phase now)
>
> The problem with that workaround is that I have to do it for all jars
> with facelet config files, which I can do if that's the only issue.
>
> Any thoughts on why it works (I'm guessing it works, at least) with
> META-INF/faces-config.xml files but not META-INF/*.taglib.xml files?
>
> Is MyFaces using a different methodology for finding faces-config.xml files?
>
> Is anyone successfully using OC4J 10.1.2 with MyFaces?
>

Re: Cayenne XML Names [wildcard resource lookup]

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Dec 19, 2007, at 6:56 PM, Mike Kienenberger wrote:

> Then walks through the classloader for each resource returned over
> /META-INF/ for any taglib.xmls

Yep. In 99.9% of cases the returned resource URL points either to a  
file or to a jar, so you can grep the URL for the environment pattern  
and go from there (although theoretically it can be some network  
resource that does not support "list" operation). That's what I meant  
by the workaround.

Andrus