[UIMA-4505] JCasFactory does not use auto-detection for type priorities and indexes
- Fixed for createJCas() and documenting lack of auto-detection for the other signatures.


git-svn-id: https://svn.apache.org/repos/asf/uima/uimafit/branches/2.1.x@1689964 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java b/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java
index 4e45cff..2889885 100644
--- a/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java
+++ b/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java
@@ -20,13 +20,18 @@
 
 import static org.apache.uima.fit.factory.TypeSystemDescriptionFactory.createTypeSystemDescription;
 import static org.apache.uima.fit.factory.TypeSystemDescriptionFactory.createTypeSystemDescriptionFromPath;
+import static org.apache.uima.fit.factory.TypePrioritiesFactory.createTypePriorities;
+import static org.apache.uima.fit.factory.FsIndexFactory.createFsIndexCollection;
 
 import java.io.File;
 import java.io.IOException;
 
 import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.fit.util.CasIOUtil;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.metadata.FsIndexCollection;
+import org.apache.uima.resource.metadata.TypePriorities;
 import org.apache.uima.resource.metadata.TypeSystemDescription;
 import org.apache.uima.util.CasCreationUtils;
 
@@ -39,20 +44,25 @@
   }
 
   /**
-   * Creates a new JCas for the automatically derived type system. See
-   * {@link TypeSystemDescriptionFactory#createTypeSystemDescription()}
+   * Creates a new {@link JCas}. The type system is detected automatically using
+   * {@link TypeSystemDescriptionFactory#createTypeSystemDescription()}. Type priorities are
+   * detected automatically using {@link TypePrioritiesFactory#createTypePriorities()}. Indexes are
+   * detected automatically using {@link FsIndexFactory#createFsIndexCollection()}.
    * 
    * @return a new JCas
    * @throws UIMAException
    *           if the JCas could not be initialized
    */
   public static JCas createJCas() throws UIMAException {
-    return CasCreationUtils.createCas(createTypeSystemDescription(), null, null).getJCas();
-
+    TypeSystemDescription tsd = createTypeSystemDescription();
+    TypePriorities tp = createTypePriorities();
+    FsIndexCollection indexes = createFsIndexCollection();
+    return CasCreationUtils.createCas(tsd, tp, indexes.getFsIndexes()).getJCas();
   }
 
   /**
-   * Creates a new JCas from type system descriptor files found by name
+   * Creates a new JCas from type system descriptor files found by name. No auto-detection for type
+   * priorities, or indexes is performed.
    * 
    * @param typeSystemDescriptorNames
    *          names of the type system descriptors on the classpath used to initialize the JCas (in
@@ -80,7 +90,8 @@
   }
 
   /**
-   * Create a new JCas for the given type system description
+   * Create a new JCas for the given type system description. No auto-detection type priorities, or
+   * indexes is performed.
    * 
    * @param typeSystemDescription
    *          a type system description to initialize the JCas