Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 302621

Summary: [JSF2.0] Facet presets and JEE6
Product: [WebTools] Java Server Faces Reporter: Yury Kats <yurykats>
Component: CoreAssignee: Cameron Bateman <cameron.bateman>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: debajit.adhikary, konstantin, raghunathan.srinivasan, robert_gallagher, spaxton
Version: 3.1.2   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard: JSF2.0
Attachments:
Description Flags
Convert to dynamic presets for facets
none
Change to static presets with one preset per version none

Description Yury Kats CLA 2010-02-11 14:06:31 EST
Facet preset configuration need to be adjusted for JEE6/Java6 support.

Right now, when targeting a JEE6 server, I see "JSF 1.1" configuration in the New Dyn Web project wizard.

Problems that need to be addressed:

1. New "JSF 2.0" preset has to be created, based on a new JSF 2.0 facet. (see bug 295261)

2. "JSF 1.1" preset uses dynamic configuration (not sure why. "jsf 1.2" is static, which provides better performance). This dynamic configuration (org.eclipse.jst.jsf.core.internal.project.facet.JSFConfigurationPresetFactory11) treats web levels above 2.4 as Java 5. This is no longer correct.
Comment 1 Yury Kats CLA 2010-02-11 14:26:46 EST
re my question about why 1.1 preset is dynamic while 1.2 is static.

Found a related discussion and the bug that introduced the dynamic 1.1 preset in bug 218333.

Still unclear why 1.1 has to be dynamic though.
Comment 2 Yury Kats CLA 2010-02-19 10:44:41 EST
I think it makes sense to address this along with bug 295261 (adding version 2.0 to the facet). That bug is targeted to M6, this one to M7.
Comment 3 Yury Kats CLA 2010-03-04 10:52:17 EST
The newly added JSF2.0 preset (bug 295261) is not available when targeting a JEE6 server.

The preset is configured for Java=5 and Web=2.5, which is true for JEE5
servers, but not JEE6.
Comment 4 Cameron Bateman CLA 2010-03-04 22:08:56 EST
Created attachment 161064 [details]
Convert to dynamic presets for facets

Yury, could you see if this solves the problem?
Comment 5 Yury Kats CLA 2010-03-05 09:50:34 EST
> Convert to dynamic presets for facets
> Yury, could you see if this solves the problem?

Here is what I see with these dynamic presets:
1. pre-JEE5 server: JSF 1.1
2. JEE5 server: JSF 1.1, JSF 1.2, JSF 2.0
3. JEE6 server: JSF 1.1, JSF 1.2, JSF 2.0

So the patch does solve the problem as far as it makes JSF2.0 preset visible when targeting JEE6 servers.

However, I am not sure that having all 3 presets available for JEE5 and JEE6 really makes sense. 
1. It really clutters the list of choices. The lists grows longer and longer.
2. It is not clear for the user what to pick when multiple options are offered. A natural inclination for the user would be to pick the highest version offered, which would always be JSF2.0. It will obviously not work out of the box with JEE5 servers, since they don't support JSF 2.0, thus the user is driven to creation of non-working projects.
3. The user usually does not even know the difference between various JSF versions. All the user wants to do is to create a JSF-enabled project that runs with the server of his choice.  

With all this in mind, I would propose that only best applicable JSF version is shown for each runtime type, that is
JSF 1.1 for pre JEE5
JSF 1.2 for JEE5
JSF 2.0 for JEE6

As long as there is a dynamic preset, the preset can even have a generic name "JSF" and calculate the version of the JSF facet based on Web facet version.

An advanced user, who wants to configure a non-standard JSF/JEE compbination (like running JSF2 on JEE5) would still be able to change facet versions manually. 

However, in our adopter product we discovered that dynamic presets negatively affect overall product performance and memory footprint. The problem is that the plugin that contributes a dynamic preset has to be always loaded (for preset to be calculated) by the framework. Even for the user that is not interested in JSF projects at all and is never going to touch any JSF tooling, JSF plugin would be loaded just for the preset to be shown in the dropdown.

For this reason, in our adopter product, we switched away from dynamic presets to static ones. I suggest WTP JSF consider this route as well.

In this case, JSF2 preset would be static, declared as "web=3.0 and java=1.6".
Comment 6 Cameron Bateman CLA 2010-03-05 11:12:07 EST
Created attachment 161134 [details]
Change to static presets with one preset per version
Comment 7 Cameron Bateman CLA 2010-03-05 11:15:20 EST
> However, I am not sure that having all 3 presets available for JEE5 and JEE6
> really makes sense. 

Seems reasonable.  I'm going to CC Konstantin in case he wants to weigh in on the facet stuff in comment 5.
Comment 8 Konstantin Komissarchik CLA 2010-03-05 11:51:36 EST
I think this pretty well illustrates the general problem with presets. We have three presets for adding one facet to the starting configuration. I would say that in general if the presets combo exceeds say 10 items at the max and the items listed cannot be differentiated at a quick glance, the setup has failed to achieve its goals.

Dynamic presets are used to reduce the number of items in the list.

Just saying don't get too attached to presets... This concept will likely be de-emphasized in future releases and eventually removed.
Comment 9 Yury Kats CLA 2010-03-05 13:40:38 EST
The new static presets look good to me.

Note though, that Konstantin changed Java facet version numbers, so you better be referencing java "1.5" and "1.6", instead of "5.0" and "6.0". The old would still work (for now), but are deprecated.
Comment 10 Cameron Bateman CLA 2010-03-08 13:33:02 EST
Changes committed to HEAD (3.2 M6).
Comment 11 Yury Kats CLA 2010-03-08 14:42:13 EST
(In reply to comment #10)
> Changes committed to HEAD (3.2 M6).

I get an error upon checking out the current state from the HEAD:

Description	Resource	Path	Location	Type
Package 'org.eclipse.jst.jsf.core.internal.contenttype' does not exist in this plug-in	MANIFEST.MF	/org.eclipse.jst.jsf.core/META-INF	line 47	Plug-in Problem

Looks like you're working on other issues as well and have not checked them in.
Comment 12 Cameron Bateman CLA 2010-03-08 14:46:27 EST
(In reply to comment #11)
> (In reply to comment #10)
> > Changes committed to HEAD (3.2 M6).
> 
> I get an error upon checking out the current state from the HEAD:
> 

Thanks for the catch.  Should be fixed.