| Summary: | Need the possibility to intercept remote service calls | ||
|---|---|---|---|
| Product: | [RT] Riena | Reporter: | Stefan Liebig <Stefan.Liebig> |
| Component: | communication | Assignee: | Stefan Liebig <Stefan.Liebig> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.0.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Stefan Liebig
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. *** |