Anton87 / uimafit

Automatically exported from code.google.com/p/uimafit
0 stars 0 forks source link

Initialize component from map or resource specifier #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Richard:
Currently InitializeUtil.initialize() requires an UimaContext, but it only
uses the method 
getConfigParameterValue(). I would like to use InitializeUtil also in
contexts were the parameters are 
not stored in an UimaContext, e.g. when initializing an external resource
created using a 
CustomResourceSpecifier. Here the parameters are available in a Parameter
array. Currently I 
synthesize an UimaContext from these parameters, but since
InitializeUtil.initialize() only required 
the functionality provided by a simple Map<String, Object> containing the
parameters, I think it 
would be nice pass such an object to initialize().

@Philip: this is btw. why I copied the parameters from the UimaContext to a
Map before passing it 
into my configure() method back in the rejected
ConfigurationParameterConfigurator.

Philip:
I think it makes sense to expose/create a new method that allows you to
initialize an
external resource as you described.  I am not familiar with the use case
you cited. 
The reason the initialize method takes a UimaContext should be obvious as
it makes
for a very simple call in the first line of an e.g. analysis engine's
initialize
method.  So, I would hate for that method signature to go away.  So, I
would say feel
free to add a method to Initializeutil that takes a the map you want.  That
method
can either synthesize a UimaContext to pass on to an existing method.  Or
you could
modify the the method that takes a UimaContext and have it create the
object map. 
Does that sound reasonable?

Richard:
I'd opt for the second approach. The code that synthesizes the UimaContext
is rather ugly.

Steve:
This sounds fine to me too. We definitely shouldn't lose the API taking a
UimaContext
though - I expect there are other things that we could be using from the
UimaContext
that we aren't yet.

Original issue reported on code.google.com by pvogren@gmail.com on 1 May 2010 at 2:59

GoogleCodeExporter commented 8 years ago
This is in particular useful for initializing external resources.

Original comment by richard.eckart on 16 Mar 2011 at 7:51

GoogleCodeExporter commented 8 years ago
Added new initialize() methods for configuring a component from a resource 
specifier or a plain map.
Added Resource_ImplBase which as a base-class for self-initializing external 
resources.
Modified test case to use uimaFIT Resource_ImplBase.

Original comment by richard.eckart on 16 Mar 2011 at 7:53

GoogleCodeExporter commented 8 years ago
This sounds pretty good.  I think Chris might be interested to see this.

I am, however, struggling to wrap my head around this because it's been a while 
since we filed this.  Not to give you are hard time - but I wish there was a 
test or an example.

Original comment by phi...@ogren.info on 17 Mar 2011 at 2:40

GoogleCodeExporter commented 8 years ago
There is. Look at ExternalResourceFactoryTest. If you cannot find in there what 
you are looking for, please tell me.

Original comment by richard.eckart on 17 Mar 2011 at 5:02

GoogleCodeExporter commented 8 years ago

Original comment by richard.eckart on 7 Apr 2011 at 12:12