public Object run(OperationContext ctx, OperationChain chain) throws OperationException, InvalidChainException, Exception { try { Object input = ctx.getInput(); Class<?> inputType = input == null ? Void.TYPE : input.getClass(); Object ret = compileChain(inputType, chain).invoke(ctx); if (ctx.getCoreSession() != null && ctx.isCommit()) { // auto save session if any ctx.getCoreSession().save(); } return ret; } finally { ctx.dispose(); } }
public Object invoke(OperationContext ctx, Map<String, Object> args) throws OperationException { try { return doInvoke(ctx, args, ctx.getInput()); } catch (OperationException e) { throw e; } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof OperationException) { throw (OperationException) t; } else { throw new OperationException("Failed to invoke operation " + op.getId(), t); } } catch (Throwable t) { throw new OperationException("Failed to invoke operation " + op.getId(), t); } }