Girish,
It occurs to me that you might benefit from the factory methods provided
by UUTUC. The code you were trying to use below is useful when you need
to change configuration parameters between subsequent calls to the same
analysis engine. However, if your real goal is to simply dynamically
change the AnalysisEngineDescription before creating an AnalysisEngine
out of it, then that is exactly the sort of thing UUTUC factory methods
are good for. There are a number of factory methods, but you could
accomplish what you need with something like:
AnalysisEngineFactory.createAnalysisEngine("the.name.of.your.descriptor","ChunkCreaterClass",
"Something")
Philip
Chavan, Girish wrote:
Hi All,
I am still stuck here. My backup option is to alter the descriptor xml before
building an analysis engine with it, but it is kinda hacky, so was hoping for a
cleaner solution. Can any of the developers chime in?
Thanks,
_______________
Girish Chavan, MSIS
Department of Biomedical Informatics (DBMI)
University of Pittsburgh
-----Original Message-----
From: Chavan, Girish [mailto:[email protected]]
Sent: Friday, July 24, 2009 11:01 AM
To: [email protected]
Subject: Problem reconfiguring after setting a config parameter value
Hi All,
I am using the following code to set the value for the 'ChunkCreaterClass'
parameter. I had to add line (2) because without it I was getting a
UIMA_IllegalStateException due to the session being null. I am not quite sure
if that is the way you set a new session. In any case I stopped getting that
error. But now I get a nullpointerexception error ( trace shown below the code).
I had a breakpoint set in the ConfigurationManagerImplBase.validateConfigurationParameterSettings
method to see what was happening. It entered the method multiple times to validate each AEs params.
The first set of calls was triggered after line (1). And it went through smoothly. The next set
was triggered after line (4) which threw an exception immediately for the "/" context.
Within the implementation of the validateConfigurationParameterSettings method. I see that
ConfigurationParameterDeclarations comes up null for the "/" context.
Not quite sure what I am doing wrong. Any ideas??
CODE:
(1)AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
(2)ae.getUimaContextAdmin().setSession(new Session_impl());
(3)ae.setConfigParameterValue("ChunkCreaterClass", "Something");
(4)ae.reconfigure();
Exception:
java.lang.NullPointerException
at
org.apache.uima.resource.impl.ConfigurationManagerImplBase.validateConfigurationParameterSettings(ConfigurationManagerImplBase.java:488)
at
org.apache.uima.resource.impl.ConfigurationManagerImplBase.reconfigure(ConfigurationManagerImplBase.java:235)
at
org.apache.uima.resource.ConfigurableResource_ImplBase.reconfigure(ConfigurableResource_ImplBase.java:70)
Thanks.
_______________
Girish Chavan, MSIS
Department of Biomedical Informatics (DBMI)
University of Pittsburgh
UPMC Cancer Pavilion, 302D
5150 Centre Avenue
Pittsburgh, PA 15232
Office: 412-623-4084
Email: [email protected]
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.27/2258 - Release Date: 07/24/09 05:58:00