initialHeapSizeStr = aPerformanceTuningSettings
.getProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE);
}
// create CAS using either aTypeSystem or aTypeSystemDesc
CASMgr casMgr;
if (aTypeSystem != null) {
if (initialHeapSizeStr != null) {
casMgr = CASFactory.createCAS(Integer.parseInt(initialHeapSizeStr), aTypeSystem);
} else {
casMgr = CASFactory.createCAS(aTypeSystem);
}
} else // no TypeSystem to reuse - create a new one
{
if (initialHeapSizeStr != null) {
casMgr = CASFactory.createCAS(Integer.parseInt(initialHeapSizeStr));
} else {
casMgr = CASFactory.createCAS();
}
// install type system
setupTypeSystem(casMgr, aTypeSystemDesc);
// Commit the type system
((CASImpl) casMgr).commitTypeSystem();
}
try {
// install TypePriorities into CAS
setupTypePriorities(casMgr, aTypePriorities);
// install Built-in indexes into CAS
casMgr.initCASIndexes();
} catch (CASException e) {
throw new ResourceInitializationException(e);
}
// install AnalysisEngine's custom indexes into CAS
setupIndexes(casMgr, aFsIndexes);
// Commit the index repository
casMgr.getIndexRepositoryMgr().commit();
// Set JCas ClassLoader
if (aResourceManager.getExtensionClassLoader() != null) {
casMgr.setJCasClassLoader(aResourceManager.getExtensionClassLoader());
}
return casMgr.getCAS().getView(CAS.NAME_DEFAULT_SOFA);
}