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

Bug 132228

Summary: Provide support for alternate validator implementations
Product: [WebTools] WTP Common Tools Reporter: Valentin Baciu <valentinbaciu>
Component: wst.validationAssignee: Valentin Baciu <valentinbaciu>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: csalter, david_williams, thatnitind, vbhadrir
Version: 1.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 132230, 132231    
Attachments:
Description Flags
Initial contribution
none
New un-checked disabled icon
none
New checked disabled icon
none
The new settings icon
none
The new settings disabled icon
none
New icon from Janet
none
New settings disable icon from Janet
none
Improved version of the original contribution
none
DelegatingValidator patch none

Description Valentin Baciu CLA 2006-03-16 14:24:03 EST
Currently, a validator provider can contribute one or more validators which work on the same file type. This can confuse the end user if both validators are enabled at the same time because the user could see multiple problem markers for the same problem.

The validation framework should support a way for validator implementers to contribute alternate implementations for a given validator type. Only one implementation will be enabled at one time for one validator.

The end user should be able to select which implementation to use globally, or on a project by project basis. The preference should be persistent.
Comment 1 Valentin Baciu CLA 2006-03-17 18:25:39 EST
Created attachment 36537 [details]
Initial contribution

Here's the proposed initial contribution to the validation framework.
Comment 2 Valentin Baciu CLA 2006-03-17 18:26:26 EST
Created attachment 36538 [details]
New un-checked disabled icon
Comment 3 Valentin Baciu CLA 2006-03-17 18:26:50 EST
Created attachment 36539 [details]
New checked disabled icon
Comment 4 Valentin Baciu CLA 2006-03-17 18:27:13 EST
Created attachment 36540 [details]
The new settings icon
Comment 5 Valentin Baciu CLA 2006-03-17 18:27:34 EST
Created attachment 36541 [details]
The new settings disabled icon
Comment 6 Valentin Baciu CLA 2006-03-20 16:46:15 EST
Created attachment 36631 [details]
New icon from Janet
Comment 7 Valentin Baciu CLA 2006-03-20 16:47:16 EST
Created attachment 36632 [details]
New settings disable icon from Janet
Comment 8 Vijay Bhadriraju CLA 2006-03-20 17:20:42 EST
Valentin, Chuck is the owner of the wst.validation <wst.validation-inbox@eclipse.org> inbox and only he has the authority to assign it. I have added myself on the CC list to get notfications from you
Comment 9 Vijay Bhadriraju CLA 2006-03-20 18:07:23 EST
Few changes i wanted to higlight after appling the patches

1. The settings column should only be added to the table if there exists a validator having a delegate validator with addtional preferences.
2. A cleaner appraoch would for the validator extension having some knowledge of the delagate validator i.e one exists for him like an additional optional boolean element in the validator ext pt. stating a delagate validator exists for it with default being false if no element is defined in the implementing extension.
3. Need to guard against existance of an extension to validatorDelegate.
Comment 10 Valentin Baciu CLA 2006-03-21 11:52:02 EST
Created attachment 36671 [details]
Improved version of the original contribution

Thanks for trying it out and for your comments Vijay. I will discuss your suggestions with Craig.

In the mean time, in order to move forward, this patch is an improved version of the original contribution. I have improved error handling and tested with and witouth a delegating validator and with no/one/two delegates. 

To avoid the need to instantiate a validator to find out if it is a delegating validator I implemented a method on the ValidatorMetaData which queries the delegates registry. In the future, this method could simply test the new flag on the validator extension as you proposed.

