Radwen ANIBA | 5 Feb 11:53
Picon

telling the CPM to consider some changes

Hello,

I come back with a problem I have to run a CPM programmatically.

This is what I did :

I am based on the uima default FileSystemCollectionReader descriptor that I
call using

ResourceSpecifier colReaderSpecifier =
UIMAFramework.getXMLParser().parseCollectionReaderDescription(new
XMLInputSource("desc/FileSystemCollectionReader.xml"));
CollectionReader collectionReader =
UIMAFramework.produceCollectionReader(colReaderSpecifier);

Then I developed 4 analysis engines that I call like this

((BaseCPMImpl) mCPM).addCasProcessor(ae1);
((BaseCPMImpl) mCPM).addCasProcessor(ae2);
((BaseCPMImpl) mCPM).addCasProcessor(ae3);
((BaseCPMImpl) mCPM).addCasProcessor(ae4);

the problem is that I want to give the user the option to tell the
collection reader the folder he want to use containing the documents to be
analyzed so i used this method after producing the collection reader

 ConfigurationParameterSettings settings =
collectionReader.getMetaData().getConfigurationParameterSettings();

     org.apache.uima.resource.metadata.NameValuePair[] valuePairs =
settings.getParameterSettings();

     for (org.apache.uima.resource.metadata.NameValuePair nvp : valuePairs)
{

         // TODO: customize settings and save changes back using this crappy
CPE API

if(nvp.getName().matches("InputDirectory"))nvp.setValue("/path/to/test/if/that/work");

     }

And unfortunately the CPM seems to ignore this change and I think I'm
missing something here.

How to tell the CPM that I've changed the collection reader's configuration
paramater settings ?

Thx
Rad

Gmane