MethodInvocation mi = (MethodInvocation) invocation;
if (invocation.getMetaData(ASYNCH, INVOKE_ASYNCH) != null)
{
//TODO This should maybe go somewhere nicer
InvokerLocator locator = (InvokerLocator) invocation.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR);
if (locator == null)
{
//We are a local invocation. Add security and current transaction info to the invocation
// (for remote invocations this is done by the client side interceptors)
TransactionPropagationContextFactory tpcFactory = TransactionPropagationContextUtil.getTPCFactoryClientSide();
if (tpcFactory != null)
{
Object tpc = tpcFactory.getTransactionPropagationContext();
if (tpc != null)
{
invocation.getMetaData().addMetaData(ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT,
ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT, tpc);
}
}
Principal principal = SecurityAssociation.getPrincipal();
if (principal != null) invocation.getMetaData().addMetaData("security", "principal", principal);
Object credential = SecurityAssociation.getCredential();
if (credential != null) invocation.getMetaData().addMetaData("security", "credential", credential);
}
return super.execute(mi);
}
return mi.invokeNext();