webtier@glassfish.java.net

Re: [webtier] JSF Mojarra 1.2 implemenation MessageFactory

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Wed, 22 Apr 2009 07:56:45 -0700

On 4/22/09 5:13 AM, webtier_at_javadesktop.org wrote:
> Hello,
>
> this post may be deprecated from start since JSF 2.0 is available.
> I'm trying to learn from the JSF 1.2 Mojara implementation. I'm using mojarra-1.2_09-b02-FCS-source.zip
>
1.2_12 is currently the latest.
> I saw several identical "MessageFactory" classes. They are placed whithin :
> jsf-api/build/generate/javax.faces.component
> jsf-api/build/generate/javax.faces.convert
> jsf-api/build/generate/javax.faces.validator
> jsf-api/build/generate/javax.faces.webapp
>
> Is there a reason they are duplicated like this? Thank you very much.
>
Yes, they are duplicated as package private classes as MessageFactory
isn't a part of the public API.
> Also i confronted them to the com.sun.bookstore6.util.MessageFactory indicated by the Java EE 5 tutorial
> (
> [i]Instead of writing your own message factory pattern, you can use the one included with the Duke’s Bookstore application. It is called MessageFactory and is located in tut-install/javaeetutorial5/examples/web/bookstore6/src/java/com/sun/bookstore6/util/[/i] - page 391 in the PDF of the tutorial
> ).
>
> Here we have:
>
> [i] protected static Application getApplication() {
> return (FacesContext.getCurrentInstance().getApplication());
> }[/i]
>
> And in the "MessageFactory" classes in the JSF implementation there is:
>
> [i] protected static Application getApplication() {
> FacesContext context = FacesContext.getCurrentInstance();
> if (context != null) {
> return (FacesContext.getCurrentInstance().getApplication());
> }
> ApplicationFactory afactory = (ApplicationFactory)
> FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
> return (afactory.getApplication());
> }[/i]
>
> Why is the "ApplicationFactory" call missing in the tutorial sample.
>
It's a different implementation.
> Thanks so much for your patiance.
> [Message sent by forum member 'vladbalan' (vladbalan)]
>
> http://forums.java.net/jive/thread.jspa?messageID=343214
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>