* @return {@link org.apache.vinci.transport.Transportable} - a VinciFrame containg result of
* performing the service
*/
public Transportable eval(Transportable doc) throws ServiceException {
AFrame frame = (AFrame) doc;
String op = frame.fgetString(Constants.VINCI_COMMAND);
UIMAFramework.getLogger().log(Level.FINEST, "Command::" + op);
if (Constants.GETMETA.equals(op)) {
try {
return this.getMetaData();
} catch (Exception ex) {
throw new ServiceException("getMetaData() threw exception: " + ex);
}
} else if (Constants.PROCESS_CAS.equals(op) || Constants.ANNOTATE.equals(op)) {
return analyze(frame);
} else if (Constants.BATCH_PROCESS_COMPLETE.equals(op)) {
try {
mAE.batchProcessComplete(new ProcessTrace_impl());
return null; // one way call - do NOT return anything, not
// even an empty frame
} catch (IOException e) {
throw new ServiceException("IOException: " + e);
} catch (ResourceProcessException e) {
throw new ServiceException("ResourceProcessException: " + e);
}
} else if (Constants.COLLECTION_PROCESS_COMPLETE.equals(op)) {
try {
mAE.collectionProcessComplete(new ProcessTrace_impl());
return new VinciFrame(); // no return value - return empty
// frame
} catch (IOException e) {
throw new ServiceException("IOException: " + e);
} catch (ResourceProcessException e) {
throw new ServiceException("ResourceProcessException: " + e);
}
} else if (Constants.IS_STATELESS.equals(op)) {
return new AFrame().fadd("Result", mAE.isStateless());
} else if (Constants.IS_READONLY.equals(op)) {
return new AFrame().fadd("Result", mAE.isReadOnly());
} else if (Constants.SHUTDOWN.equals(op)) {
stop();
System.exit(1);
}
return new VinciFrame().fadd("Error", "Invalid Operation:" + op);