Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dirigible » Integration of 3d party libraries(Possible options and use cases)
Integration of 3d party libraries [message #1717098] Wed, 09 December 2015 21:55 Go to next message
Georgi Pavlov is currently offline Georgi PavlovFriend
Messages: 39
Registered: October 2014
I was exploring the opportunities to integrate a 3d party library in dirigible. It seems that there is no single answer to that depending on what is your motivation and what you try to achieve.

For now I can figure out the following:

Case 1: I'd like to develop Dirigible component that depends on a library.
If I need to introduce a library in dirigible code base, then OSGi is my friend. I need to to somehow have it OSGi-ed and do some things to make it available. What should i do more precisely?

Case 2: I'd like to develop an application with Dirigible that depends on a library
i think this topic is a bit more vague. I guess it depends on the application type how to provision a library dependency. For example require function in Javascript (but where my scripts should physically reside then) or Java class loading (and again where do i put my scripts an what is the loading process in general) for Java. Some details and discussion on options here would be most welcome.
I was thinking whether I should put in this category also the JDBC drivers because they fit in the goal of this case. On the other hand, I can use JNDI and the Dirigible mechanism for provisioning of DataSources to make them available to my applications and unfortunately, that is suitable only for Data Sources and cannot be reused outside this domain.

Re: Integration of 3d party libraries [message #1717373 is a reply to message #1717098] Sat, 12 December 2015 11:12 Go to previous message
Nedelcho Delchev is currently offline Nedelcho DelchevFriend
Messages: 55
Registered: May 2013
Hey Georgi,

You brought up very interesting topic!
Indeed there are several use cases in Dirigible context to bring your own 3-thd party library and expose it to application developer afterwards. Following your definition:

Case 1: [Component] First you have to decide whether this feature should go to the standard core Dirigible product or will be custom built product for your own usage. Hence,
Case 1.1: [Standard feature] You have to follow the Eclipse IP process i.e. to create a CQ in the IPZilla . The easiest way is to find your library in the Orbit repository (current version used in Dirigible is here) and to go thru Piggyback shortcut.
Case 1.2: [Custom Built] You need to find OSGi bundle of your library or to make such by your own using standard Eclipse capabilities for Plugin Developers. You can find a tutorial about this as usual at Vogella site.

Once you are ready with your OSGi-fied library you can add it to the target descriptor, then to the p2.external feature and to the corresponding config.ini files. More or less this are the steps you have to follow.

Case 2: [Application dependency] Here again there are different cases:
Case 2.1: [Java Standard Classes] This is the case with the Datasource and the whole JDBC APIs. These classes are loaded once in the context of the App Server and then can be used thru all the layers Servlets, OSGi, Rhino, hence you can use them in the source code of your Dirigible's project. So, once they are injected in the JNDI or in the Session via the injectors of the DirigibleBridge you can use them without any issue.
Case 2.2: [Java Optional Classes] Ugly situation - for example javax.mail. On one side this library can be provided by the App Server (the usual case), but unfortunately it is not available for the OSGi (or at least I didn't manage to make it working). If you put this library in the OSGi environment, once you try to use it you will get ClassCastException, because the Class Loaders are different. In this case as of now, I just push down the implementation of the service (the one that uses this library) to p2.library and make another wrapper in the OSGi, side which just make calls via reflection. It is quite nasty, but still the only way I manage to see working.
Case 2.3: [In App Library] This is the case when you need to put a jar file in your Dirigible's project (within the ScriptingServices folder) and to use it afterwards from your Java Services. There is already and issue in Bugzilla for that. Technically, it should not be big deal to be implemented as far as for the Java services we use in-memory compilation and dynamic loading of dependencies anyway, but one have to explore a bit more this topic for the other non-functional aspects e.g. security, lifecycle management, "for-production" deployment options, etc.

Previous Topic:NoSQL support with TinkerPop
Next Topic:Supportability: Remote debugging dirigible code
Goto Forum:

Current Time: Sun Sep 24 17:48:05 GMT 2017

Powered by FUDForum. Page generated in 0.02834 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software