kashipai / h2database

H2 Database for reference.
0 stars 0 forks source link

Make dependency on org.osgi.service.jdbc optional #559

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

The DataSouceFactory specification is not supported by default in most OSGi 
frameworks. When installing the H2 driver in an OSGi container it requires that 
the 'org.osgi.service.jdbc' packages are available and will not start unless 
they are.

This makes it more difficult to use the bundle to simply provide the JDBC 
driver straight off.

I suggest that the DataSourceFactory is published only if these packages are 
available in the OSGi container and that the Import-Package directive is set as 
optional.

I've attached a patch that adds this behavior.

Best regards //Anders

Original issue reported on code.google.com by epirea...@gmail.com on 23 Apr 2014 at 1:35

Attachments:

GoogleCodeExporter commented 9 years ago
Here's new patch where I'm using Utils.loadUserClass to check for the 
availability of DataSourceFactory.

I've also moved the registration of the DataSourceFactory service to the 
OsgiDataSourceFactory class.

Original comment by epirea...@gmail.com on 28 Apr 2014 at 6:22

Attachments:

GoogleCodeExporter commented 9 years ago
You patch ignored exceptions while registering. I changed the patch a bit, and 
committed it in revision 5630. Could you check if this is correct?

Original comment by thomas.t...@gmail.com on 2 May 2014 at 7:55

GoogleCodeExporter commented 9 years ago
Should be fixed in 1.4.178

Original comment by thomas.t...@gmail.com on 2 May 2014 at 1:19

GoogleCodeExporter commented 9 years ago
Good call, Thomas. Your error handling makes more sense. 

I've tested the bundle locally, and it seems to behave as expected :)

Original comment by epirea...@gmail.com on 2 May 2014 at 1:35