dev@jersey.java.net

Re: resource model validation

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 24 Jan 2008 10:14:39 +0100

Peter Liu wrote:
>>> For NB, since we are working with source files,
>>> java reflection information is not available.
>>>
>>
>> Does not NB compile the source anyway to produce compile errors? Is
>> there any way to hook things up that way? Are there any other NB
>> plugins that highlight app specific runtime time errors when editing
>> source?
> Yes, it does but not to the point where class files are generated.
> Hooking the validator up to that compilation process is exactly what I
> am thinking.
> I would like to see errors shown in the editor like you see with a
> normal pojo while an user is editing the file.
> Alternatively, we can do the validating during compile time so
> developers at least see the errors in the output window. But it would be
> very nice if we can do the first approach.

Agreed.


> Nam, do you think we can at least run the validator during build time
> and somehow link the errors back to the source file in the output window?
>>
>> As i said before we could make the abstract model generic such that a
>> validator could be written independent of the actual types mapped to
>> the generic types.
>>
>> One concern i have is that we don't have much time to work on this to
>> make things more generic. Plus there are still some open areas for
>> validating method parameters we need to work on so i am unsure if
>> validation can be fully independently shared between source and
>> runtime-generated abstract models. But perhaps if you see value in
>> this approach perhaps we could work together?
>>
> I would definitely like to see the abstract model be more generic so we
> can reuse the validator instead of implementing our own validator
> because it would be hard to keep
> it in sync with the spec. We definitely won't have time during the NB
> 6.1 time frame to work on this. Perhaps we can work together on this
> for NB 7.0. We can work on
> the implementation for NB if we work out the generic abstract model.
>

OK, lets chew over this for the 7.0 time-frame, i am sure there are
things we can do here.

IMHO the big picture would be for NB to write an abstract model
introspector that creates an abstract model from the NB AST. Then we
should be able to utilize the same validator that operates on the
abstract model as is used for the runtime (but in addition you may also
require a specific validator in some cases, for example methods that are
not public). Through the specific artifacts associated with the generic
types it should be possible to connect the warnings/errors back to the
source.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109