[VFS] How to inject reference (DataSource) to Provider

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[VFS] How to inject reference (DataSource) to Provider

Bernd Eckenfels
Hello,

here is my first draft of a VFS2 Provider which allows you to store files  
as Blobs in a Database. I have the problem here, that I need to set the  
actual database connection. I decided to only support the DataSource  
interface.

I tried to set it via the FS-Options, so you can have multiple filesystems  
attached to multiple databases. However this does only work with some  
specific simple types, but not generally with Objects. I guess this is a  
consequence of the configuration serialisation, but I wonder what can I do  
instead?

Currently I added the DataSource as a parameter to the constructor of the  
Provider class. This works somewhat, but forces me to have multiple scheme  
when I want to access multiple databases.

I plan to support a JNDI variant, where the DataSource is requested from  
(String) JNDI name via FS-Options, But this does not work in all  
Deployment scenarios, so I really search for the most prefered method to  
inject resources. Anybody has an Idea?

https://github.com/ecki/seeburger-vfs2/blob/master/vfs2provider-jdbctable/src/main/java/com/seeburger/vfs2/provider/jdbctable/JdbcTableProvider.java#L57

https://github.com/ecki/seeburger-vfs2/blob/master/vfs2provider-jdbctable/src/test/java/com/seeburger/vfs2/provider/jdbctable/test/StandaloneClient.java#L34

Greetings
Bernd

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]