当前位置: 首页>>代码示例>>Java>>正文


Java MethodInvocation.proceed方法代码示例

本文整理汇总了Java中org.aopalliance.intercept.MethodInvocation.proceed方法的典型用法代码示例。如果您正苦于以下问题:Java MethodInvocation.proceed方法的具体用法?Java MethodInvocation.proceed怎么用?Java MethodInvocation.proceed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.aopalliance.intercept.MethodInvocation的用法示例。


在下文中一共展示了MethodInvocation.proceed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filterResult

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Object filterResult(MethodInvocation invocation, final SecurityAttribute secAttr) throws Throwable // NOSONAR
{
	Object returnedObject = invocation.proceed();
	if( returnedObject == null )
	{
		return null;
	}

	if( returnedObject instanceof Collection )
	{
		return filterCollection(secAttr, (Collection<Object>) returnedObject);
	}
	else if( returnedObject instanceof Map )
	{
		return filterMap(secAttr, (Map<Object, Object>) returnedObject);
	}
	else
	{
		checkSingleObject(secAttr.getFilterPrivileges(), returnedObject);
		return returnedObject;
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:24,代码来源:MethodSecurityInteceptor.java

示例2: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(MethodInvocation invocation) throws Throwable
{
    ACLEntryVoter voter = new ACLEntryVoter();
    voter.setNamespacePrefixResolver(namespacePrefixResolver);
    voter.setPermissionService(permissionService);
    voter.setNodeService(nodeService);
    voter.setAuthenticationService(authenticationService);
    voter.setAuthorityService(authorityService);
    
    // TODO: add explicit abstain tests (for now, configure dummy "abstainFor" to test deleted nodes - see ALF-898)
    Set<String> abstainFor = new HashSet<String>(1);
    abstainFor.add("{http://www.alfresco.org/model/content/1.0}emailed");
    voter.setAbstainFor(abstainFor);
    voter.afterPropertiesSet();

    if (!(voter.vote(null, invocation, cad) == AccessDecisionVoter.ACCESS_DENIED))
    {
        return invocation.proceed();
    }
    else
    {
        throw new ACLEntryVoterException("Access denied");
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:ACLEntryVoterTest.java

示例3: intercept

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
	MethodInvocation invocation = new CglibMethodInvocation(proxy, this.target, method, args,
			this.targetClass, this.adviceChain, methodProxy);
	// If we get here, we need to create a MethodInvocation.
	Object retVal = invocation.proceed();
	retVal = processReturnType(proxy, this.target, method, retVal);
	return retVal;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:CglibAopProxy.java

示例4: proceed

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
/**
 * Allow the given method invocation to proceed, auditing values before invocation and
 * after returning or throwing.
 * 
 * @param mi                the invocation
 * @return                  Returns the method return (if a value is not thrown)
 * @throws Throwable        rethrows any exception generated by the invocation
 * 
 * @since 3.2
 */
private Object proceed(MethodInvocation mi) throws Throwable
{
    // Are we in a nested audit?
    Boolean wasInAudit = inAudit.get();
    try
    {
        // If we are already in a nested audit call, there is nothing to do
        if (Boolean.TRUE.equals(wasInAudit))
        {
            return mi.proceed();
        }

        Auditable auditableDef = mi.getMethod().getAnnotation(Auditable.class);
        if (auditableDef == null)
        {
            // No annotation, so just continue as normal
            return mi.proceed();
        }
        
        // First get the argument map, if present
        Object[] args = mi.getArguments();
        Map<String, Serializable> namedArguments = getInvocationArguments(auditableDef, args);
        // Get the service name
        String serviceName = beanIdentifier.getBeanName(mi);
        if (serviceName == null)
        {
            // Not a public service
            return mi.proceed();
        }
        String methodName = mi.getMethod().getName();
        
        return proceedWithAudit(mi, auditableDef, serviceName, methodName, namedArguments);
    }
    finally
    {
        inAudit.set(wasInAudit);                       
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:49,代码来源:AuditMethodInterceptor.java

示例5: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke ( MethodInvocation invocation ) throws Throwable {
    final String packageName = invocation.getThis().getClass().getPackage().getName();
    if ( packageName.contains( "user" ) ) {
        setDataSourceKey( invocation.getMethod() , GlobalConstant.USER_DATA_SOURCE_KEY );
    }
    if ( packageName.contains( "order" ) ) {
        setDataSourceKey( invocation.getMethod() , GlobalConstant.ORDER_DATA_SOURCE_KEY );
    }
    return invocation.proceed();
}
 
开发者ID:yujunhao8831,项目名称:spring-boot-mybatisplus-multiple-datasource,代码行数:12,代码来源:DataSourceSwitchMethodInterceptor.java

示例6: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    System.out.println("====[proxy] start: " + new Date());
    Object result = invocation.proceed();
    System.out.println("====[proxy] end: " + new Date());
    return result;
}
 
开发者ID:fangjian0423,项目名称:springboot-analysis,代码行数:8,代码来源:SimpleInstantiationAwareBeanPostProcessor.java

示例7: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    if (invocation.getMethod().getName().equals("getConnection")) {
        if (invocation.getMethod().getParameterCount() == 0) {
            return decoratedDataSource.getConnection();
        }
        else if (invocation.getMethod().getParameterCount() == 2) {
            return decoratedDataSource.getConnection((String) invocation.getArguments()[0], (String) invocation.getArguments()[1]);
        }
    }
    if (invocation.getMethod().getName().equals("toString")) {
        return decoratingChain.stream()
                .map(entry -> entry.getBeanName() + " [" + entry.getDataSource().getClass().getName() + "]")
                .collect(Collectors.joining(" -> ")) + " -> " + beanName + " [" + realDataSource.getClass().getName() + "]";
    }
    if (invocation.getMethod().getDeclaringClass() == DecoratedDataSource.class) {
        if (invocation.getMethod().getName().equals("getRealDataSource")) {
            return realDataSource;
        }
        if (invocation.getMethod().getName().equals("getDecoratedDataSource")) {
            return decoratedDataSource;
        }
        if (invocation.getMethod().getName().equals("getDecoratingChain")) {
            return Collections.unmodifiableList(decoratingChain);
        }
    }
    return invocation.proceed();
}
 
开发者ID:gavlyukovskiy,项目名称:spring-boot-data-source-decorator,代码行数:29,代码来源:DataSourceDecoratorInterceptor.java

示例8: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
  Service service = getService(invocation);

  if (RequestContext.isSet()) {
    return invocation.proceed();
  }

  try (RequestContext ignored = RequestContext.set(service.createRequestContext())) {
    return invocation.proceed();
  }
}
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:13,代码来源:RequestContextAspect.java

示例9: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    String methodName = invocation.getMethod().getName();
    if(exclude.contains(methodName)) {
        return invocation.proceed();
    }
    long start = System.currentTimeMillis();
    Object result = invocation.proceed();
    long end = System.currentTimeMillis();
    logger.info("====method({}), cost({}) ", methodName, (end - start));
    return result;
}
 
开发者ID:fangjian0423,项目名称:springboot-analysis,代码行数:13,代码来源:LogMethodInterceptor.java

示例10: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
	try {
		return mi.proceed();
	}
	finally {
		invokeAdviceMethod(getJoinPointMatch(), null, null);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AspectJAfterAdvice.java

示例11: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(@SuppressWarnings("null") MethodInvocation invocation) throws Throwable {
    INFO.set(invocation);
    try {
        return invocation.proceed();
    } finally {
        INFO.remove();
    }
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:10,代码来源:SnowdropRepositoryProxyPostProcessor.java

示例12: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(final MethodInvocation methodInvocation) throws Throwable
{
    // Just check for any transaction
    if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
    {
        String methodName = methodInvocation.getMethod().getName();
        String className = methodInvocation.getMethod().getDeclaringClass().getName();
        throw new AlfrescoRuntimeException(
                "A transaction has not be started for method '" + methodName + "' on " + className);
    }
    return methodInvocation.proceed();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:CheckTransactionAdvice.java

示例13: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
	if (!(mi instanceof ProxyMethodInvocation)) {
		throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
	}
	ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi;
	pmi.setUserAttribute(BEAN_NAME_ATTRIBUTE, this.beanName);
	return mi.proceed();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ExposeBeanNameAdvisors.java

示例14: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(MethodInvocation mi) throws Throwable 
{
    while (true)
    {
        try
        {
            MethodInvocation clone = ((ReflectiveMethodInvocation)mi).invocableClone();
            return clone.proceed();
        }
        catch (AuthenticationException ae)
        {
            // Sleep for an interval and try again.
            try
            {
                Thread.sleep(fRetryInterval);
            }
            catch (InterruptedException ie)
            {
                // Do nothing.
            }
            try
            {
                // Reauthenticate.
                fAuthService.authenticate(fUser, fPassword.toCharArray());
                String ticket = fAuthService.getCurrentTicket();
                fTicketHolder.setTicket(ticket);
                // Modify the ticket argument.
                mi.getArguments()[0] = ticket;
            }
            catch (Exception e)
            {
                // Do nothing.
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:ReauthenticatingAdvice.java

示例15: invoke

import org.aopalliance.intercept.MethodInvocation; //导入方法依赖的package包/类
public Object invoke(MethodInvocation invocation) throws Throwable {
    return "aop:" + invocation.proceed();
}
 
开发者ID:yunhaibin,项目名称:dubbox-hystrix,代码行数:4,代码来源:DemoInterceptor.java


注:本文中的org.aopalliance.intercept.MethodInvocation.proceed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。