if (isReply || "xmi".equalsIgnoreCase(aSerializerKey)) {
CacheEntry cacheEntry = getAnalysisEngineController().getInProcessCache()
.getCacheEntryForCAS(aCasReferenceId);
XmiSerializationSharedData serSharedData;
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(), "serializeCAS",
JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_serialize_cas__FINE",
new Object[] { aCasReferenceId });
}
if (isReply) {
serSharedData = cacheEntry.getDeserSharedData();
if (cacheEntry.acceptsDeltaCas()
&& (cacheEntry.getMarker() != null && cacheEntry.getMarker().isValid())) {
serializedCas = uimaSerializer.serializeCasToXmi(aCAS, serSharedData, cacheEntry
.getMarker());
cacheEntry.setSentDeltaCas(true);
} else {
serializedCas = uimaSerializer.serializeCasToXmi(aCAS, serSharedData);
cacheEntry.setSentDeltaCas(false);
}
// if market is invalid, create a fresh marker.
if (cacheEntry.getMarker() != null && !cacheEntry.getMarker().isValid()) {
cacheEntry.setMarker(aCAS.createMarker());
}
} else {
serSharedData = cacheEntry.getDeserSharedData();
if (serSharedData == null) {
serSharedData = new XmiSerializationSharedData();
cacheEntry.setXmiSerializationData(serSharedData);
}
serializedCas = uimaSerializer.serializeCasToXmi(aCAS, serSharedData);
int maxOutgoingXmiId = serSharedData.getMaxXmiId();
// Save High Water Mark in case a merge is needed
getAnalysisEngineController().getInProcessCache().getCacheEntryForCAS(aCasReferenceId)
.setHighWaterMark(maxOutgoingXmiId);
}