Thanks for the suggestion.  I ended up casting like this:

FlowControllerContext_impl fcContext =
(FlowControllerContext_impl)getContext();

This is in my custom flow controller, so getContext() is a superclass
(FlowController_ImplBase) method.

The reason I want to use a session object to store my properties is that
the API says these sessions are per client.  My UIMA app is running in a
JBoss container that is accessed by a web service call.  So multiple
clients could be accessing it simultaneously, each one passing slightly
different parameters.  In the web service method I do this:

        protected AnalysisEngine recognitionAE;
        ...
        
recognitionAE.getUimaContext().getSession().put(STEMMER_KEY_NAME,
stemmerAlgorithmKey);

Then later in my custom flow controller I want to get this property and
use it to control the flow.

I'm not familiar with the external resource support.  Can I do something
similar using that?

Thanks,
Larry

-----Original Message-----
From: Burn Lewis [mailto:burnle...@gmail.com] 
Sent: Friday, January 04, 2013 8:26 PM
To: user@uima.apache.org
Subject: Re: Sessions

With a cast I think you can get the root context and use its session
object.

Session rootSession =
((UimaContextAdmin)aContext).getRootContext().getSession();

Note that the the Javadocs say developers should not use this interface!
It may be preferable to use the external resource support to share a map
amongst annotators.




On Fri, Jan 4, 2013 at 11:22 AM, Eddie Epstein <eaepst...@gmail.com>
wrote:

> I am not 100% sure here, but think that an analytic's UimaContext is 
> fixed after the component has been instantiated. For dynamic control 
> of processing, the flow controller could use something outside of the 
> UIMA framework, or the analytic read a control key put in the CAS 
> itself.
>
> Eddie
>
> On Thu, Jan 3, 2013 at 12:20 PM, Kline, Larry D 
> <larry.kl...@usoncology.com> wrote:
> > I have a remotely deployed uima application (running in jboss and 
> > using a pear file) that has a web service front end.  One of the web

> > service methods sets a value into the uima session.
> >
> >
> >
> > recognitionAE.getUimaContext().getSession().put("g2_stemmer",
> > stemmerAlgorithmKey);
> >
> >
> >
> > Then I would like to get that value in a user defined flow
controller.
> > But in the flow controller I execute this:
> >
> >
> >
> >                                 fcContext = getContext(); // this is

> > a FlowController method
> >
> >                                 String stemmer = 
> > (String)fcContext.getSession().get(STEMMER_KEY_NAME);
> >
> >
> >
> > And I get a different session object.  Is there some way to get the 
> > root session object?
> >
> >
> >
> > Thanks,
> >
> > Larry
> >
> > </pre>The contents of this electronic mail message and any 
> > attachments
> are confidential, possibly privileged and intended for the 
> addressee(s) only.<br>Only the addressee(s) may read, disseminate, 
> retain or otherwise use this message. If received in error, please 
> immediately inform the sender and then delete this message without 
> disclosing its contents to anyone.</pre>
>
</pre>The contents of this electronic mail message and any attachments are 
confidential, possibly privileged and intended for the addressee(s) 
only.<br>Only the addressee(s) may read, disseminate, retain or otherwise use 
this message. If received in error, please immediately inform the sender and 
then delete this message without disclosing its contents to anyone.</pre>

Reply via email to