So, I've pushed the prototype for the new approach.
http://community.jboss.org/wiki/GenericTypeCLICommands
Advantages
- any changes in the management model (added/removed operations,
properties, etc) become immediately available in CLI commands without
code changes in the CLI;
- command help content is generated from the description of type,
operations and properties in the management model (so, no text
duplication, localization, etc);
- commands can be added and removed at runtime and customized by the user;
-the total number of cli commands will decrease and they, in a way, will
be better categorized.
Disadvantages
Tab-completion suffers from insufficient info in the management model
about the types, values and relationships/dependencies between the node
and operation properties.
- enumeration values, if the type is boolean, I can do it, but if it's
something else (e.g. tx isolation) the allowed values would have to be
specified in the management model for the type in fixed format;
- exclusive properties, e.g. driver-class/driver-name for datasources.
If I code the data-source command myself I can automatically exclude one
if the other one has been specified;
- referencing properties, e.g. driver-name accepts values that are
registered jdbc driver names, for that to tab-complete, this reference
would have to be described in the model.
There are probably other things that I forgot to mention. I'll follow up
if I remember something.
As always, feedback, ideas, suggestions are welcome.
Thanks,
Alexey
PS: it's not yet in the master as I send it, I did send the pull request
though, so, it's gonna be soon.