|
Re: [CDO] Is it possible to implement ReadAccess and WriteAccess handlers in one class? [message #631231 is a reply to message #631170] |
Wed, 06 October 2010 15:10 |
|
Hi Karel,
We have not thought of this special sceanrio and the handler registration code clearly acts like XOR:
public void addHandler(Handler handler)
{
if (handler instanceof ReadAccessHandler)
{
synchronized (readAccessHandlers)
{
if (!readAccessHandlers.contains(handler))
{
readAccessHandlers.add((ReadAccessHandler)handler);
}
}
}
*else* if (handler instanceof WriteAccessHandler)
{
synchronized (writeAccessHandlers)
{
if (!writeAccessHandlers.contains(handler))
{
writeAccessHandlers.add((WriteAccessHandler)handler);
}
}
}
else
{
throw new IllegalArgumentException("Invalid handler: " + handler); //$NON-NLS-1$
}
}
If you file an enhancement request we can certainly help you ;-)
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 06.10.2010 15:03, schrieb Karel Gardas:
> Hello,
> while experimenting with my experimental CDO server I've found interesting thing. I'm using CDO code provided by Eclipse 3.6 Helios release.
> I'm trying to attempt implementing one access handler class for both read and write access handlers functionality.
> So my access handler class implements both IRepository.WriteAccessHandler, IRepository.ReadAccessHandler interfaces.
> What's strange is that WriteAccess handler methods are not called on my handler, although it's correctly registered and I work with transactions
> on the repository (it's reader functionality is well called). I also see debug output written into log from my debug write access handler which is
> registered before this handler. Even the more funny thing is that once I modify the handler in a way it does not implement IRepository.ReadAccessHandler
> interfaces then suddenly the CDO core upcalls its WriteAccess handler methods well. My guess is that this is an issue somewhere in CDO core,
> but still I'd like to be sure I have not made mistake anywhere nor made a bad assumption that I'm allowed to implement one access handler class
> for both reader and writer access handlers.
> Thanks,
> Karel
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03144 seconds