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 Thomas Bellembois <th...@univ-rennes1.fr> on 2005/03/18 17:58:12 UTC

Quota development.

Hello,

I have started to develop quota using Listener and Events (following 
your advice - thank you again), and I would like to be sure that I am on 
the good way.
I have built a new class that extends the ContentListener class.
I can get parameters of the current request (content length...) and 
access resources metadata (quota-available-bytes quota-used-bytes).
I override all of the methods of the ContentListener class, except the 
"retrieve" method (it does not seem to be necessary - not yet).

According to the draft, every resource on the server should contain 
quota properties.
So, when an event is caught by my Listener, for example in the create 
method :
1. getting the content lenght of the resource to be created
2. getting the quota properties (quota-available-bytes quota-used-bytes) 
of the parent node (ie. directory where the resource will be stored)
      > if no quota properties are found, quota are supposed to be 
unlimited (?)
3. if (request_contentLength + quota-used-bytes > quota-available-bytes) 
throw new VetoException(...quota exceeded...)
4. else updating quota-available-bytes properties (quota-available-bytes 
= quota-available-bytes + request-contentLength) up to the root node
#Note : it does not seem to be very suitable do to that here, because 
the current action (create) is not performed yet - How can we do better ?

For the store method, apparently called only when the resource already 
exists, the calculation at the point 3 is a bit different

I wanted to use the WebDavListener interface but I could not find any 
way to retrieve request parameters and it looked easier to use a 
ContentListener (and event).

So can I follow this idea ?

Thank you very much.

Thomas (still a beginner Slide-based product developer but still 
motivated ! ;-) )

-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
I have re-installed Slide and it is working now. :-)
I have probably make a mistake the first time.
Thank you.

Thomas

Stefan Lützkendorf wrote:

