Skip to main content

JSF Mojarra 1.2 implemenation MessageFactory

2 replies [Last post]
vladbalan
Offline
Joined: 2008-11-09

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

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.

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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ryan Lubke

On 4/22/09 5:13 AM, webtier@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@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

vladbalan
Offline
Joined: 2008-11-09

Hello Ryan,

thank you for responding to this thread. Of course, the tutorial-related question might not be so important. It is clear that the MessageFactory class in the tutorial is a copy of the MessageFactory in the Mojarra, stripped here and there of some calls, like those:

ApplicationFactory afactory = (ApplicationFactory)
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
return (afactory.getApplication());

in the getApplication() method.

The point of my question was what happens if you create an Application object in the business classes of your JSF web application. How does it interact with the Application instanciated by Mojarra itself (suppose you use Mojarra as the JSF implementation). Since the tutorial decided to eliminate those calls from its MessageFactory (regard it as just a class as any in the web app called bookstore6), it must be for some reason, avoiding something unallowed.

Thanks and sorry for insisiting.