* @param aCas - instance of CasData to analyze
* @return instance containing result of the analysis
*/
public CasData process(CasData aCas) throws ResourceProcessException {
if (textAnalysisProxy == null) {
throw new ResourceProcessException(new Exception(Thread.currentThread().getName()
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_no_proxy__WARNING", new Object[] { Thread.currentThread()
.getName() })));
}
CasData casWithAnalysis = null;
ProcessTrace pt = new ProcessTrace_impl();
// Send the content for analysis to the remote service via the proxy
try {
long pStart = System.currentTimeMillis();
casWithAnalysis = textAnalysisProxy.analyze(aCas, pt, name);
long pEnd = System.currentTimeMillis();
totalTime += (pEnd - pStart);
} catch (ServiceException e) {
// check if the proxy is connected to the service
if (textAnalysisProxy.isConnected() == false) {
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_service_down__INFO",
new Object[] { Thread.currentThread().getName(), name });
}
throw new ResourceProcessException(new ServiceConnectionException(Thread.currentThread()
.getName()
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_service_down__WARNING", new Object[] {
Thread.currentThread().getName(), name })));
}
throw new ResourceProcessException(e);
} catch (ServiceConnectionException e) {
throw new ResourceProcessException(e);
} catch (Exception e) {
throw new ResourceProcessException(e);
}
return casWithAnalysis;
}