Toivo, I'm guessing the original DBCPService API only has getConnection() because that was all that was really needed by the processors at the time, and/or to keep more control over the DataSource object (for example, the controller service's shutdown() method closes the DataSource). Having said that, NiFi has extended other APIs to allow more access to the underlying objects, with the caveat that the user must take care of more of the "plumbing"/lifecycle. An example is the ProcessSession.read(flowFile) method [1] which returns an InputStream (rather than requiring an InputStreamCallback to which the InputStream is provided and otherwise managed by the framework).
For that reason, and because DataSource is part of javax.sql vs. needing an additional DBCP dependency in the API, I think getDataSource() is a legitimate addition to the DBCPService API if you have other NiFi work that requires it. One thing to note: the nifi-hive-nar supplies subclasses of DBCPService, so any changes to the API would have to be implemented in those subclasses as well (HiveConnectionPool [2], unit tests, etc.) Regards, Matt [1] https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java#L570 [2] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java On Mon, Jan 9, 2017 at 4:20 AM, Toivo Adams <toivo.ad...@gmail.com> wrote: > Spring JdbcTemplate, SimpleJdbcCall and DataSource > > Does anybody use Spring JdbcTemplate, SimpleJdbcCall? > Both take DataSource constructor parameeter and not Connection. > And later when SimpleJdbcCall (or JdbcTemplate) need Connection, it will ask > it from DataSource and release afterwards. > > Currently DBCPService returns only Connection. > I want to add method which returns also DataSource. > > Opinions? > > Thanks > Toivo > > > > > -- > View this message in context: > http://apache-nifi-developer-list.39713.n7.nabble.com/Spring-JdbcTemplate-SimpleJdbcCall-and-DataSource-tp14405.html > Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.