Community
Participate
Working Groups
When calling remote services it is sometimes desirable to intercept the call before it will be passed to the remote server. This can be used e.g. to implement caching strategies, logging, .. Such "interceptors" should be hooked in transparently without the need to modify existing code.
It is now possible to define call-interceptors via the extension-point "org.eclipse.riena.communication.core.callInterceptors", e.g. <extension point="org.eclipse.riena.communication.core.callInterceptors"> <callInterceptor callInterceptorClass="de.whatever.project.internal.example.client.swt.MonitorReceiverInterceptor3" name="Interceptor-Three" preInterceptors="Interceptor-Two" serviceInterfaceClass="org.eclipse.riena.monitor.common.IReceiver"> </callInterceptor> </extension> For description of the attributes see extension-point description/definition of "callInterceptors" in bundle "org.eclipse.riena.communication.core". The specified call-interceptor has (of course) to implement the interface of the intercepted service and it has to implement a public constructor with a single parameter which has to be of the same type as the intercepted service, e.g. public class MonitorReceiverInterceptor3 implements IReceiver { private final IReceiver delegate; public MonitorReceiverInterceptor3(final IReceiver delegate) { this.delegate = delegate; } public boolean take(final long senderTime, final List<Collectible<?>> collectibles) { System.out.println(getClass().getSimpleName()); System.out.println("SenderTime:" + senderTime); return delegate.take(senderTime, collectibles); } } As you can see the interceptor delegates the call to the provided delegate. If there are multiple interceptors riena.communication will create a chain of interceptors ending with real remote call.
*** Bug 364712 has been marked as a duplicate of this bug. ***