开发者

eclipse plugin/rcp: configure driver defintions similar to jdbc

开发者 https://www.devze.com 2023-03-30 10:31 出处:网络
i am writing an eclipse plugin that will connect to a server (no database!). for each platform and each release of said server there will be a different jar to use for connecting and a different set o

i am writing an eclipse plugin that will connect to a server (no database!). for each platform and each release of said server there will be a different jar to use for connecting and a different set of .dll/.so files used by said driver jar.

i'd like to create a mechanism like the one for jdbc drivers allowing the user to create a profile for a speci开发者_JAVA技巧fic configuration of platform/release and select an existing profile to create a connection to a specific server.

thus, it is pretty much similar to what most databse plugins do where one can configure different jdbc drivers for different databases and use such a profile to create a databse connection.

maybe i haven't found the right search terms, but so far i failed to get an example how to write this kind of mechanism.

can someone please point me to a working example for eg jdbc?

to summarize: - store location of jar - store location of native shared libraries (dll/so) - when connection export the location of the shared libs (at least in linux i currently need to export LD_LIBRARY_PATH) and use/load the configured jar


I cannot point you to a working example, but I would suggest to define an extension point in your core application. For each configuration create a "driver plug-in" which implements an extension to this extension point. In those driver plug-ins you could bundle the platform specific dlls and so on. Concerning platforms (operating system level) additionally consider to user fragments. For more details on how to implement your own extension point look Eclipse FAQ How do I declare my own extension point?

In the core application you can programatically query all extensions (driver plug-ins) which are available and for example let the user choose which configuration he would like to use via a dropdown box .

0

精彩评论

暂无评论...
验证码 换一张
取 消