casImpl.reset();
// 1. deserialize CAS
CASSerializer serializer = new CASSerializer();
// set serialization data
serializer.heapArray = heapArray;
serializer.fsIndex = fsIndex;
serializer.stringTable = stringTable;
serializer.byteHeapArray = aByteHeapArray;
serializer.shortHeapArray = aShortHeapArray;
serializer.longHeapArray = aLongHeapArray;
casImpl.reinit(serializer);
// 2. create result spec
if (ae != null) {
ResultSpecification rs = ae.createResultSpecification(casImpl.getTypeSystem());
for (int i = 0; i < resultSpecTypes.length; ++i) {
// allAnnotatorFeatures is not considere here! (TODO)
rs
.addResultType(casImpl.getTypeSystemImpl().ll_getTypeForCode(resultSpecTypes[i]).getName(),
false);
}
for (int i = 0; i < resultSpecFeatures.length; ++i) {
rs.addResultFeature(casImpl.getTypeSystemImpl().ll_getFeatureForCode(resultSpecFeatures[i])
.getName());
}
// 3. call process with cas
ae.process(casImpl, rs);
} else if (cc != null) {
// 3. call process with tcas or cas
if (requiresTCas && sofaNum == 0) {
result = 1;
exceptionString = "This CasConsumer expects a View, but the Sofa from which to construct one is not specified.";
} else if (sofaNum > 0) {
CAS view = casImpl.getView(sofaNum);
cc.processCas(view);
} else {
cc.processCas(casImpl);
}
}
// 4. deserialize CAS again
CASSerializer deSerializer = Serialization.serializeCAS(casImpl);
saveSerializedCAS(deSerializer);
} catch (Exception exc) {
result = 1;