> Do you have enabled both DetailedWebdavEvent and WebdavEvent in your 
> Domain.xml.
>
> <event classname="org.apache.slide.webdav.event.WebdavEvent" 
> enable="true" />
> <event classname="org.apache.slide.webdav.event.DetailedWebdavEvent" 
> enable="true" />
>
> I have written a test listener, that logs all events, and now I get
> all the events.
>
> Stefan
>
> public class LoggingWebdavListener extends WebdavAdapter {
>
>     public void acl(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void bind(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void checkin(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void checkout(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void copy(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void copyAfterCopy(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void copyAfterDelete(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void copyBeforeCopy(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void copyBeforeDelete(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void delete(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void deleteAfterDelete(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void deleteBeforeDelete(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void get(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void label(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void lock(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void mkcol(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void mkcolAfter(WebdavEvent event) throws VetoException {
>         System.out.println(event + " mkcolAfter");
>     }
>     public void mkworkspace(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void move(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void moveAfterCopy(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void moveAfterDelete(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void moveBeforeCopy(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void moveBeforeDelete(DetailedWebdavEvent event) throws 
> VetoException {
>         System.out.println(event);
>     }
>     public void options(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void poll(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void propFind(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void propPatch(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void put(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void putAfter(WebdavEvent event) throws VetoException {
>         System.out.println(event + "putAfter");
>     }
>     public void rebind(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void report(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void search(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void subscribe(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void unbind(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void uncheckout(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void unlock(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void unsubscribe(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void update(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void versionControl(WebdavEvent event) throws VetoException {
>         System.out.println(event);
>     }
>     public void versionControlAfter(DetailedWebdavEvent event)
>             throws VetoException {
>         System.out.println(event);
>     }
>     public void versionControlBefore(DetailedWebdavEvent event)
>             throws VetoException {
>         System.out.println(event);
>     }
> }
>
>
>
> Thomas Bellembois wrote:
>
>> No problem and thank you.
>> But it does not seem to work yet.
>> Apparently those events are never thrown.
>> Thomas
>>
>> Stefan Lützkendorf wrote:
>>
>>> Sorry,
>>> I missed a required change in WebdavEvent. Now commited.
>>>
>>> Stefan
>>>
>>> Thomas Bellembois wrote:
>>>
>>>> I can't catch the two new events (putAfter and mkcolAfter) (the 
>>>> other methods are caught).
>>>> I have checkout and installed the entire project.
>>>> Have you modified the Slide core so that those events are thrown 
>>>> after put/mkcol methods ?
>>>> Or is there something special to do in my configuration ?
>>>> Thank you.
>>>>
>>>> Thomas
>>>>
>>>> Thomas Bellembois wrote:
>>>>
>>>>> Thank you very much.
>>>>> Thomas
>>>>>
>>>>> Stefan Lützkendorf wrote:
>>>>>
>>>>>> Ok, I added the stuff at the WebdavListener interface and checked 
>>>>>> it in.
>>>>>>
>>>>>>
>>>>>> Thomas Bellembois wrote:
>>>>>>
>>>>>>> And why not mkcolBefore and putBefore too...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> put() and mkcol() stands for putBefore() and mkcolBefore(). They 
>>>>>> always exist
>>>>>> so I can't rename them.
>>>>>>
>>>>>> Cheers, Stefan
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Stefan Lützkendorf <lu...@apache.org>.
Do you have enabled both DetailedWebdavEvent and WebdavEvent in your Domain.xml.

<event classname="org.apache.slide.webdav.event.WebdavEvent" enable="true" />
<event classname="org.apache.slide.webdav.event.DetailedWebdavEvent" enable="true" />

I have written a test listener, that logs all events, and now I get
all the events.

Stefan

public class LoggingWebdavListener extends WebdavAdapter {

     public void acl(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void bind(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void checkin(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void checkout(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void copy(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void copyAfterCopy(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void copyAfterDelete(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void copyBeforeCopy(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void copyBeforeDelete(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void delete(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void deleteAfterDelete(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void deleteBeforeDelete(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void get(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void label(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void lock(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void mkcol(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void mkcolAfter(WebdavEvent event) throws VetoException {
         System.out.println(event + " mkcolAfter");
     }
     public void mkworkspace(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void move(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void moveAfterCopy(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void moveAfterDelete(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void moveBeforeCopy(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void moveBeforeDelete(DetailedWebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void options(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void poll(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void propFind(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void propPatch(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void put(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void putAfter(WebdavEvent event) throws VetoException {
         System.out.println(event + "putAfter");
     }
     public void rebind(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void report(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void search(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void subscribe(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void unbind(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void uncheckout(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void unlock(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void unsubscribe(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void update(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void versionControl(WebdavEvent event) throws VetoException {
         System.out.println(event);
     }
     public void versionControlAfter(DetailedWebdavEvent event)
             throws VetoException {
         System.out.println(event);
     }
     public void versionControlBefore(DetailedWebdavEvent event)
             throws VetoException {
         System.out.println(event);
     }
}



Thomas Bellembois wrote:

> No problem and thank you.
> But it does not seem to work yet.
> Apparently those events are never thrown.
> Thomas
> 
> Stefan Lützkendorf wrote:
> 
>> Sorry,
>> I missed a required change in WebdavEvent. Now commited.
>>
>> Stefan
>>
>> Thomas Bellembois wrote:
>>
>>> I can't catch the two new events (putAfter and mkcolAfter) (the other 
>>> methods are caught).
>>> I have checkout and installed the entire project.
>>> Have you modified the Slide core so that those events are thrown 
>>> after put/mkcol methods ?
>>> Or is there something special to do in my configuration ?
>>> Thank you.
>>>
>>> Thomas
>>>
>>> Thomas Bellembois wrote:
>>>
>>>> Thank you very much.
>>>> Thomas
>>>>
>>>> Stefan Lützkendorf wrote:
>>>>
>>>>> Ok, I added the stuff at the WebdavListener interface and checked 
>>>>> it in.
>>>>>
>>>>>
>>>>> Thomas Bellembois wrote:
>>>>>
>>>>>> And why not mkcolBefore and putBefore too...
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> put() and mkcol() stands for putBefore() and mkcolBefore(). They 
>>>>> always exist
>>>>> so I can't rename them.
>>>>>
>>>>> Cheers, Stefan
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
> 
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
No problem and thank you.
But it does not seem to work yet.
Apparently those events are never thrown.
Thomas

Stefan Lützkendorf wrote:

> Sorry,
> I missed a required change in WebdavEvent. Now commited.
>
> Stefan
>
> Thomas Bellembois wrote:
>
>> I can't catch the two new events (putAfter and mkcolAfter) (the other 
>> methods are caught).
>> I have checkout and installed the entire project.
>> Have you modified the Slide core so that those events are thrown 
>> after put/mkcol methods ?
>> Or is there something special to do in my configuration ?
>> Thank you.
>>
>> Thomas
>>
>> Thomas Bellembois wrote:
>>
>>> Thank you very much.
>>> Thomas
>>>
>>> Stefan Lützkendorf wrote:
>>>
>>>> Ok, I added the stuff at the WebdavListener interface and checked 
>>>> it in.
>>>>
>>>>
>>>> Thomas Bellembois wrote:
>>>>
>>>>> And why not mkcolBefore and putBefore too...
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> put() and mkcol() stands for putBefore() and mkcolBefore(). They 
>>>> always exist
>>>> so I can't rename them.
>>>>
>>>> Cheers, Stefan
>>>>
>>>>
>>>
>>>
>>
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Stefan Lützkendorf <lu...@apache.org>.
Sorry,
I missed a required change in WebdavEvent. Now commited.

Stefan

Thomas Bellembois wrote:

> I can't catch the two new events (putAfter and mkcolAfter) (the other 
> methods are caught).
> I have checkout and installed the entire project.
> Have you modified the Slide core so that those events are thrown after 
> put/mkcol methods ?
> Or is there something special to do in my configuration ?
> Thank you.
> 
> Thomas
> 
> Thomas Bellembois wrote:
> 
>> Thank you very much.
>> Thomas
>>
>> Stefan Lützkendorf wrote:
>>
>>> Ok, I added the stuff at the WebdavListener interface and checked it in.
>>>
>>>
>>> Thomas Bellembois wrote:
>>>
>>>> And why not mkcolBefore and putBefore too...
>>>
>>>
>>>
>>>
>>> put() and mkcol() stands for putBefore() and mkcolBefore(). They 
>>> always exist
>>> so I can't rename them.
>>>
>>> Cheers, Stefan
>>>
>>>
>>
>>
> 
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
I can't catch the two new events (putAfter and mkcolAfter) (the other 
methods are caught).
I have checkout and installed the entire project.
Have you modified the Slide core so that those events are thrown after 
put/mkcol methods ?
Or is there something special to do in my configuration ?
Thank you.

Thomas

Thomas Bellembois wrote:

> Thank you very much.
> Thomas
>
> Stefan Lützkendorf wrote:
>
>> Ok, I added the stuff at the WebdavListener interface and checked it in.
>>
>>
>> Thomas Bellembois wrote:
>>
>>> And why not mkcolBefore and putBefore too...
>>
>>
>>
>> put() and mkcol() stands for putBefore() and mkcolBefore(). They 
>> always exist
>> so I can't rename them.
>>
>> Cheers, Stefan
>>
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
Thank you very much.
Thomas

Stefan Lützkendorf wrote:

> Ok, I added the stuff at the WebdavListener interface and checked it in.
>
>
> Thomas Bellembois wrote:
>
>> And why not mkcolBefore and putBefore too...
>
>
> put() and mkcol() stands for putBefore() and mkcolBefore(). They 
> always exist
> so I can't rename them.
>
> Cheers, Stefan
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Stefan Lützkendorf <lu...@apache.org>.
Ok, I added the stuff at the WebdavListener interface and checked it in.


Thomas Bellembois wrote:

> And why not mkcolBefore and putBefore too...

put() and mkcol() stands for putBefore() and mkcolBefore(). They always exist
so I can't rename them.

Cheers, Stefan


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
And why not mkcolBefore and putBefore too...

Thomas

Thomas Bellembois wrote:

> What we can do :
>
> I continue to develop my quota updating metadata in the put method, 
> and when the new event is available I will modify my code.
> What do you think about that ?
> When do you think this new feature could be available ?
> Thanks.
>
> Thomas
>
>
> Stefan Lützkendorf wrote:
>
>> I see, you are right.
>>
>> Maybe we should introduce some new events like mkcolAfter and 
>> putAfter that
>> not to hard and will be usefull for others too.
>>
>> Stefan
>>
>> Thomas Bellembois wrote:
>>
>>> Hello Stefan,
>>>
>>> I thought about this solution but the problem is that methods of the 
>>> WebdavListener class are called before the job is performed, aren't 
>>> they ?
>>> We are not sure that the request will be successfull ?
>>> If we are, it is nice :-)
>>> Thank you for your help.
>>>
>>> Thomas
>>>
>>>
>>> Stefan Lützkendorf wrote:
>>>
>>>> For this you can use WebdavListener-Events. WebdavAdapter 
>>>> implements both
>>>> interfaces WebdavListener and DetailedWebdavListener. If your 
>>>> listener is
>>>> deriveed from WebdavAdapter you can sould get calls to 
>>>> put(WebdavEvent) and
>>>> mkcol(WebdavEvent event) methods.
>>>>
>>>> Stefan
>>>>
>>>> Thomas Bellembois wrote:
>>>>
>>>>> Another basic question :
>>>>> None of the methods of the DetailedWebdavListener class are called 
>>>>> for a put or a mkcol method (I tried uploading a file and creating 
>>>>> a directory with a Web folder).
>>>>> So for these actions how can I update metadata when the job is 
>>>>> performed ?
>>>>> Thomas
>>>>>
>>>>> Thomas Bellembois wrote:
>>>>>
>>>>>> Hello Stefan,
>>>>>>
>>>>>> Yes, it helps me very much ! Thank you !
>>>>>> I have now the information I needed.
>>>>>> I remember that you told me about this DetailedWebdavEvent, but I 
>>>>>> was a bit lost... But now it is ok. :-)
>>>>>> Thank you.
>>>>>>
>>>>>> Thomas.
>>>>>>
>>>>>>
>>>>>> Stefan Lützkendorf wrote:
>>>>>>
>>>>>>> Hello Thomas, sounds well
>>>>>>>
>>>>>>> but maybe you want to try the recently invented 
>>>>>>> DetailedWebdavEvent.
>>>>>>> It provides some "*After" events, that are issued after the 
>>>>>>> object creation.
>>>>>>> The event source of WebdavEvent's and DetailedWebdavEvent's are 
>>>>>>> always the
>>>>>>> method classes from org.apache.slide.webdav.method. These 
>>>>>>> provide access to
>>>>>>> the helper classes and to the request and response infos.
>>>>>>> (this is similar to the WebdavListener, but that issues an event 
>>>>>>> only once per method)
>>>>>>>
>>>>>>> You can use this like the following sample:
>>>>>>>
>>>>>>> public void copyAfterCopy(DetailedWebdavEvent event) throws 
>>>>>>> VetoException {
>>>>>>>
>>>>>>>      AbstractWebdavMethod method = 
>>>>>>> (AbstractWebdavMethod)event.getSource();
>>>>>>>
>>>>>>>      Content content = method.getContent();
>>>>>>>
>>>>>>>      NodeRevisionDescriptors nrds = content.retrieve(
>>>>>>>                     method.getSlideToken(), 
>>>>>>> method.getRequestUri());
>>>>>>>      NodeRevisionDescriptor nrd = content.retrieve(
>>>>>>>                     method.getSlideToken(), nrds);
>>>>>>>
>>>>>>>      ndr.setProperty(...);
>>>>>>>
>>>>>>>      content.store(method.getSlideToken(), 
>>>>>>> method.getRequestUri(), nrd, null);
>>>>>>> }
>>>>>>>
>>>>>>> If you are updateing properties at other nodes you may get 
>>>>>>> problems with the permissions,
>>>>>>> may be you want to update quota properties at nodes where the 
>>>>>>> current user does not
>>>>>>> have read or write permissions. You can work around this using a 
>>>>>>> Wrapper that disables
>>>>>>> security checking:
>>>>>>>
>>>>>>> SlideToken systemToken = new 
>>>>>>> SlideTokenWrapper(method.getSlideToken());
>>>>>>> systemToken.setForceSecurity(false);
>>>>>>> systemToken.setForceLock(false);
>>>>>>>
>>>>>>> I think we have to complete the getErrorCode method at 
>>>>>>> WebdavUtils to make
>>>>>>> VetoExceptions into more detailed WebDAV error codes.
>>>>>>>
>>>>>>> I hope this helps. Keep you motivation.
>>>>>>>
>>>>>>> Cheers Stefan
>>>>>>>
>>>>>>>
>>>>>>> Thomas Bellembois wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I have started to develop quota using Listener and Events 
>>>>>>>> (following your advice - thank you again), and I would like to 
>>>>>>>> be sure that I am on the good way.
>>>>>>>> I have built a new class that extends the ContentListener class.
>>>>>>>> I can get parameters of the current request (content length...) 
>>>>>>>> and access resources metadata (quota-available-bytes 
>>>>>>>> quota-used-bytes).
>>>>>>>> I override all of the methods of the ContentListener class, 
>>>>>>>> except the "retrieve" method (it does not seem to be necessary 
>>>>>>>> - not yet).
>>>>>>>>
>>>>>>>> According to the draft, every resource on the server should 
>>>>>>>> contain quota properties.
>>>>>>>> So, when an event is caught by my Listener, for example in the 
>>>>>>>> create method :
>>>>>>>> 1. getting the content lenght of the resource to be created
>>>>>>>> 2. getting the quota properties (quota-available-bytes 
>>>>>>>> quota-used-bytes) of the parent node (ie. directory where the 
>>>>>>>> resource will be stored)
>>>>>>>>      > if no quota properties are found, quota are supposed to 
>>>>>>>> be unlimited (?)
>>>>>>>> 3. if (request_contentLength + quota-used-bytes > 
>>>>>>>> quota-available-bytes) throw new VetoException(...quota 
>>>>>>>> exceeded...)
>>>>>>>> 4. else updating quota-available-bytes properties 
>>>>>>>> (quota-available-bytes = quota-available-bytes + 
>>>>>>>> request-contentLength) up to the root node
>>>>>>>> #Note : it does not seem to be very suitable do to that here, 
>>>>>>>> because the current action (create) is not performed yet - How 
>>>>>>>> can we do better ?
>>>>>>>>
>>>>>>>> For the store method, apparently called only when the resource 
>>>>>>>> already exists, the calculation at the point 3 is a bit different
>>>>>>>>
>>>>>>>> I wanted to use the WebDavListener interface but I could not 
>>>>>>>> find any way to retrieve request parameters and it looked 
>>>>>>>> easier to use a ContentListener (and event).
>>>>>>>>
>>>>>>>> So can I follow this idea ?
>>>>>>>>
>>>>>>>> Thank you very much.
>>>>>>>>
>>>>>>>> Thomas (still a beginner Slide-based product developer but 
>>>>>>>> still motivated ! ;-) )
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
What we can do :

I continue to develop my quota updating metadata in the put method, and 
when the new event is available I will modify my code.
What do you think about that ?
When do you think this new feature could be available ?
Thanks.

Thomas


Stefan Lützkendorf wrote:

> I see, you are right.
>
> Maybe we should introduce some new events like mkcolAfter and putAfter 
> that
> not to hard and will be usefull for others too.
>
> Stefan
>
> Thomas Bellembois wrote:
>
>> Hello Stefan,
>>
>> I thought about this solution but the problem is that methods of the 
>> WebdavListener class are called before the job is performed, aren't 
>> they ?
>> We are not sure that the request will be successfull ?
>> If we are, it is nice :-)
>> Thank you for your help.
>>
>> Thomas
>>
>>
>> Stefan Lützkendorf wrote:
>>
>>> For this you can use WebdavListener-Events. WebdavAdapter implements 
>>> both
>>> interfaces WebdavListener and DetailedWebdavListener. If your 
>>> listener is
>>> deriveed from WebdavAdapter you can sould get calls to 
>>> put(WebdavEvent) and
>>> mkcol(WebdavEvent event) methods.
>>>
>>> Stefan
>>>
>>> Thomas Bellembois wrote:
>>>
>>>> Another basic question :
>>>> None of the methods of the DetailedWebdavListener class are called 
>>>> for a put or a mkcol method (I tried uploading a file and creating 
>>>> a directory with a Web folder).
>>>> So for these actions how can I update metadata when the job is 
>>>> performed ?
>>>> Thomas
>>>>
>>>> Thomas Bellembois wrote:
>>>>
>>>>> Hello Stefan,
>>>>>
>>>>> Yes, it helps me very much ! Thank you !
>>>>> I have now the information I needed.
>>>>> I remember that you told me about this DetailedWebdavEvent, but I 
>>>>> was a bit lost... But now it is ok. :-)
>>>>> Thank you.
>>>>>
>>>>> Thomas.
>>>>>
>>>>>
>>>>> Stefan Lützkendorf wrote:
>>>>>
>>>>>> Hello Thomas, sounds well
>>>>>>
>>>>>> but maybe you want to try the recently invented DetailedWebdavEvent.
>>>>>> It provides some "*After" events, that are issued after the 
>>>>>> object creation.
>>>>>> The event source of WebdavEvent's and DetailedWebdavEvent's are 
>>>>>> always the
>>>>>> method classes from org.apache.slide.webdav.method. These provide 
>>>>>> access to
>>>>>> the helper classes and to the request and response infos.
>>>>>> (this is similar to the WebdavListener, but that issues an event 
>>>>>> only once per method)
>>>>>>
>>>>>> You can use this like the following sample:
>>>>>>
>>>>>> public void copyAfterCopy(DetailedWebdavEvent event) throws 
>>>>>> VetoException {
>>>>>>
>>>>>>      AbstractWebdavMethod method = 
>>>>>> (AbstractWebdavMethod)event.getSource();
>>>>>>
>>>>>>      Content content = method.getContent();
>>>>>>
>>>>>>      NodeRevisionDescriptors nrds = content.retrieve(
>>>>>>                     method.getSlideToken(), method.getRequestUri());
>>>>>>      NodeRevisionDescriptor nrd = content.retrieve(
>>>>>>                     method.getSlideToken(), nrds);
>>>>>>
>>>>>>      ndr.setProperty(...);
>>>>>>
>>>>>>      content.store(method.getSlideToken(), 
>>>>>> method.getRequestUri(), nrd, null);
>>>>>> }
>>>>>>
>>>>>> If you are updateing properties at other nodes you may get 
>>>>>> problems with the permissions,
>>>>>> may be you want to update quota properties at nodes where the 
>>>>>> current user does not
>>>>>> have read or write permissions. You can work around this using a 
>>>>>> Wrapper that disables
>>>>>> security checking:
>>>>>>
>>>>>> SlideToken systemToken = new 
>>>>>> SlideTokenWrapper(method.getSlideToken());
>>>>>> systemToken.setForceSecurity(false);
>>>>>> systemToken.setForceLock(false);
>>>>>>
>>>>>> I think we have to complete the getErrorCode method at 
>>>>>> WebdavUtils to make
>>>>>> VetoExceptions into more detailed WebDAV error codes.
>>>>>>
>>>>>> I hope this helps. Keep you motivation.
>>>>>>
>>>>>> Cheers Stefan
>>>>>>
>>>>>>
>>>>>> Thomas Bellembois wrote:
>>>>>>
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I have started to develop quota using Listener and Events 
>>>>>>> (following your advice - thank you again), and I would like to 
>>>>>>> be sure that I am on the good way.
>>>>>>> I have built a new class that extends the ContentListener class.
>>>>>>> I can get parameters of the current request (content length...) 
>>>>>>> and access resources metadata (quota-available-bytes 
>>>>>>> quota-used-bytes).
>>>>>>> I override all of the methods of the ContentListener class, 
>>>>>>> except the "retrieve" method (it does not seem to be necessary - 
>>>>>>> not yet).
>>>>>>>
>>>>>>> According to the draft, every resource on the server should 
>>>>>>> contain quota properties.
>>>>>>> So, when an event is caught by my Listener, for example in the 
>>>>>>> create method :
>>>>>>> 1. getting the content lenght of the resource to be created
>>>>>>> 2. getting the quota properties (quota-available-bytes 
>>>>>>> quota-used-bytes) of the parent node (ie. directory where the 
>>>>>>> resource will be stored)
>>>>>>>      > if no quota properties are found, quota are supposed to 
>>>>>>> be unlimited (?)
>>>>>>> 3. if (request_contentLength + quota-used-bytes > 
>>>>>>> quota-available-bytes) throw new VetoException(...quota 
>>>>>>> exceeded...)
>>>>>>> 4. else updating quota-available-bytes properties 
>>>>>>> (quota-available-bytes = quota-available-bytes + 
>>>>>>> request-contentLength) up to the root node
>>>>>>> #Note : it does not seem to be very suitable do to that here, 
>>>>>>> because the current action (create) is not performed yet - How 
>>>>>>> can we do better ?
>>>>>>>
>>>>>>> For the store method, apparently called only when the resource 
>>>>>>> already exists, the calculation at the point 3 is a bit different
>>>>>>>
>>>>>>> I wanted to use the WebDavListener interface but I could not 
>>>>>>> find any way to retrieve request parameters and it looked easier 
>>>>>>> to use a ContentListener (and event).
>>>>>>>
>>>>>>> So can I follow this idea ?
>>>>>>>
>>>>>>> Thank you very much.
>>>>>>>
>>>>>>> Thomas (still a beginner Slide-based product developer but still 
>>>>>>> motivated ! ;-) )
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Webdav client, Httpclient 2, and Httpclient 3

Posted by Jie Ren <ji...@ics.uci.edu>.
It seems there is a problem with the depth support when using Webdav client
with Commons httpclient 3 rc1. 

At first, I was writing some code to forward a request received in a proxy
filter: 

method.setURI(new URI(request.getRequestURI(), true));
method = new PropFindMethod();            
// copy header
Enumeration		headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements()) {
	String		headerName = (String)headerNames.nextElement();
	Enumeration	headers = request.getHeaders(headerName);
	while(headers.hasMoreElements()) {
		String	headerValue = (String)headers.nextElement();
		method.addRequestHeader(headerName, headerValue);
	}
}
// handle depth
if (method instanceof DepthSupport) {
	try {
		if (request.getIntHeader("Depth") != -1)
	
((DepthSupport)method).setDepth(request.getIntHeader("Depth"));
	}
	catch (NumberFormatException nfe) {
	}
}

Not sure whether copying headers would be enough to set the depth header,
but it seems the inquiry of DepthSupport and the setDepth function is
necessary to set the depth field properly.

A possibly related issue arises when executing the commnandline WebDAV
client against the 2.2pre Slide (built from CVS HEAD, running on Jetty
5.1.2) using the httpclient 3 jar, instead of the httpclient.jar coming from
CVS HEAD (which looks like 2.0 final (2.0.2 is also working)). Turning on
debug of the command line client, it seems the request goes to the server
with headers like "depth: 0; content-length: 123; depth: 0". The server
complains no content body against this PROPFIND request. 

Not sure where the real problem is or whether this would qualify as a "bug",
but just let who may be in charge know.

Regards,
Jie Ren


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Stefan Lützkendorf <lu...@apache.org>.
I see, you are right.

Maybe we should introduce some new events like mkcolAfter and putAfter that
not to hard and will be usefull for others too.

Stefan

Thomas Bellembois wrote:
> Hello Stefan,
> 
> I thought about this solution but the problem is that methods of the 
> WebdavListener class are called before the job is performed, aren't they ?
> We are not sure that the request will be successfull ?
> If we are, it is nice :-)
> Thank you for your help.
> 
> Thomas
> 
> 
> Stefan Lützkendorf wrote:
> 
>> For this you can use WebdavListener-Events. WebdavAdapter implements both
>> interfaces WebdavListener and DetailedWebdavListener. If your listener is
>> deriveed from WebdavAdapter you can sould get calls to 
>> put(WebdavEvent) and
>> mkcol(WebdavEvent event) methods.
>>
>> Stefan
>>
>> Thomas Bellembois wrote:
>>
>>> Another basic question :
>>> None of the methods of the DetailedWebdavListener class are called 
>>> for a put or a mkcol method (I tried uploading a file and creating a 
>>> directory with a Web folder).
>>> So for these actions how can I update metadata when the job is 
>>> performed ?
>>> Thomas
>>>
>>> Thomas Bellembois wrote:
>>>
>>>> Hello Stefan,
>>>>
>>>> Yes, it helps me very much ! Thank you !
>>>> I have now the information I needed.
>>>> I remember that you told me about this DetailedWebdavEvent, but I 
>>>> was a bit lost... But now it is ok. :-)
>>>> Thank you.
>>>>
>>>> Thomas.
>>>>
>>>>
>>>> Stefan Lützkendorf wrote:
>>>>
>>>>> Hello Thomas, sounds well
>>>>>
>>>>> but maybe you want to try the recently invented DetailedWebdavEvent.
>>>>> It provides some "*After" events, that are issued after the object 
>>>>> creation.
>>>>> The event source of WebdavEvent's and DetailedWebdavEvent's are 
>>>>> always the
>>>>> method classes from org.apache.slide.webdav.method. These provide 
>>>>> access to
>>>>> the helper classes and to the request and response infos.
>>>>> (this is similar to the WebdavListener, but that issues an event 
>>>>> only once per method)
>>>>>
>>>>> You can use this like the following sample:
>>>>>
>>>>> public void copyAfterCopy(DetailedWebdavEvent event) throws 
>>>>> VetoException {
>>>>>
>>>>>      AbstractWebdavMethod method = 
>>>>> (AbstractWebdavMethod)event.getSource();
>>>>>
>>>>>      Content content = method.getContent();
>>>>>
>>>>>      NodeRevisionDescriptors nrds = content.retrieve(
>>>>>                     method.getSlideToken(), method.getRequestUri());
>>>>>      NodeRevisionDescriptor nrd = content.retrieve(
>>>>>                     method.getSlideToken(), nrds);
>>>>>
>>>>>      ndr.setProperty(...);
>>>>>
>>>>>      content.store(method.getSlideToken(), method.getRequestUri(), 
>>>>> nrd, null);
>>>>> }
>>>>>
>>>>> If you are updateing properties at other nodes you may get problems 
>>>>> with the permissions,
>>>>> may be you want to update quota properties at nodes where the 
>>>>> current user does not
>>>>> have read or write permissions. You can work around this using a 
>>>>> Wrapper that disables
>>>>> security checking:
>>>>>
>>>>> SlideToken systemToken = new 
>>>>> SlideTokenWrapper(method.getSlideToken());
>>>>> systemToken.setForceSecurity(false);
>>>>> systemToken.setForceLock(false);
>>>>>
>>>>> I think we have to complete the getErrorCode method at WebdavUtils 
>>>>> to make
>>>>> VetoExceptions into more detailed WebDAV error codes.
>>>>>
>>>>> I hope this helps. Keep you motivation.
>>>>>
>>>>> Cheers Stefan
>>>>>
>>>>>
>>>>> Thomas Bellembois wrote:
>>>>>
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I have started to develop quota using Listener and Events 
>>>>>> (following your advice - thank you again), and I would like to be 
>>>>>> sure that I am on the good way.
>>>>>> I have built a new class that extends the ContentListener class.
>>>>>> I can get parameters of the current request (content length...) 
>>>>>> and access resources metadata (quota-available-bytes 
>>>>>> quota-used-bytes).
>>>>>> I override all of the methods of the ContentListener class, except 
>>>>>> the "retrieve" method (it does not seem to be necessary - not yet).
>>>>>>
>>>>>> According to the draft, every resource on the server should 
>>>>>> contain quota properties.
>>>>>> So, when an event is caught by my Listener, for example in the 
>>>>>> create method :
>>>>>> 1. getting the content lenght of the resource to be created
>>>>>> 2. getting the quota properties (quota-available-bytes 
>>>>>> quota-used-bytes) of the parent node (ie. directory where the 
>>>>>> resource will be stored)
>>>>>>      > if no quota properties are found, quota are supposed to be 
>>>>>> unlimited (?)
>>>>>> 3. if (request_contentLength + quota-used-bytes > 
>>>>>> quota-available-bytes) throw new VetoException(...quota exceeded...)
>>>>>> 4. else updating quota-available-bytes properties 
>>>>>> (quota-available-bytes = quota-available-bytes + 
>>>>>> request-contentLength) up to the root node
>>>>>> #Note : it does not seem to be very suitable do to that here, 
>>>>>> because the current action (create) is not performed yet - How can 
>>>>>> we do better ?
>>>>>>
>>>>>> For the store method, apparently called only when the resource 
>>>>>> already exists, the calculation at the point 3 is a bit different
>>>>>>
>>>>>> I wanted to use the WebDavListener interface but I could not find 
>>>>>> any way to retrieve request parameters and it looked easier to use 
>>>>>> a ContentListener (and event).
>>>>>>
>>>>>> So can I follow this idea ?
>>>>>>
>>>>>> Thank you very much.
>>>>>>
>>>>>> Thomas (still a beginner Slide-based product developer but still 
>>>>>> motivated ! ;-) )
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
> 
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
Hello Stefan,

I thought about this solution but the problem is that methods of the 
WebdavListener class are called before the job is performed, aren't they ?
We are not sure that the request will be successfull ?
If we are, it is nice :-)
Thank you for your help.

Thomas


Stefan Lützkendorf wrote:

> For this you can use WebdavListener-Events. WebdavAdapter implements both
> interfaces WebdavListener and DetailedWebdavListener. If your listener is
> deriveed from WebdavAdapter you can sould get calls to 
> put(WebdavEvent) and
> mkcol(WebdavEvent event) methods.
>
> Stefan
>
> Thomas Bellembois wrote:
>
>> Another basic question :
>> None of the methods of the DetailedWebdavListener class are called 
>> for a put or a mkcol method (I tried uploading a file and creating a 
>> directory with a Web folder).
>> So for these actions how can I update metadata when the job is 
>> performed ?
>> Thomas
>>
>> Thomas Bellembois wrote:
>>
>>> Hello Stefan,
>>>
>>> Yes, it helps me very much ! Thank you !
>>> I have now the information I needed.
>>> I remember that you told me about this DetailedWebdavEvent, but I 
>>> was a bit lost... But now it is ok. :-)
>>> Thank you.
>>>
>>> Thomas.
>>>
>>>
>>> Stefan Lützkendorf wrote:
>>>
>>>> Hello Thomas, sounds well
>>>>
>>>> but maybe you want to try the recently invented DetailedWebdavEvent.
>>>> It provides some "*After" events, that are issued after the object 
>>>> creation.
>>>> The event source of WebdavEvent's and DetailedWebdavEvent's are 
>>>> always the
>>>> method classes from org.apache.slide.webdav.method. These provide 
>>>> access to
>>>> the helper classes and to the request and response infos.
>>>> (this is similar to the WebdavListener, but that issues an event 
>>>> only once per method)
>>>>
>>>> You can use this like the following sample:
>>>>
>>>> public void copyAfterCopy(DetailedWebdavEvent event) throws 
>>>> VetoException {
>>>>
>>>>      AbstractWebdavMethod method = 
>>>> (AbstractWebdavMethod)event.getSource();
>>>>
>>>>      Content content = method.getContent();
>>>>
>>>>      NodeRevisionDescriptors nrds = content.retrieve(
>>>>                     method.getSlideToken(), method.getRequestUri());
>>>>      NodeRevisionDescriptor nrd = content.retrieve(
>>>>                     method.getSlideToken(), nrds);
>>>>
>>>>      ndr.setProperty(...);
>>>>
>>>>      content.store(method.getSlideToken(), method.getRequestUri(), 
>>>> nrd, null);
>>>> }
>>>>
>>>> If you are updateing properties at other nodes you may get problems 
>>>> with the permissions,
>>>> may be you want to update quota properties at nodes where the 
>>>> current user does not
>>>> have read or write permissions. You can work around this using a 
>>>> Wrapper that disables
>>>> security checking:
>>>>
>>>> SlideToken systemToken = new 
>>>> SlideTokenWrapper(method.getSlideToken());
>>>> systemToken.setForceSecurity(false);
>>>> systemToken.setForceLock(false);
>>>>
>>>> I think we have to complete the getErrorCode method at WebdavUtils 
>>>> to make
>>>> VetoExceptions into more detailed WebDAV error codes.
>>>>
>>>> I hope this helps. Keep you motivation.
>>>>
>>>> Cheers Stefan
>>>>
>>>>
>>>> Thomas Bellembois wrote:
>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> I have started to develop quota using Listener and Events 
>>>>> (following your advice - thank you again), and I would like to be 
>>>>> sure that I am on the good way.
>>>>> I have built a new class that extends the ContentListener class.
>>>>> I can get parameters of the current request (content length...) 
>>>>> and access resources metadata (quota-available-bytes 
>>>>> quota-used-bytes).
>>>>> I override all of the methods of the ContentListener class, except 
>>>>> the "retrieve" method (it does not seem to be necessary - not yet).
>>>>>
>>>>> According to the draft, every resource on the server should 
>>>>> contain quota properties.
>>>>> So, when an event is caught by my Listener, for example in the 
>>>>> create method :
>>>>> 1. getting the content lenght of the resource to be created
>>>>> 2. getting the quota properties (quota-available-bytes 
>>>>> quota-used-bytes) of the parent node (ie. directory where the 
>>>>> resource will be stored)
>>>>>      > if no quota properties are found, quota are supposed to be 
>>>>> unlimited (?)
>>>>> 3. if (request_contentLength + quota-used-bytes > 
>>>>> quota-available-bytes) throw new VetoException(...quota exceeded...)
>>>>> 4. else updating quota-available-bytes properties 
>>>>> (quota-available-bytes = quota-available-bytes + 
>>>>> request-contentLength) up to the root node
>>>>> #Note : it does not seem to be very suitable do to that here, 
>>>>> because the current action (create) is not performed yet - How can 
>>>>> we do better ?
>>>>>
>>>>> For the store method, apparently called only when the resource 
>>>>> already exists, the calculation at the point 3 is a bit different
>>>>>
>>>>> I wanted to use the WebDavListener interface but I could not find 
>>>>> any way to retrieve request parameters and it looked easier to use 
>>>>> a ContentListener (and event).
>>>>>
>>>>> So can I follow this idea ?
>>>>>
>>>>> Thank you very much.
>>>>>
>>>>> Thomas (still a beginner Slide-based product developer but still 
>>>>> motivated ! ;-) )
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Stefan Lützkendorf <lu...@apache.org>.
For this you can use WebdavListener-Events. WebdavAdapter implements both
interfaces WebdavListener and DetailedWebdavListener. If your listener is
deriveed from WebdavAdapter you can sould get calls to put(WebdavEvent) and
mkcol(WebdavEvent event) methods.

Stefan

Thomas Bellembois wrote:

> Another basic question :
> None of the methods of the DetailedWebdavListener class are called for a 
> put or a mkcol method (I tried uploading a file and creating a directory 
> with a Web folder).
> So for these actions how can I update metadata when the job is performed ?
> Thomas
> 
> Thomas Bellembois wrote:
> 
>> Hello Stefan,
>>
>> Yes, it helps me very much ! Thank you !
>> I have now the information I needed.
>> I remember that you told me about this DetailedWebdavEvent, but I was 
>> a bit lost... But now it is ok. :-)
>> Thank you.
>>
>> Thomas.
>>
>>
>> Stefan Lützkendorf wrote:
>>
>>> Hello Thomas, sounds well
>>>
>>> but maybe you want to try the recently invented DetailedWebdavEvent.
>>> It provides some "*After" events, that are issued after the object 
>>> creation.
>>> The event source of WebdavEvent's and DetailedWebdavEvent's are 
>>> always the
>>> method classes from org.apache.slide.webdav.method. These provide 
>>> access to
>>> the helper classes and to the request and response infos.
>>> (this is similar to the WebdavListener, but that issues an event only 
>>> once per method)
>>>
>>> You can use this like the following sample:
>>>
>>> public void copyAfterCopy(DetailedWebdavEvent event) throws 
>>> VetoException {
>>>
>>>      AbstractWebdavMethod method = 
>>> (AbstractWebdavMethod)event.getSource();
>>>
>>>      Content content = method.getContent();
>>>
>>>      NodeRevisionDescriptors nrds = content.retrieve(
>>>                     method.getSlideToken(), method.getRequestUri());
>>>      NodeRevisionDescriptor nrd = content.retrieve(
>>>                     method.getSlideToken(), nrds);
>>>
>>>      ndr.setProperty(...);
>>>
>>>      content.store(method.getSlideToken(), method.getRequestUri(), 
>>> nrd, null);
>>> }
>>>
>>> If you are updateing properties at other nodes you may get problems 
>>> with the permissions,
>>> may be you want to update quota properties at nodes where the current 
>>> user does not
>>> have read or write permissions. You can work around this using a 
>>> Wrapper that disables
>>> security checking:
>>>
>>> SlideToken systemToken = new SlideTokenWrapper(method.getSlideToken());
>>> systemToken.setForceSecurity(false);
>>> systemToken.setForceLock(false);
>>>
>>> I think we have to complete the getErrorCode method at WebdavUtils to 
>>> make
>>> VetoExceptions into more detailed WebDAV error codes.
>>>
>>> I hope this helps. Keep you motivation.
>>>
>>> Cheers Stefan
>>>
>>>
>>> Thomas Bellembois wrote:
>>>
>>>>
>>>> Hello,
>>>>
>>>> I have started to develop quota using Listener and Events (following 
>>>> your advice - thank you again), and I would like to be sure that I 
>>>> am on the good way.
>>>> I have built a new class that extends the ContentListener class.
>>>> I can get parameters of the current request (content length...) and 
>>>> access resources metadata (quota-available-bytes quota-used-bytes).
>>>> I override all of the methods of the ContentListener class, except 
>>>> the "retrieve" method (it does not seem to be necessary - not yet).
>>>>
>>>> According to the draft, every resource on the server should contain 
>>>> quota properties.
>>>> So, when an event is caught by my Listener, for example in the 
>>>> create method :
>>>> 1. getting the content lenght of the resource to be created
>>>> 2. getting the quota properties (quota-available-bytes 
>>>> quota-used-bytes) of the parent node (ie. directory where the 
>>>> resource will be stored)
>>>>      > if no quota properties are found, quota are supposed to be 
>>>> unlimited (?)
>>>> 3. if (request_contentLength + quota-used-bytes > 
>>>> quota-available-bytes) throw new VetoException(...quota exceeded...)
>>>> 4. else updating quota-available-bytes properties 
>>>> (quota-available-bytes = quota-available-bytes + 
>>>> request-contentLength) up to the root node
>>>> #Note : it does not seem to be very suitable do to that here, 
>>>> because the current action (create) is not performed yet - How can 
>>>> we do better ?
>>>>
>>>> For the store method, apparently called only when the resource 
>>>> already exists, the calculation at the point 3 is a bit different
>>>>
>>>> I wanted to use the WebDavListener interface but I could not find 
>>>> any way to retrieve request parameters and it looked easier to use a 
>>>> ContentListener (and event).
>>>>
>>>> So can I follow this idea ?
>>>>
>>>> Thank you very much.
>>>>
>>>> Thomas (still a beginner Slide-based product developer but still 
>>>> motivated ! ;-) )
>>>>
>>>
>>>
>>
>>
> 
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
Another basic question :
None of the methods of the DetailedWebdavListener class are called for a 
put or a mkcol method (I tried uploading a file and creating a directory 
with a Web folder).
So for these actions how can I update metadata when the job is performed ?
Thomas

Thomas Bellembois wrote:

> Hello Stefan,
>
> Yes, it helps me very much ! Thank you !
> I have now the information I needed.
> I remember that you told me about this DetailedWebdavEvent, but I was 
> a bit lost... But now it is ok. :-)
> Thank you.
>
> Thomas.
>
>
> Stefan Lützkendorf wrote:
>
>> Hello Thomas, sounds well
>>
>> but maybe you want to try the recently invented DetailedWebdavEvent.
>> It provides some "*After" events, that are issued after the object 
>> creation.
>> The event source of WebdavEvent's and DetailedWebdavEvent's are 
>> always the
>> method classes from org.apache.slide.webdav.method. These provide 
>> access to
>> the helper classes and to the request and response infos.
>> (this is similar to the WebdavListener, but that issues an event only 
>> once per method)
>>
>> You can use this like the following sample:
>>
>> public void copyAfterCopy(DetailedWebdavEvent event) throws 
>> VetoException {
>>
>>      AbstractWebdavMethod method = 
>> (AbstractWebdavMethod)event.getSource();
>>
>>      Content content = method.getContent();
>>
>>      NodeRevisionDescriptors nrds = content.retrieve(
>>                     method.getSlideToken(), method.getRequestUri());
>>      NodeRevisionDescriptor nrd = content.retrieve(
>>                     method.getSlideToken(), nrds);
>>
>>      ndr.setProperty(...);
>>
>>      content.store(method.getSlideToken(), method.getRequestUri(), 
>> nrd, null);
>> }
>>
>> If you are updateing properties at other nodes you may get problems 
>> with the permissions,
>> may be you want to update quota properties at nodes where the current 
>> user does not
>> have read or write permissions. You can work around this using a 
>> Wrapper that disables
>> security checking:
>>
>> SlideToken systemToken = new SlideTokenWrapper(method.getSlideToken());
>> systemToken.setForceSecurity(false);
>> systemToken.setForceLock(false);
>>
>> I think we have to complete the getErrorCode method at WebdavUtils to 
>> make
>> VetoExceptions into more detailed WebDAV error codes.
>>
>> I hope this helps. Keep you motivation.
>>
>> Cheers Stefan
>>
>>
>> Thomas Bellembois wrote:
>>
>>>
>>> Hello,
>>>
>>> I have started to develop quota using Listener and Events (following 
>>> your advice - thank you again), and I would like to be sure that I 
>>> am on the good way.
>>> I have built a new class that extends the ContentListener class.
>>> I can get parameters of the current request (content length...) and 
>>> access resources metadata (quota-available-bytes quota-used-bytes).
>>> I override all of the methods of the ContentListener class, except 
>>> the "retrieve" method (it does not seem to be necessary - not yet).
>>>
>>> According to the draft, every resource on the server should contain 
>>> quota properties.
>>> So, when an event is caught by my Listener, for example in the 
>>> create method :
>>> 1. getting the content lenght of the resource to be created
>>> 2. getting the quota properties (quota-available-bytes 
>>> quota-used-bytes) of the parent node (ie. directory where the 
>>> resource will be stored)
>>>      > if no quota properties are found, quota are supposed to be 
>>> unlimited (?)
>>> 3. if (request_contentLength + quota-used-bytes > 
>>> quota-available-bytes) throw new VetoException(...quota exceeded...)
>>> 4. else updating quota-available-bytes properties 
>>> (quota-available-bytes = quota-available-bytes + 
>>> request-contentLength) up to the root node
>>> #Note : it does not seem to be very suitable do to that here, 
>>> because the current action (create) is not performed yet - How can 
>>> we do better ?
>>>
>>> For the store method, apparently called only when the resource 
>>> already exists, the calculation at the point 3 is a bit different
>>>
>>> I wanted to use the WebDavListener interface but I could not find 
>>> any way to retrieve request parameters and it looked easier to use a 
>>> ContentListener (and event).
>>>
>>> So can I follow this idea ?
>>>
>>> Thank you very much.
>>>
>>> Thomas (still a beginner Slide-based product developer but still 
>>> motivated ! ;-) )
>>>
>>
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
Hello Stefan,

Yes, it helps me very much ! Thank you !
I have now the information I needed.
I remember that you told me about this DetailedWebdavEvent, but I was a 
bit lost... But now it is ok. :-)
Thank you.

Thomas.


Stefan Lützkendorf wrote:

> Hello Thomas, sounds well
>
> but maybe you want to try the recently invented DetailedWebdavEvent.
> It provides some "*After" events, that are issued after the object 
> creation.
> The event source of WebdavEvent's and DetailedWebdavEvent's are always 
> the
> method classes from org.apache.slide.webdav.method. These provide 
> access to
> the helper classes and to the request and response infos.
> (this is similar to the WebdavListener, but that issues an event only 
> once per method)
>
> You can use this like the following sample:
>
> public void copyAfterCopy(DetailedWebdavEvent event) throws 
> VetoException {
>
>      AbstractWebdavMethod method = 
> (AbstractWebdavMethod)event.getSource();
>
>      Content content = method.getContent();
>
>      NodeRevisionDescriptors nrds = content.retrieve(
>                     method.getSlideToken(), method.getRequestUri());
>      NodeRevisionDescriptor nrd = content.retrieve(
>                     method.getSlideToken(), nrds);
>
>      ndr.setProperty(...);
>
>      content.store(method.getSlideToken(), method.getRequestUri(), 
> nrd, null);
> }
>
> If you are updateing properties at other nodes you may get problems 
> with the permissions,
> may be you want to update quota properties at nodes where the current 
> user does not
> have read or write permissions. You can work around this using a 
> Wrapper that disables
> security checking:
>
> SlideToken systemToken = new SlideTokenWrapper(method.getSlideToken());
> systemToken.setForceSecurity(false);
> systemToken.setForceLock(false);
>
> I think we have to complete the getErrorCode method at WebdavUtils to 
> make
> VetoExceptions into more detailed WebDAV error codes.
>
> I hope this helps. Keep you motivation.
>
> Cheers Stefan
>
>
> Thomas Bellembois wrote:
>
>>
>> Hello,
>>
>> I have started to develop quota using Listener and Events (following 
>> your advice - thank you again), and I would like to be sure that I am 
>> on the good way.
>> I have built a new class that extends the ContentListener class.
>> I can get parameters of the current request (content length...) and 
>> access resources metadata (quota-available-bytes quota-used-bytes).
>> I override all of the methods of the ContentListener class, except 
>> the "retrieve" method (it does not seem to be necessary - not yet).
>>
>> According to the draft, every resource on the server should contain 
>> quota properties.
>> So, when an event is caught by my Listener, for example in the create 
>> method :
>> 1. getting the content lenght of the resource to be created
>> 2. getting the quota properties (quota-available-bytes 
>> quota-used-bytes) of the parent node (ie. directory where the 
>> resource will be stored)
>>      > if no quota properties are found, quota are supposed to be 
>> unlimited (?)
>> 3. if (request_contentLength + quota-used-bytes > 
>> quota-available-bytes) throw new VetoException(...quota exceeded...)
>> 4. else updating quota-available-bytes properties 
>> (quota-available-bytes = quota-available-bytes + 
>> request-contentLength) up to the root node
>> #Note : it does not seem to be very suitable do to that here, because 
>> the current action (create) is not performed yet - How can we do 
>> better ?
>>
>> For the store method, apparently called only when the resource 
>> already exists, the calculation at the point 3 is a bit different
>>
>> I wanted to use the WebDavListener interface but I could not find any 
>> way to retrieve request parameters and it looked easier to use a 
>> ContentListener (and event).
>>
>> So can I follow this idea ?
>>
>> Thank you very much.
>>
>> Thomas (still a beginner Slide-based product developer but still 
>> motivated ! ;-) )
>>
>
>


-- 
BELLEMBOIS Thomas
CRI, Université de Rennes 1
Campus de beaulieu
Avenue du Général Leclerc
35042 RENNES Cedex
Tél.: 02.23.23.69.60
Mail: Thomas.Bellembois@univ-rennes1.fr



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Quota development.

Posted by Stefan Lützkendorf <lu...@apache.org>.
Hello Thomas, sounds well

but maybe you want to try the recently invented DetailedWebdavEvent.
It provides some "*After" events, that are issued after the object creation.
The event source of WebdavEvent's and DetailedWebdavEvent's are always the
method classes from org.apache.slide.webdav.method. These provide access to
the helper classes and to the request and response infos.
(this is similar to the WebdavListener, but that issues an event only once per method)

You can use this like the following sample:

public void copyAfterCopy(DetailedWebdavEvent event) throws VetoException {

      AbstractWebdavMethod method = (AbstractWebdavMethod)event.getSource();

      Content content = method.getContent();

      NodeRevisionDescriptors nrds = content.retrieve(
                     method.getSlideToken(), method.getRequestUri());
      NodeRevisionDescriptor nrd = content.retrieve(
                     method.getSlideToken(), nrds);

      ndr.setProperty(...);

      content.store(method.getSlideToken(), method.getRequestUri(), nrd, null);
}

If you are updateing properties at other nodes you may get problems with the permissions,
may be you want to update quota properties at nodes where the current user does not
have read or write permissions. You can work around this using a Wrapper that disables
security checking:

SlideToken systemToken = new SlideTokenWrapper(method.getSlideToken());
systemToken.setForceSecurity(false);
systemToken.setForceLock(false);

I think we have to complete the getErrorCode method at WebdavUtils to make
VetoExceptions into more detailed WebDAV error codes.

I hope this helps. Keep you motivation.

Cheers Stefan


Thomas Bellembois wrote:
> 
> Hello,
> 
> I have started to develop quota using Listener and Events (following 
> your advice - thank you again), and I would like to be sure that I am on 
> the good way.
> I have built a new class that extends the ContentListener class.
> I can get parameters of the current request (content length...) and 
> access resources metadata (quota-available-bytes quota-used-bytes).
> I override all of the methods of the ContentListener class, except the 
> "retrieve" method (it does not seem to be necessary - not yet).
> 
> According to the draft, every resource on the server should contain 
> quota properties.
> So, when an event is caught by my Listener, for example in the create 
> method :
> 1. getting the content lenght of the resource to be created
> 2. getting the quota properties (quota-available-bytes quota-used-bytes) 
> of the parent node (ie. directory where the resource will be stored)
>      > if no quota properties are found, quota are supposed to be 
> unlimited (?)
> 3. if (request_contentLength + quota-used-bytes > quota-available-bytes) 
> throw new VetoException(...quota exceeded...)
> 4. else updating quota-available-bytes properties (quota-available-bytes 
> = quota-available-bytes + request-contentLength) up to the root node
> #Note : it does not seem to be very suitable do to that here, because 
> the current action (create) is not performed yet - How can we do better ?
> 
> For the store method, apparently called only when the resource already 
> exists, the calculation at the point 3 is a bit different
> 
> I wanted to use the WebDavListener interface but I could not find any 
> way to retrieve request parameters and it looked easier to use a 
> ContentListener (and event).
> 
> So can I follow this idea ?
> 
> Thank you very much.
> 
> Thomas (still a beginner Slide-based product developer but still 
> motivated ! ;-) )
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org