Typically this abstraction is done a layer higher using the DAO pattern. You can create different DAO implementations for your various storage formats including XML, flat file and relational database.
If you want to register a DataSource with a JNDI provider and have that DataSource use a flat file, you will likely encounter problems. The javax.sql.DataSource interface deals with java.sql.Connection objects. You would confuse users of your API that are expecting to be able to use the DataSource to get Connection objects and deal with them according to standard JDBC standards.