Author: rec Date: Fri May 10 21:38:12 2013 New Revision: 1481196 URL: http://svn.apache.org/r1481196 Log: [UIMA-2893] Indexes can be automatically detected but this is not done in AnalysisEngineFactory - Fix logic: indexes from annotations cannot be ignored if indexes are explicitly specified when calling createPrimitive
Modified: uima/sandbox/uimafit/trunk/uimafit/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java Modified: uima/sandbox/uimafit/trunk/uimafit/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java?rev=1481196&r1=1481195&r2=1481196&view=diff ============================================================================== --- uima/sandbox/uimafit/trunk/uimafit/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java (original) +++ uima/sandbox/uimafit/trunk/uimafit/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java Fri May 10 21:38:12 2013 @@ -65,6 +65,7 @@ import org.apache.uima.resource.metadata import org.apache.uima.resource.metadata.TypePriorities; import org.apache.uima.resource.metadata.TypeSystemDescription; import org.apache.uima.resource.metadata.impl.Import_impl; +import org.apache.uima.util.CasCreationUtils; import org.apache.uima.util.InvalidXMLException; /** @@ -526,14 +527,16 @@ public final class AnalysisEngineFactory desc.getAnalysisEngineMetaData().setTypePriorities(typePriorities); } - // set indexes from the argument to this call or from the annotation present in the - // component if the argument is null + // set indexes from the argument to this call and from the annotation present in the + // component + List<FsIndexCollection> fsIndexes = new ArrayList<FsIndexCollection>(); if (indexes != null) { - desc.getAnalysisEngineMetaData().setFsIndexCollection(indexes); - } else { - desc.getAnalysisEngineMetaData().setFsIndexCollection( - FsIndexFactory.createFsIndexCollection(componentClass)); - } + fsIndexes.add(indexes); + } + fsIndexes.add(FsIndexFactory.createFsIndexCollection(componentClass)); + FsIndexCollection aggIndexColl = CasCreationUtils.mergeFsIndexes(fsIndexes, + UIMAFramework.newDefaultResourceManager()); + desc.getAnalysisEngineMetaData().setFsIndexCollection(aggIndexColl); // set capabilities from the argument to this call or from the annotation present in the // component if the argument is null