in src/jni/jni.cpp [479:582]
JNIEXPORT void JNICALL JAVA_PREFIX(typeSystemInitJNI) (JNIEnv* jeEnv,
jobject joJTaf,
jobjectArray typeNames,
jobjectArray featureNames,
jintArray typeInheritance,
jintArray featDecls,
jint topTypeCode,
jintArray featureOffsets,
jintArray typeOrder,
jintArray stringSubTypes,
jobjectArray stringSubTypeValues,
jintArray stringSubTypeValuePos,
jobjectArray indexNames,
jintArray nameToIndexMap,
jintArray indexingStrategy,
jintArray comparatorIndex,
jintArray comparators
) {
try {
UIMA_TPRINT("entering typeSystemInitJNI()");
uima::JNIInstance* pInstance = JNIUtils::getCppInstance(jeEnv, joJTaf);
assert( EXISTS(pInstance) );
assert( typeNames != NULL );
assert( featureNames != NULL );
assert( typeInheritance != NULL );
assert( featDecls != NULL );
assert( typeOrder != NULL );
// assert( featureOffsets != NULL );
assert( indexNames != NULL );
assert( nameToIndexMap != NULL );
assert( indexingStrategy != NULL );
assert( comparatorIndex != NULL );
assert( comparators != NULL);
vector<icu::UnicodeString> vecTypeNames, vecFeatureNames, vecIndexNames, vecSubStringValues;
// prepare deserialization
uima::internal::SerializedCAS rSerCAS;
UIMA_TPRINT("converting type inh vector");
JNIUtils::createIntVector(jeEnv, typeInheritance, rSerCAS.iv_vecTypeInheritanceTable );
UIMA_TPRINT(" converted");
JNIUtils::createIntVector(jeEnv, featDecls, rSerCAS.iv_vecFeatureDefinitionTable );
UIMA_TPRINT("converting type name vector");
JNIUtils::createStringVector(jeEnv, typeNames, rSerCAS.iv_vecTypeSymbolTable, vecTypeNames);
UIMA_TPRINT(" converted");
JNIUtils::createStringVector( jeEnv, featureNames, rSerCAS.iv_vecFeatureSymbolTable, vecFeatureNames );
JNIUtils::createIntVector(jeEnv, typeOrder, rSerCAS.iv_vecTypePriorityTable );
// JNIUtils::createIntVector(jeEnv, featureOffsets, rSerCAS.iv_vecFeatureOffsetTable );
rSerCAS.iv_vecFeatureOffsetTable.clear();
JNIUtils::createIntVector(jeEnv, stringSubTypes, rSerCAS.iv_stringSubTypes);
JNIUtils::createStringVector(jeEnv, stringSubTypeValues, rSerCAS.iv_stringSubTypeValues, vecSubStringValues);
JNIUtils::createIntVector(jeEnv, stringSubTypeValuePos, rSerCAS.iv_stringSubTypeValuePos);
JNIUtils::createStringVector(jeEnv, indexNames, rSerCAS.iv_vecIndexIDTable, vecIndexNames );
JNIUtils::createIntVector(jeEnv,comparators, rSerCAS.iv_vecComparatorDefinitionTable);
JNIUtils::createIntVector(jeEnv,comparatorIndex, rSerCAS.iv_vecComparatorStartTable);
JNIUtils::createIntVector(jeEnv, indexingStrategy, rSerCAS.iv_vecIndexKindTable );
uima::AnalysisEngine * pEngine = pInstance->getEngine();
uima::internal::EngineBase & engineBase = uima::internal::EngineBase::promoteEngine(*pEngine);
uima::internal::CASDefinition & casDef = engineBase.getCASDefinition();
UIMA_TPRINT("deserializng definitions");
// deserialize CAS definitions (type system and index info)
uima::internal::CASDeserializer deSerializer;
deSerializer.deserializeDefinitions( rSerCAS, casDef );
UIMA_TPRINT(" done deserializing definitions");
engineBase.reinitTypeSystem();
uima::CAS * pCAS = pInstance->getCAS();
if (pCAS != NULL) {
delete pCAS;
pInstance->setCAS(NULL);
}
UIMA_TPRINT("recreate CAS");
pCAS = pEngine->newCAS();
assert( EXISTS(pCAS) );
pInstance->setCAS(pCAS);
UIMA_TPRINT("typeSystemInitJNI() finished");
} catch (uima::Exception & rException) {
UIMA_TPRINT("Exception: " << rException.asString() );
JNIUtils::throwNewInternalException(jeEnv, rException);
return;
}
#ifdef NDEBUG
catch (...) {
//cout << "typeSystemInitJNI: Unknown Exception " << endl;
UIMA_TPRINT("Unknown Exception" );
CHECK_FOR_JNI_EXCEPTION(jeEnv);
uima::ErrorInfo errInfo(UIMA_MSG_ID_EXC_UNEXPECTED_ERROR, UIMA_ERR_ENGINE_UNEXPECTED_EXCEPTION, uima::ErrorInfo::unrecoverable);
JNIUtils::throwNewInternalException(jeEnv, errInfo);
return;
}
#endif
}