[jboss-as7-dev] Detyped API document feedback
David M. Lloyd
david.lloyd at redhat.com
Wed Jan 5 08:10:23 EST 2011
On 01/04/2011 11:46 PM, Brian Stansberry wrote:
> On 1/4/11 11:02 AM, David M. Lloyd wrote:
>
>> I'd rather do something more dynamic where you can start with a node and
>> just build up whatever you want from it:
>>
>> node = new ModelNode();
>> node.get("operation").set("change-bind-port"); // string
>> node.get("address").add("base, "domain"); // a list
>> node.get("address").add("profile", "web");
>> node.get("address").add("subsystem", "web");
>> node.get("address").add("connector", "ssl");
>> node.get("bind-port").set(8433); // int
>> result = connection.execute(node); // goes over remoting
>> System.out.println("Result is: " + result);
>> // nicely formatted, JSON-style (but with more possible types)
>>
>> I wipped up a demo of this style of API at:
>> https://github.com/dmlloyd/jboss-dmr
>>
>> Notice there's only one public class and one type enum. (The Validation
>> class isn't anything, just an experiment.)
>>
>
> The add(String, String) method isn't there; just set(String, ModelNode).
> That would be ok if there were overloaded ModelNode constructors to
> match the set() methods, allowing you to create a model node, set it's
> value and pass it as a method parameter all in one line:
>
> node.get("address").add().set("base", new ModelNode("domain"));
>
> A whole bunch of overloaded variants (set(String, String), set(String,
> boolean), set(String, int) etc) would accomplish the same thing.
Yeah I knew you'd notice the missing stuff. :-) Well it's all fixed
now. I rounded it out with a bunch of methods that were missing,
including setEmptyList/setEmptyObject, plus some formatting improvements
for toString().
> I played at creating a couple "update plans" (pretty much like the
> Alpha1 deployment plans) and it was pretty painless, except for the
> minor nit above.
Maybe try again with the most recent version?
--
- DML
More information about the jboss-as7-dev
mailing list