+1 for utility class. +1 for optional dependency. Aliaksandr
On Fri, Apr 13, 2012 at 2:08 PM, [email protected] < [email protected]> wrote: > Do you have any sample code of how to do it? Maybe we could create a > utility class with a method that does as you explained before: try to load > a class using Class.forName and if it fails it tries loading from OSGi. > > > > On Fri, Apr 13, 2012 at 8:33 AM, Jörn Kottmann <[email protected]> wrote: > > > On 04/13/2012 01:19 PM, [email protected] wrote: > > > >> This affects the customization factories. I have never work with OSGi, > so > >> I > >> would follow your instructions. > >> What happens if the class we are trying to load is in another jar? This > >> jar > >> should also export packages? > >> > > > > The one who makes the dependency has to take care for this. > > > > I also didn't work too much with OSGi, the OSGi bundle containing the > class > > needs to register a service the opennlp-tools bundle can consume. > > Not sure if the package must be exported, because there is no need to > > access it in any other way than via the service, even the interface it > > implements > > will be defined in the opennlp-tools bundle. > > > > The customization factories currently directly call Class.forName, > > this we would need to replace with our own custom mechanism as proposed. > > > > Jörn > > >
