Re: Dependency injection support in UIMA

2012-11-22 Thread Spico Florin
Hello! I really appreciate your support Richard. I'll go for this implementation. I hope that someone from UIMA AS will get into this topic and validate the solution. Regards, Florin On Thu, Nov 22, 2012 at 3:11 PM, Richard Eckart de Castilho < eck...@ukp.informatik.tu-darmstadt.de> wrote:

Re: Dependency injection support in UIMA

2012-11-22 Thread Richard Eckart de Castilho
Hi, I'm afraid I'm not very familiar with UIMA AS. The context resource and consumer look reasonable to me. -- Richard Am 22.11.2012 um 14:06 schrieb Spico Florin : > Hello! >I'm deploying my Consumer in AS environment. My consumer is a remote > component with scaleout factor of 3. The c

Re: Dependency injection support in UIMA

2012-11-22 Thread Spico Florin
Hello! I'm deploying my Consumer in AS environment. My consumer is a remote component with scaleout factor of 3. The consumer tries to get an instance to a triplestore template that has reference to a triplestore pooled connection. After profiling the deployed consumer with the given set up, I

Re: Dependency injection support in UIMA

2012-11-21 Thread Richard Eckart de Castilho
Hi, > Thank you for your anwers. Regarding the SharedResourceObject approach > in the JavaDoc I didn't find any reference about how many instances will be > created when you have many Annotators using the same resource. I would say > that that will be one SharedResouce per instance Annotator. Th

Re: Dependency injection support in UIMA

2012-11-21 Thread Spico Florin
Hello! Thank you for your anwers. Regarding the SharedResourceObject approach in the JavaDoc I didn't find any reference about how many instances will be created when you have many Annotators using the same resource. I would say that that will be one SharedResouce per instance Annotator. 1.So

Re: Dependency injection support in UIMA

2012-11-20 Thread Richard Eckart de Castilho
Hello Florin, this is not an issue with Spring but with the injection pre-existing instances in general. With "pre-existing" I mean instances that are not managed by the UIMA framework. If you deploy a UIMA component somewhere, the UIMA framework usually knows how to create all involved instanc

Re: Dependency injection support in UIMA

2012-11-20 Thread Spico Florin
Hello! Thank you for your response Richard. As far as I know (please correct me if I'm wrong) the scale out is referring to create many instances of the same analyzing engine that will process CASes. The Analyzing engine should be also remote AE. Can you please provide more details why adding h

Re: Dependency injection support in UIMA

2012-11-20 Thread Marshall Schor
Hi, The next release of UIMA will have a facility that augments the existing methods of setting parameters with an additional one based on (a slight extension of) Java properties files. It's purpose is to collect into one spot all the parameter settings needed for a complex set of annotators. Th

Re: Dependency injection support in UIMA

2012-11-20 Thread Richard Eckart de Castilho
Hello Florin, first of all, UIMA does not support injections of pre-existing instances. You are not supposed to access any object instances that are not created within the context of UIMA. If you can live with the consequences of doing this (i.e. no UIMA supported scale-out), you can have a loo

Dependency injection support in UIMA

2012-11-20 Thread Spico Florin
Hello! I have a connection to data source (triplestore) that is used by multiple annotators. With the current implementation of UIMA I have to provide this connection in for all these annotators descriptors, making the deployment very tedious when switching from one environment to another (for e

Re: Dependency Injection support?

2011-04-12 Thread Richard Eckart de Castilho
Am 12.04.2011 um 16:53 schrieb Alex: > I was having similar trouble sharing resources (mainly caches) among UIMA > annotators using Spring injection several months ago. The simplest solution I > came up with was to create my own UimaContext object that also holds a Spring > ApplicationContext an

Re: Dependency Injection support?

2011-04-12 Thread Alex
Marshall Schor writes: > On 3/18/2011 4:09 PM, Alex Chaphiv wrote: > > Hi, > > > > I have several annotators that require objects that are rather complex > > to build. > > I've been able to get around this using by using ExternalResources > > with custom api interfaces, but it requires a lot of

Re: Dependency Injection support?

2011-04-02 Thread Richard Eckart de Castilho
Hello everybody, thinking more about a UIMA/Spring (or potentially any other popular DI framework) integration, I came up with several scenarios: 1) a UIMA component should access objects from an external context as external resources, e.g. a Spring application context 2) a UIMA component shoul

Re: Dependency Injection support?

2011-03-30 Thread Richard Eckart de Castilho
Hello Roberto, > I did it. I've my version of analysisEngine: that's an interesting approach, although its addresses only half of what I had in mind when I stated that components should be POJOs. The other half would be that the UIMA framework itself configures a component not via the initializ

Re: Dependency Injection support?

2011-03-30 Thread Roberto Franchini
On Tue, Mar 22, 2011 at 4:35 PM, Richard Matthias Eckart de Castilho wrote: > > Hi, > > in my opinion, the best would be if UIMA components were just Java > beans/POJOs. > Hi, I did it. I've my version of analysisEngine: public class IocPrimitiveAnalysisEngine extends AnalysisEngineImplBase imp

Re: Approach to dependency injection in a non-distributed scenario (was: Dependency Injection support?)

2011-03-30 Thread Richard Eckart de Castilho
> My current annotators have > @ExternalResource(api=ExternalResourceLocator.class). Your example does not work due to the following issues: - if you do did not already do so, you must use uimaFIT trunk (1.1.0 will not work) - you must not specify the api parameter otherwise UIMA will barf bec

