Refine search
/** * Create a new RemoteInvocation for the given AOP method invocation. * @param methodInvocation the AOP invocation to convert */ public RemoteInvocation(MethodInvocation methodInvocation) { this.methodName = methodInvocation.getMethod().getName(); this.parameterTypes = methodInvocation.getMethod().getParameterTypes(); this.arguments = methodInvocation.getArguments(); }
private void invokeHandlerMethod(MethodInvocation mi, Throwable ex, Method method) throws Throwable { Object[] handlerArgs; if (method.getParameterCount() == 1) { handlerArgs = new Object[] {ex}; } else { handlerArgs = new Object[] {mi.getMethod(), mi.getArguments(), mi.getThis(), ex}; } try { method.invoke(this.throwsAdvice, handlerArgs); } catch (InvocationTargetException targetEx) { throw targetEx.getTargetException(); } }
@Override public Object invoke(MethodInvocation mi) throws Throwable { this.advice.before(mi.getMethod(), mi.getArguments(), mi.getThis()); return mi.proceed(); }
@Override @Nullable public Object invoke(org.aopalliance.intercept.MethodInvocation inv) throws Throwable { return intercept(inv.getThis(), inv.getMethod(), inv.getArguments(), null); }
@Override public Object invoke(MethodInvocation mi) throws Throwable { Object retVal = mi.proceed(); this.advice.afterReturning(retVal, mi.getMethod(), mi.getArguments(), mi.getThis()); return retVal; }
/** * Create a new RemoteInvocation for the given AOP method invocation. * @param methodInvocation the AOP invocation to convert */ public RemoteInvocation(MethodInvocation methodInvocation) { this.methodName = methodInvocation.getMethod().getName(); this.parameterTypes = methodInvocation.getMethod().getParameterTypes(); this.arguments = methodInvocation.getArguments(); }
/** * Perform a JAX-WS service invocation on the given port stub. * @param invocation the AOP method invocation * @param portStub the RMI port stub to invoke * @return the invocation result, if any * @throws Throwable in case of invocation failure * @see #getPortStub() */ @Nullable protected Object doInvoke(MethodInvocation invocation, @Nullable Object portStub) throws Throwable { Method method = invocation.getMethod(); try { return method.invoke(portStub, invocation.getArguments()); } catch (InvocationTargetException ex) { throw ex.getTargetException(); } catch (Throwable ex) { throw new RemoteProxyFailureException("Invocation of stub method failed: " + method, ex); } }
@Override public Object execute() throws Throwable { logger.debug("Entering API call {}, arguments: {}", invocation.getMethod(), invocation.getArguments()); final Object proceed = invocation.proceed(); logger.debug("Exiting API call {}, returning: {}", invocation.getMethod(), proceed); return proceed; } };
throws InvocationTargetException { Method method = invocation.getMethod(); try { if (method.getDeclaringClass().isInstance(stub)) { return method.invoke(stub, invocation.getArguments()); return stubMethod.invoke(stub, invocation.getArguments());
protected Object getDomainObjectInstance(MethodInvocation invocation) { Object[] args; Class<?>[] params; params = invocation.getMethod().getParameterTypes(); args = invocation.getArguments(); for (int i = 0; i < params.length; i++) { if (processDomainObjectClass.isAssignableFrom(params[i])) { return args[i]; } } throw new AuthorizationServiceException("MethodInvocation: " + invocation + " did not provide any argument of type: " + processDomainObjectClass); }
@Override @Nullable public Object invoke(org.aopalliance.intercept.MethodInvocation inv) throws Throwable { return intercept(inv.getThis(), inv.getMethod(), inv.getArguments(), null); }
@Override @Nullable public Object invoke(final MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); CacheOperationInvoker aopAllianceInvoker = () -> { try { return invocation.proceed(); } catch (Throwable ex) { throw new CacheOperationInvoker.ThrowableWrapper(ex); } }; try { return execute(aopAllianceInvoker, invocation.getThis(), method, invocation.getArguments()); } catch (CacheOperationInvoker.ThrowableWrapper th) { throw th.getOriginal(); } }
@Override @Nullable public Object invoke(final MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); CacheOperationInvoker aopAllianceInvoker = () -> { try { return invocation.proceed(); } catch (Throwable ex) { throw new CacheOperationInvoker.ThrowableWrapper(ex); } }; try { return execute(aopAllianceInvoker, invocation.getThis(), method, invocation.getArguments()); } catch (CacheOperationInvoker.ThrowableWrapper th) { throw th.getOriginal(); } }
public static MethodInterceptorHolder create(MethodInvocation invocation) { String id = DigestUtils.md5DigestAsHex(String.valueOf(invocation.getMethod().hashCode()).getBytes()); String[] argNames = nameDiscoverer.getParameterNames(invocation.getMethod()); Object[] args = invocation.getArguments(); Map<String, Object> argMap = new LinkedHashMap<>(); for (int i = 0, len = args.length; i < len; i++) { argMap.put((argNames == null || argNames[i] == null) ? "arg" + i : argNames[i], args[i]); } return new MethodInterceptorHolder(id, invocation.getMethod(), invocation.getThis(), argMap); }
@Override public Object invoke(org.aopalliance.intercept.MethodInvocation inv) throws Throwable { return intercept(inv.getThis(), inv.getMethod(), inv.getArguments(), null); } }
private DTXInfo get0(MethodInvocation methodInvocation) { String signature = methodInvocation.getMethod().toString(); String unitId = Transactions.unitId(signature); DTXInfo dtxInfo = dtxInfoCache.get(unitId); if (Objects.isNull(dtxInfo)) { dtxInfo = new DTXInfo(methodInvocation.getMethod(), methodInvocation.getArguments(), methodInvocation.getThis().getClass()); dtxInfoCache.put(unitId, dtxInfo); } dtxInfo.reanalyseMethodArgs(methodInvocation.getArguments()); return dtxInfo; }
protected Object getDomainObjectInstance(MethodInvocation invocation) { Object[] args; Class<?>[] params; params = invocation.getMethod().getParameterTypes(); args = invocation.getArguments(); for (int i = 0; i < params.length; i++) { if (processDomainObjectClass.isAssignableFrom(params[i])) { return args[i]; } } throw new AuthorizationServiceException("MethodInvocation: " + invocation + " did not provide any argument of type: " + processDomainObjectClass); }
private Map<String, Object> createArgumentMap(MethodInvocation mi) { Object[] args = mi.getArguments(); Object targetObject = mi.getThis(); Method method = ClassUtils.getMostSpecificMethod(mi.getMethod(), targetObject.getClass()); String[] paramNames = parameterNameDiscoverer.getParameterNames(method); Map<String, Object> argMap = new HashMap<>(); for (int i = 0; i < args.length; i++) { argMap.put(paramNames[i], args[i]); } return argMap; } }
@Override public Object invoke(MethodInvocation invocation) throws Throwable { return intercept(invocation.getThis(), invocation.getMethod(), invocation.getArguments(), null); }
@Override public Object invoke(@Nullable MethodInvocation invocation) throws Throwable { return intercept(invocation.getThis(), invocation.getMethod(), invocation.getArguments(), null); }