Not sure about this; the main documentation, in the section 1.5.1 in
tutorials / user guides on the "contract" says
reconfigure
This method is never called by the framework, unless
an application calls it on the Engine object – in which
case it the framework propagates it to all
annotators contained in the Engine.
Its purpose is to signal that the configuration
parameters have changed. A default implementation
of this calls destroy, followed by initialize. This
is the only case where initialize would be called
more than once. Users should implement whatever
logic is needed to return the annotator to an initialized
state, including re-reading the configuration parameter
data.
So this change sounds like a change in the contract for reconfigure?
-Marshall
[EMAIL PROTECTED] wrote:
Author: alally
Date: Tue May 1 06:56:40 2007
New Revision: 534093
URL: http://svn.apache.org/viewvc?view=rev&rev=534093
Log:
In CollectionReaderAdapter, subsequent calls to process() after the first one will
now call reconfigure().
UIMA-388: https://issues.apache.org/jira/browse/UIMA-388
Modified:
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/compatibility/CollectionReaderAdapter.java
Modified:
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/compatibility/CollectionReaderAdapter.java
URL:
http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/compatibility/CollectionReaderAdapter.java?view=diff&rev=534093&r1=534092&r2=534093
==============================================================================
---
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/compatibility/CollectionReaderAdapter.java
(original)
+++
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/compatibility/CollectionReaderAdapter.java
Tue May 1 06:56:40 2007
@@ -51,6 +51,8 @@
private UimaContext mUimaContext;
private boolean mSofaAware;
+
+ private boolean mProcessCalled;
/**
* Create a new annotator adapter.
@@ -64,6 +66,7 @@
AnalysisEngineMetaData aMetaData) {
mCollectionReader = aCollectionReader;
mSofaAware = aMetaData.isSofaAware();
+ mProcessCalled = false;
}
/*
@@ -114,7 +117,21 @@
* @see
org.apache.uima.annotator.Annotator#process(org.apache.uima.core.AbstractCas)
*/
public void process(AbstractCas aCAS) throws AnalysisEngineProcessException {
- // does nothing - CollectionReaders ignore their input CAS
+ // Does nothing on the first call to process - CollectionReaders ignore
their input CAS.
+ // On a subsequent call to process, we want to reset the CollectionReader,
which we
+ // try to do by calling its reconfigure method.
+ if (mProcessCalled) {
+ try {
+ reconfigure();
+ } catch (ResourceInitializationException e) {
+ throw new AnalysisEngineProcessException(e);
+ } catch (ResourceConfigurationException e) {
+ throw new AnalysisEngineProcessException(e);
+ }
+ }
+ else {
+ mProcessCalled = true;
+ }
}
/*