You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Karl Øie <ka...@gan.no> on 2005/01/19 15:39:00 UTC
ContentInterceptor.preRemove with missing NodeRevisionDescriptors
A question about the ContentInterceptor.
Upon preRemove() and postRemove() only a NULL is passed as
NodeRevisionDescriptors for the resource to be removed. But from
NodeRevisionDescriptor and SlideToken i can't find any way to obtain
the uri of the resource in question. I have searched mailinglist and
documentation and have found no way of obtaining the full path to the
resource from within the class implementing ContentInterceptor.
The NodeRevisionDescriptor has the resource name, but no information
about the uri the of the resource. So i looked at
org.apache.slide.content.ContentImpl and found that the pre/post events
for remove doesn't retrieve the NodeRevisionDescriptors and only passes
NULL even if such a NodeRevisionDescriptors might exists.
So i added to ContentImpl.java line 1138 :
NodeRevisionDescriptors nrds =
objectUri.getStore().retrieveRevisionDescriptors(objectUri);
and modified ContentImpl.java line 1144 to :
invokeInterceptors(token, nrds, revisionDescriptor, null,
PRE_REMOVE);
rebuilt and tested, and it seems to work as expected, upon preRemove()
i get passed the NodeRevisionDescriptors and i can now lookup the uri
for the resource.
My question is if this will break or contradict some logic inside slide
that prevents this hack to work? If line 1138 doesn´t find any
NodeRevisionDescriptors it will be NULL anyway right?
And if this is a bad way of doing it, wouldn't it be logical to pass
the full uri of the resource to be removed onto the interceptor?
Without the uri there is no way of knowing exactly what resource to act
upon... And of course, if there is a way to obtain the uri from
preRemove() without this hack, i would be most happy to know about it!
In advance thanks.
Any feedback is appreciated.
Mvh Karl Øie
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
Re: ContentInterceptor.preRemove with missing NodeRevisionDescriptors
Posted by "Honoré David N." <dh...@oma.be>.
same sort of thing with post retrieve ...
when you try to retrieve NodeRevisionDescriptor, interceptor is called with
NodeRevisionContent == null (normal)
but
when you try to retrieve NodeRevisionContent, interceptor get a
NodeRevisionDescriptor and a NodeRevisionContent but NodeRevisionDescriptors
=> no uri
-----------------------------------------------------------------------------
There is a patch (not fully tested, but must work) for HEAD. it juste inverse
call of the two following functions and do a retrieve(SlideToken, uri) to get
the NodeRevisionDescriptors when uri if provided.
retrieve(SlideToken, NodeRevisionDescriptors, NodeRevisionDescriptor)
and
retrieve(SlideToken, String, NodeRevisionDescriptor)
--
Honoré David
----------------------------
"Although the Perl Slogan is There's More Than One Way to Do It, I hesitate to
make 10 ways to do something. :-)" -- Larry Wall