This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 200258

Summary: API Review: Friend API for JSF component libraries
Product: javaee Reporter: Martin Fousek <marfous>
Component: JSFAssignee: Martin Fousek <marfous>
Status: RESOLVED FIXED    
Severity: normal CC: apireviews, dkonecny, phejl
Priority: P3 Keywords: API, API_REVIEW_FAST
Version: 7.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: only the new api changes
full patch - API and usage
full patch 2 - API and usage
new api changes 2
full patch 3
new api changes 3
full patch 4
new api changes 4

Description Martin Fousek 2011-07-20 13:15:56 UTC
Created attachment 109531 [details]
only the new api changes

Currecnt way how to register new JSF component libraries over current friend API is insufficient and quite powerless. It has several base issues like:
- it permits to extend webmodule just about one library which has to be registered in IDE
- no way for additional customizations of the JSF component library
- there is no way how to do more things for additional webmodule updates (like changes of web.xml DD or faces-config.xml)

The plan is to replace current friend API with something more powerful - more similar to universal PHP APIs or WEB API. The main goal is to offer users also JSF component libraries which are not bundled with the NetBeans IDE.
Comment 1 Martin Fousek 2011-07-20 13:16:55 UTC
Created attachment 109532 [details]
full patch - API and usage
Comment 2 Petr Hejl 2011-07-20 14:20:35 UTC
PH1: Would be nice if you could annotate params and return values with @NonNull, @CheckForNull etc.
PH2: There is Set<JsfComponentImplementation> getJsfDescriptors() in JsfComponentProvider. I would expect getJsfComponents() considering class name.
PH3: Perhaps it would be better to return List or Collection from getJsfDescriptors() - I guess Set has no real benefit, but might confuse caller a bit.
PH4: createJsfComponentCustomizer seems to be kind of strong contract (declaring the customizer is always created). If clients depend on such behavior then it is ok, otherwise I would change it to getJsfComponentCustomizer and removed the javadoc saying the new customizer is always created.
PH5: SPI looks good, but it looks like it is used from client module (JSFFrameworkProvider). Perhaps there should be also API part to make future extensions easier.
Comment 3 Martin Fousek 2011-07-21 12:17:32 UTC
Created attachment 109553 [details]
full patch 2 - API and usage
Comment 4 Martin Fousek 2011-07-21 12:20:33 UTC
Created attachment 109554 [details]
new api changes 2

PH1-PH4 in the new patches
Comment 5 David Konecny 2011-07-21 18:32:29 UTC
Looks good. Thanks Martin.

DK1: double check but I think that JsfComponentImplementation.extend(WebModule) should actually be JsfComponentImplementation.extend(webModule, jsfComponentCustomizer) where jsfComponentCustomizer can be null. But in case a suite has some customizer and suite is being added to a project which is being created then extend() method needs to have an access to whatever data user entered in customizer instance.
Comment 6 Martin Fousek 2011-07-22 07:38:45 UTC
Created attachment 109563 [details]
full patch 3

(In reply to comment #5)
> Looks good. Thanks Martin.
> 
> DK1: double check but I think that JsfComponentImplementation.extend(WebModule)
> should actually be JsfComponentImplementation.extend(webModule,
> jsfComponentCustomizer) where jsfComponentCustomizer can be null. But in case a
> suite has some customizer and suite is being added to a project which is being
> created then extend() method needs to have an access to whatever data user
> entered in customizer instance.

That's a good point. But it seems that it is almost since PH4 comment fixed. There is no need for creating new customizer now, so the module can call getJsfComponentCustomizer itself in the extend method. Anyway for letting to customizer know that it should be initialized to defaults values (opening for first time cusomizer in new project or project properties) I extended getting of customizer to: 
public JsfComponentCustomizer getJsfComponentCustomizer(boolean initialize, @NullAllowed WebModule webModule); see the next patch
Comment 7 Martin Fousek 2011-07-22 07:39:05 UTC
Created attachment 109564 [details]
new api changes 3
Comment 8 Martin Fousek 2011-07-25 12:02:57 UTC
Created attachment 109597 [details]
full patch 4

PH5 - Finally I moved that into the client module since it's only place where it should be used. Thanks.
Comment 9 Martin Fousek 2011-07-25 12:03:34 UTC
Created attachment 109598 [details]
new api changes 4
Comment 10 Martin Fousek 2011-07-27 13:34:19 UTC
No new comments so I'm going to integrate tomorrow.
Comment 11 Martin Fousek 2011-07-28 06:53:21 UTC
web-main #8102e293bc4b

Thanks for the review.
Comment 12 Quality Engineering 2011-07-29 14:10:02 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/8102e293bc4b
User: Martin Fousek <marfous@netbeans.org>
Log: #200258 - API Review: Friend API for JSF component libraries