jboss_cli_client.jar file has method to read data source configuration parameter from properties file and from that can form CLI command
I'm not exactly sure if I understand your question. You can do anything you want using any JVM language. See Advanced CLI scripting with Groovy, Rhino, Jython, etc.
Retrieving data ...