/** * Static method for creating a delegation service proxy for * provided service that is not offered by the component itself. */ public static IInternalService createDelegationProvidedServiceProxy(IInternalAccess ia, IComponentAdapter adapter, IServiceIdentifier sid, RequiredServiceInfo info, RequiredServiceBinding binding, ClassLoader classloader, boolean realtime) { BasicServiceInvocationHandler handler = new BasicServiceInvocationHandler(ia, sid, adapter.getLogger(), realtime, ia.getComponentDescription().getCause(), false); handler.addFirstServiceInterceptor(new MethodInvocationInterceptor()); handler.addFirstServiceInterceptor(new DelegationInterceptor(ia, info, binding, null, sid, realtime)); handler.addFirstServiceInterceptor(new DecouplingReturnInterceptor(/*ea, null,*/)); // return (IInternalService)Proxy.newProxyInstance(ea.getModel().getClassLoader(), new Class[]{IInternalService.class, sid.getServiceType()}, handler); return (IInternalService)Proxy.newProxyInstance(classloader, new Class[]{IInternalService.class, info.getType().getType(classloader)}, handler); //sid.getServiceType() }
/** * Static method for creating a delegation service proxy for * provided service that is not offered by the component itself. */ public static IInternalService createDelegationProvidedServiceProxy(IInternalAccess ia, IServiceIdentifier sid, RequiredServiceInfo info, RequiredServiceBinding binding, ClassLoader classloader, boolean realtime) { BasicServiceInvocationHandler handler = new BasicServiceInvocationHandler(ia, sid, ia.getLogger(), realtime, ia.getComponentDescription().getCause(), false); handler.addFirstServiceInterceptor(new MethodInvocationInterceptor()); handler.addFirstServiceInterceptor(new DelegationInterceptor(ia, info, binding, null, sid, realtime)); handler.addFirstServiceInterceptor(new DecouplingReturnInterceptor(/*ea, null,*/)); // return (IInternalService)Proxy.newProxyInstance(ea.getModel().getClassLoader(), new Class[]{IInternalService.class, sid.getServiceType()}, handler); return (IInternalService)Proxy.newProxyInstance(classloader, new Class[]{IInternalService.class, info.getType().getType(classloader, ia.getModel().getAllImports())}, handler); //sid.getServiceType() }