admin@glassfish.java.net

Re: Question for Remote Command Developers

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Tue, 08 Apr 2008 08:23:02 -0500

Does this mechanism - or if not can it be altered to - allow the server
to compute, at runtime, what the valid values are? For example, post
TP2 when we support multiple instances and targets it would be nice to
be able to "bake" that validation into the parameter definition.

Same sort of thing for domain names, etc.

- Tim

Byron Nevins wrote:
> I've implemented, but not checked in yet, support for validating param
> values against an acceptable list of values.
> This is immediately useful for boolean parameters -- we want
> 'booleanOptionX=garbage' to be a hard error rather than just silently
> setting it to false.
>
> Are there other use cases for "acceptableValues" in Remote Commands?
>
> E.g.
>
> before:
> @Param(optional=true)
> String enabled = Boolean.TRUE.toString();
>
> after:
> @Param(optional=true, acceptableValues="true,false")
> String enabled = Boolean.TRUE.toString();
>
> At injection time -- if the parameter has a value -- then it is
> compared against the comma separated list of acceptable values.
> If it does not match any of them -- an Exception is thrown before the
> execute() method is called.
>