[jboss-as7-dev] Validation of writable attribute with alternatives
Brian Stansberry
brian.stansberry at redhat.com
Thu Apr 19 09:38:26 EDT 2012
A solution to this kind of thing that's been used in a few places is to
have the Stage.MODEL handler add another handler, also in Stage.MODEL.
So, if your handler is an AbstractWriteAttributeHandler subclass you
could do this in populateModel().
The handler you add can verify constraints that span multiple
attributes, e.g. only one of a set of alternatives is set.
Doing it this way can be helpful if a composite operation is used to
switch from one alternative to another. So step 1 in the composite uses
write-attribute to set one alternative to undefined and then step 2 uses
write-attribute to set the other alternative. The handler you add to
verify the "alternative" constraint will run after both those steps, so
it will be verifying the actual final intended state, not just a halfway
point.
On 4/19/12 7:11 AM, Kabir Khan wrote:
> Or supply a ParameterValidator which looks for the alternatives? That will happen in the MODEL stage
> On 19 Apr 2012, at 13:04, Jeff Mesnil wrote:
>
>> Replying to my own question.
>>
>> I can subclass AbstractWriteAttributeHandler.applyUpdateToRuntime() to
>> verify the attribute alternatives for the resource (e.g.
>> HttpManagementWriteAttributeHandler).
>>
>> The only difference is that this occurs at RUNTIME step, not at VERIFY.
>> Is it a big difference? (in case of an alternative already defined, I
>> flag the context as rollback only anyway).
>>
>> thanks to tomaz for pointing this out
>>
>> jeff
>>
>> --
>> Jeff Mesnil
>> JBoss, a division of Red Hat
>> http://jmesnil.net/
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
--
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat
More information about the jboss-as7-dev
mailing list