Please apply to your workspace and let me know how it goes.
Comment 11 Vijay Bhadriraju CLA 2006-03-21 12:45:15 EST
Valentin, The new patch looks good..i have committed your changes..thanks
Comment 12 David Williams CLA 2006-03-26 21:48:57 EST
Can I ask for clarification on this change? I've tried running what's in head, and see a new "settings" colomn in preferences ... is that related? (I can't see to do anything with it, though). 

My main concern is the statement about "same file type", and "contribute alternate implementations for a given validator type". So, what's a validtator type? I think it is quite ligitamate to have more than one validator per file type, and I think your requirement is to actual override a specific validtor? Not necessarily anything to do with "per type"? 

Comment 13 Craig Salter CLA 2006-03-26 22:38:28 EST
David, these changes are intended to simplify the user experience when dealing with multipe variations of the same 'kind' of validaton. I'll try to explain...

Let's take XML Schema as an example.  Some adopters want to provide their own  XML Schema validator but don't want to 'take away' the Xerces based validator that they get for free with WTP. In addition adopters would like to provide 'advanced' setting for specific validators to exploit customizable features (Xerces has a whole bunch of these goodies).

So without this feature adopters could provide additional XML Schema validators (MSXML, XSV, etc).  But this surely would confuse 'novice' users since they'd see multiple XML Schema validators showing up in the top level list.  

With this feature we're able to provide a single 'placeholder' XML Schema validator that shows up in the visible list of validators.  Then this 'placeholder' delegates to one of several possible validator impls (Xerces, MSXML, XSV, etc.)  The user can select a delegate validator (and specify other options that are specific to this delegate) in the validator preferences view.

Hopefully that explains things a bit.  I agree that if you're looking at this from the pure WTP UI today this wouldn't make much sense.  Once we add additional validation settings for Xerces it'll make more sense in the pure WTP enviroment.  Of course in adopter products there'll be more than one available validator implementation in the drop down list so the drop down will make more sense in adopter products too.
Comment 14 David Williams CLA 2006-03-27 02:11:24 EST
Craig, part of what I'm asking is how is "kind" defined? 

For example, I know there are mulitple JSP validtors, each doing some specific thing, so ... what is the difference between that, and what you are talking about? 
I assume both "replace" and "add to" models will be allowed? 

Additional question, is the reason you are adding this API because there is some true value add seen by adopters? Why not put all of them in WTP? (And, its fine if seen as value add ... I'm just wondering.) Or, is this more of a nice user feature, but its felt there isn't time to put in WTP 1.5, so this allows them to be put in later? 

Also, have you figured out how to tie this in to source page validation. That seems like a requirement, that I think your team should do, since you are introducing this change, especially this late. (That is, my team can not contain it). 

Comment 15 David Williams CLA 2006-03-27 02:12:24 EST
BTW, I would hope the same effort going into this, can be applied to gettng "content type" working in validation framework, since that seems more important to me. Are you also doing that? 
Comment 16 Nitin Dahyabhai CLA 2006-03-27 02:46:33 EST
Maybe I'm being obtuse, but I'm not sure I see the value of putting this into the validation framework and APIs directly as opposed to it being an ability specific to one validator extension.  The only confusion I can think of being alleviated is that there won't be 3 different validator extensions identifying themselves by the same name, but then I didn't expect that to happen if adopters played nicely anyway.

To boil it down, is there a foreseen and requested case where a user and adopter want to disable one validator for a "type" (ignoring the situation where a validator itself may be generating false errors)?  If I were seriously editing schemas, wouldn't I want feedback from Xerces, MSXML, *and* XSV, all of the time?  Do we have a second use case that makes it more obvious that this should be at the framework level?
Comment 17 Craig Salter CLA 2006-03-27 11:31:15 EST
To answer David's questions

> I assume both "replace" and "add to" models will be allowed? 
The delegate mechanism is intended to support different versions of validators that should be run in a mutually exclusive fashion.  If a validator needs to be contributed in an "add"  manner the existing validator framework has always support this.  Now if your asking to provide a pattern where delegates are additive, then that's an feature we haven't heard requests for from any adopters but when we do we'll be happy to consider.
  

> Additional question, is the reason you are adding this API because there is
> some true value add seen by adopters? Why not put all of them in WTP? 
Several adopters have expressed an interest in this function including IBM, BEA and others.  I should emphasize that we're not adding or changing 'API' these are internal changes to the validation framework plumbing.

> Also, have you figured out how to tie this in to source page validation... 
Yes we have this all figured out and my team will be taking care of this.  We'll be contributing a patch soon so that you can look it over.
All in all it's a very minimal change to the source editors.  In generally validation framework clients are completely unaffected by this change.  It's a fairly minor and isolated change.

>BTW, I would hope the same effort going into this, can be applied to gettng
>"content type" working in validation framework, since that seems more  >important to me. Are you also doing that? 

Bug 86385 is important to me too.  My team is making this particular change since it's been explicitly requested by our favourite adopter and is deemed high priority.  Once we finish this work I'll be more than happy to work with the validation framework team to address bug 86385.  David, will your team be willing to lend a hand on the bug 86385 effort?
Comment 18 Valentin Baciu CLA 2006-04-01 03:41:48 EST
Created attachment 37456 [details]
DelegatingValidator patch

Modified to implement IValidatorJob instead of IValidator.
Comment 19 Vijay Bhadriraju CLA 2006-04-03 14:17:37 EDT
The recent patch for Delegating Validator has been released to the 1.5 stream
Comment 20 Craig Salter CLA 2006-04-23 03:38:00 EDT
I believe we've completed this work now.
Comment 21 Valentin Baciu CLA 2006-06-14 13:53:58 EDT
Verified. Closing now.