當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。