How would i programmatically retrieve usage statistics for datasources deployed on JBoss? Its possible with GlassFish, however lost on how to do the same for JBoss.
You can do that via JMX.
For a start, go to http://localhost:8080/jmx-console and search for the JNDI name of the data source. This will show ~ 3 mbeans per datasource from where you can then get the statistics.
Of course you can get at the data programmatically - just follow the AMX example in your glassfish link on how to talk to the MBeanServer - of course you need to change the ObjectNames and Attribut names to reflect the JBoss ones.