[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] RemoteService + Context

Hi Radostin,

Thanks for the description of your work. 

A couple of comments below.

On 10/28/2010 1:50 AM, Radostin Surilov wrote:
Hi Scott,

Thank you for the comments.

I suppose this approach is quite specific to our use case. The actual aspect is:

import org.eclipse.ecf.provider.remoteservice.generic.RemoteCallImpl;
import org.eclipse.ecf.provider.remoteservice.generic.Request;
import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceRegistrationImpl;

public aspect ECFRequestExtAspect {
   
    private ISecurityToken RemoteCallImpl.mSecurityToken; //serializable parameter to pass (security token in this case)
   
    //advice executed after a new request object has been created
    after(Request request) returning : initialization(Request+.new(..)) && this(request) {
        //put the (local) security context in the RemoteCallImpl instance of the request
        request.getCall().mSecurityToken = SecurityContextHolder.getContext().getToken();
    }
   
    //advice executed before the remote service method invocation
    before(RemoteCallImpl remoteCall) : execution(* RemoteServiceRegistrationImpl.callService(RemoteCallImpl)) && args(remoteCall) {
        //get the security context from the RemoteCallImpl instance and put it in a thread local
        SecurityContextHolder.getContext().setToken(remoteCall.mSecurityToken);       
    }
}

Regards,
Radostin

Interesting.   I take it from your description that you are able to implement this by extending relevant classes and by overriding methods in RegistrySharedObject (in ECF 3.4)...is that correct?

Based upon this use case, do you have any desired API additions/changes...that might accomodate this use case and others more easily/gracefully (e.g. without having to extend classes).

Scott