[Yanel-dev] Yarep delete method

Michael Wechner michael.wechner at wyona.com
Mon Jul 23 16:08:51 CEST 2007


Josias Thöny wrote:

> Michael Wechner wrote:
>
>> Hi
>>
>> I have noticed that according to the API calling delete also is 
>> supposed to delete all children resp. also non-empty collections
>>
>> src/core/java/org/wyona/yarep/core/Node.java
>>
>>    /**
>>     * Deletes this node and all subnodes.
>>     * The root node cannot be deleted.
>>     * @throws RepositoryException if this node is the root node or if 
>> a repository error occurs.
>>     */
>>    public void delete() throws RepositoryException;
>>
>>
>> Shouldn't we introduce something like
>>
>>
>> delete(boolean recursive)
>>
>> which would allow to block the deletion of non-empty collections when 
>> being set to delete(false)
>>
>
> IIUC this would mean that a caller of delete(false) has to check 
> afterwards if the operation has been successful.
> Then you could as well check if the node has any child nodes before 
> you call delete().
> Where do you see the advantage of using delete(false)?


I think it's a bit more convenient

node.delete(false)

versus

if (node.getNodes().length == 0) node.delete()

but I am also fine with it as it is, because one could argue that when 
using delete() within a program, one
normally doesn't do things by accident, whereas when using the "rm" on 
the command line one often deletes stuff by accident.

Cheers

Michi

>
> josias
>
>> ?
>>
>> This would corrspond to rm -r
>>
>> WDYT?
>>
>> Cheers
>>
>> Michi
>>
>
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development



-- 
Michael Wechner
Wyona      -   Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael.wechner at wyona.com, michi at apache.org
+41 44 272 91 61



More information about the Yanel-development mailing list