In case that you call in jboss-cli read-resource() on datasource subsystem you will get datasource as undefined: /subsystem=datasources:read-resource() { "outcome" => "success", "result" => { "xa-data-source" => undefined, "data-source" => {"ExampleDS" => undefined}, "jdbc-driver" => {"h2" => undefined} } } This makes problem in case of using DMR api and commands. When you call the same command in your app and you want to check existence of the data source in this way: modelNodeReturn.get("result").get("data-source").get("ExampleDS").isDefined(); you will get "false". But the datasource exists and it's quite nicely defined. Command should return true. Workaround: The isDefined() starts to work when the command is called with recursive=true. As sort of reproducer could be used my testing class https://github.com/ochaloup/jboss-dmr-test/blob/4446a1ce387126e9ba2b5dea93c83c36bbfea5e4/src/main/java/ochaloup/OperationsMain.java
This is not going to change. ModelNode.isDefined() has a different meaning. You are supposed to use recursive=true. BTW, in case of data-source's, if there is data-source=XXX, it means XXX is actually there. The management won't allow XXX to be undefined.
Hi Alex, ok, I see. Just it isn't much intuitive. I would expect that isDefined() returns true in any case that a node is 'somelike' defined. I understand that I can visually see that data-source=XXX is defined in cli. But when I want to check this in code then I can't check anything visually. In case that it's supposed behavior and you think that it's ok for users then please close this bugzilla. Thanks