I think I started a thread with almost the same subject line in May.<br><br>"aggregating tag libraries under a common namespace"<br><a href="http://archives.java.sun.com/cgi-bin/wa?A1=ind0905&L=JSR-314-OPEN&X=4F15AC05AE45097D70#3">http://archives.java.sun.com/cgi-bin/wa?A1=ind0905&L=JSR-314-OPEN&X=4F15AC05AE45097D70#3</a><br>
<br>Glad to see a patch.<br><br>-Dan<br><br><div class="gmail_quote">On Fri, Nov 13, 2009 at 10:10 AM, Lincoln Baxter, III <span dir="ltr"><<a href="mailto:lincolnbaxter@gmail.com">lincolnbaxter@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><p>Forwarded from dev list.</p>
<p>Lincoln Baxter III<br>
<a href="http://ocpsoft.com" target="_blank">http://ocpsoft.com</a><br>
<a href="http://scrumshark.com" target="_blank">http://scrumshark.com</a><br>
Keep it simple.</p>
<p></p><blockquote type="cite">---------- Forwarded message ----------<br>From: "Matthias Berndt" <<a href="mailto:matthias.berndt@systemtrap.net" target="_blank">matthias.berndt@systemtrap.net</a>><br>Date: Nov 13, 2009 10:01 AM<br>
Subject: [jsr-314-open] Allow multiple taglib.xml files for the same namespace<br>To: <<a href="mailto:dev@javaserverfaces.dev.java.net" target="_blank">dev@javaserverfaces.dev.java.net</a>><br><br>Hello,<br>
<br>
first I'd like to explain my intention. The scenario is writing multiple<br>
JSF components being bundled in more than one java archive. Each java<br>
archive has its own taglib.xml descriptor so you can use them<br>
separately. These components belong to the same project or organisation<br>
and should be published within the same namespace. This isn't possible<br>
with facelets at the moment and is a known issue to facelets. See:<br>
<a href="https://facelets.dev.java.net/issues/show_bug.cgi?id=118" target="_blank">https://facelets.dev.java.net/issues/show_bug.cgi?id=118</a><br>
<br>
To support this scenario I'm aware of 3 possible solutions.<br>
<br>
The first one is merging the needed java archives especially the<br>
taglib.xml. I think this one is bad because the separation between the<br>
component projects is destroyed.<br>
<br>
The second one is merging the taglib definitions while being processed<br>
by FaceletTaglibConfigProcessor#processTagLibrary(). In line 308 a new<br>
TagLibraryImpl is created for every facelet-taglib element. This can be<br>
extended to use an already existing TagLibraryImpl for a specific<br>
namespace. This extension requires about 10 to 15 lines of code. As a<br>
result there will be one TagLibraryImpl for multiple facelet-taglib<br>
elements with the same namespace.<br>
<br>
The third one, my preferd one, is using the existing<br>
CompositeTagLibrary. As a result and in contrast to the second method<br>
each facelet-taglib element will be represented by a TagLibraryImpl and<br>
combined by CompositeTagLibrary. This requires only a minor change. In<br>
FaceletTaglibConfigProcessor#processTagLibrary() in line 318 the created<br>
TagLibraryImpl is added to the compiler. Compiler#addTagLibrary() tests<br>
if the given library is already known to the compiler. Subsequently this<br>
is done by using equals() and hashCode() in AbstractTagLibrary. At the<br>
moment hashCode() is implemented to use nothing except the namespace. If<br>
there are multiple TagLibraryImpl with the same namespace only one will<br>
be included in the compiler. The rest is thrown away. By extending<br>
hashCode() to use this.factories and this.functions in the calculation<br>
multiple TagLibraryImpl with different tags etc. can coexist. IMO it<br>
makes sense by reason taglibs are not equal only because they define the<br>
same namespace.<br>
CompositeTagLibrary handles this very well so no other changes are<br>
required.<br>
<br>
I attached a patch to modify AbstractTagLibrary#hashCode(). The<br>
algorithm is base on Joshua Bloch's Effective Java. The existing test<br>
cases are not harmed and apologize my self not writing a specific test<br>
case. I don't like to call it a patch because it's so stupidly simple,<br>
but I'd be glad if something like it could be shipped with JSF2 to<br>
provide this feature.<br>
<br>
kind regards,<br>
<font color="#888888">Matthias Berndt<br>
</font><br>---------------------------------------------------------------------<br>
To unsubscribe, e-mail: <a href="mailto:dev-unsubscribe@javaserverfaces.dev.java.net" target="_blank">dev-unsubscribe@javaserverfaces.dev.java.net</a><br>
For additional commands, e-mail: <a href="mailto:dev-help@javaserverfacesdev.java.net" target="_blank">dev-help@javaserverfaces.dev.java.net</a><br></blockquote>
</blockquote></div><br><br clear="all"><br>-- <br>Dan Allen<br>Senior Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><a href="http://mojavelinux.com">http://mojavelinux.com</a><br>
<a href="http://mojavelinux.com/seaminaction">http://mojavelinux.com/seaminaction</a><br><a href="http://www.google.com/profiles/dan.j.allen">http://www.google.com/profiles/dan.j.allen</a><br>