Re: Approach to dependency injection in a non-distributed scenario (was: Dependency Injection support?)

2011-03-30 Thread Alex Chaphiv
Richard Eckart de Castilho writes: > > > > I've been playing with your example, and it seems to break my existing code > > Could you explain how it broke your code? I was thinking of an approach similar to yours first, > but when I looked into the UIMA sources, I figured that an extra External

Re: Approach to dependency injection in a non-distributed scenario (was: Dependency Injection support?)

2011-03-30 Thread Richard Eckart de Castilho
> I've been playing with your example, and it seems to break my existing code Could you explain how it broke your code? I was thinking of an approach similar to yours first, but when I looked into the UIMA sources, I figured that an extra ExternalResourceLocator would not be necessary and then

Re: Approach to dependency injection in a non-distributed scenario (was: Dependency Injection support?)

2011-03-29 Thread Alex Chaphiv
Hi, I've been playing with your example, and it seems to break my existing code, so I came up with this solution that uses ExternalResourceDescriptions and avoids reflection: -- start code -- public static void main(String[] args) throws Exception { AnotherResourceManager arm = new AnotherRe

Approach to dependency injection in a non-distributed scenario (was: Dependency Injection support?)

2011-03-25 Thread Richard Eckart de Castilho
Hi, I have thought a bit of how dependency injection in a non-distributed scenario could possibly be improved without introducing a global context. I'd be curious about any feedback. The solution is based on uimaFIT annotations and employs a custom ResourceManager. It could be used without uima

Re: Dependency Injection support?

2011-03-22 Thread Richard Matthias Eckart de Castilho
Hi, in my opinion, the best would be if UIMA components were just Java beans/POJOs. UIMA comes compete with a framework for constructing workflows from XML descriptors. This is helpful in a scale-out scenario where UIMA needs to know all about how to instantiate all involved objects. UIMA pro

Re: Dependency Injection support?

2011-03-21 Thread Alex Chaphiv
Hey, Ideally I wanted to be able to construct a workflow without having to deal with external resources, and pass everything I need into the constructor. I.E. public class SomeAnnotator extends JCasAnnotator_ImplBase { private Type someType; private Foo foo;

Re: Dependency Injection support?

2011-03-21 Thread James Carman
Yes, I know. If you want to figure out how dependency injection should look/work, why not go with the "standard"? You can use the full-blown CDI crap or just do the javax.inject stuff by itself. On Mon, Mar 21, 2011 at 9:51 AM, Marshall Schor wrote: > CDI = Context and Dependency Injection, a n

Re: Dependency Injection support?

2011-03-21 Thread Marshall Schor
CDI = Context and Dependency Injection, a new J2EE 6 feature. -Marshall On 3/21/2011 9:12 AM, James Carman wrote: > How about just use the new CDI stuff? That's what it should look like. > > On Mon, Mar 21, 2011 at 8:19 AM, Marshall Schor wrote: >> >> On 3/18/2011 4:09 PM, Alex Chaphiv wrote: >

Re: Dependency Injection support?

2011-03-21 Thread James Carman
How about just use the new CDI stuff? That's what it should look like. On Mon, Mar 21, 2011 at 8:19 AM, Marshall Schor wrote: > > > On 3/18/2011 4:09 PM, Alex Chaphiv wrote: >> Hi, >> >> I have several annotators that require objects that are rather complex to >> build. >>  I've been able to ge

Re: Dependency Injection support?

2011-03-21 Thread Marshall Schor
On 3/18/2011 4:09 PM, Alex Chaphiv wrote: > Hi, > > I have several annotators that require objects that are rather complex to > build. > I've been able to get around this using by using ExternalResources with > custom > api interfaces, but it requires a lot of boilerplate and doesn't allow for

Re: Dependency Injection support?

2011-03-20 Thread Richard Matthias Eckart de Castilho
Hi Alex, please feel free to provide us with a feature request for uimaFIT in which you detail how you would imagine the dependency injection to work. I have written the external resource code but so far use it only in very few scenarios. I am happy for comments. -- Richard Am 20.03.2011 um 1

Re: Dependency Injection support?

2011-03-20 Thread Richard Matthias Eckart de Castilho
Hi, uimaFIT uses Spring only to scan the classpath for descriptors when the automatic type detection is used. The dependency injection part is not using Spring. We could probably implement our component initialization code using utility code from Spring though. Afaik UIMA-AS is Spring-based. -

Re: Dependency Injection support?

2011-03-19 Thread Alex Chaphiv
Hey, Thanks for the response. I actually have been using uimaFIT. And while it provides a lot of convenience, it only uses spring as detailed here: http://code.google.com/p/uimafit/issues/detail?id=40 The library allows you to use @ExternalResource annotations to have dependencies "injected", b

Re: Dependency Injection support?

2011-03-19 Thread Tommaso Teofili
Hi Alex, I think you could take inspiration from the (Spring based) DI support in uimaFIT [1], even if, personally, I'd recommend the use of Guice instead of Spring. My 2 cents, Tommaso [1] : http://code.google.com/p/uimafit/ 2011/3/18 Alex Chaphiv > Hi, > > I have several annotators that requi

Dependency Injection support?

2011-03-18 Thread Alex Chaphiv
Hi, I have several annotators that require objects that are rather complex to build. I've been able to get around this using by using ExternalResources with custom api interfaces, but it requires a lot of boilerplate and doesn't allow for sharing of dependencies between ExternalResources. So wha