Hi, I think it is better now, but I am not happy with the fact that we have two constructors in each tool factory. I will think how to get rid of the constructors that takes the same arguments of the method init. I would appreciate if you have an opinion about it.
The issue i see is that without the second constructor users would have to call the default constructor and the init method. It is something easy to forget. An option is to create a factory method, but it is not clear to me how to do it in an elegant way because we should keep the the default constructor and the init method because of the reflection. Thanks, William On Fri, Jul 13, 2012 at 10:24 AM, Jörn Kottmann <[email protected]> wrote: > Nice, thats the OSGi issue: > https://issues.apache.org/**jira/browse/OPENNLP-500<https://issues.apache.org/jira/browse/OPENNLP-500> > > Jörn > > > On 07/13/2012 03:13 PM, William Colen wrote: > >> Yes, thanks. I will do it. >> >> On Fri, Jul 13, 2012 at 10:08 AM, Jörn Kottmann <[email protected]> >> wrote: >> >> Hello, >>> >>> yes that would work. Why don't we define the init method on the >>> BaseToolFactory, >>> then it could be called via theFactory.init? >>> >>> Jörn >>> >>> >>> On 07/13/2012 03:04 PM, William Colen wrote: >>> >>> Jörn, >>>> >>>> Would it work? >>>> >>>> public static BaseToolFactory create(String subclassName, >>>> ArtifactProvider artifactProvider) throws >>>> InvalidFormatException { >>>> >>>> // load the ToolFactory using the default constructor >>>> BaseToolFactory theFactory = ExtensionLoader.**** >>>> instantiateExtension( >>>> >>>> BaseToolFactory.class, subclassName); >>>> if (theFactory != null) { >>>> try { >>>> // call the init method that takes a ArtifactProvider argument >>>> Method init = theFactory.getClass().**** >>>> getDeclaredMethod("init", >>>> >>>> ArtifactProvider.class); >>>> init.invoke(theFactory, artifactProvider); >>>> } catch >>>> ..... >>>> } >>>> } >>>> return theFactory; >>>> } >>>> >>>> On Fri, Jul 13, 2012 at 9:01 AM, Jörn Kottmann <[email protected]> >>>> wrote: >>>> >>>> On 07/13/2012 01:47 PM, William Colen wrote: >>>> >>>>> I've been postponing working on the OSGi support for the >>>>> >>>>>> BaseToolFactory, >>>>>> I >>>>>> am sorry. >>>>>> I managed to have some free time this week, so I can do it right now >>>>>> if >>>>>> you >>>>>> didn't start it already. >>>>>> >>>>>> Also, before releasing 1.5.3, I would like to have the factory >>>>>> mechanism >>>>>> available in the Chunker. I will do it latter today. >>>>>> >>>>>> Well, no hurry, I just had a look at the open issues for 1.5.3 and >>>>>> >>>>> stumbled >>>>> over the OSGi support one. >>>>> >>>>> I did it for the name finder, and wanted to hear opinions about my >>>>> proposed changed for the tool factory loading. >>>>> >>>>> Jörn >>>>> >>>>> >>>>> >>>>> >>> > >
