You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Rolf Kulemann <ro...@apache.org> on 2004/04/04 15:57:19 UTC

Problem creating (WebDAV) resources with new repository interface

Hello (Guido),

I have done a small js file to test the functionalities of the new
WebDAVRepository[1] using the NEW Repository[2] interface.

I encountered a problem creating new reosurces. 
It does not work when using saveContent(String, String) on the [1]/[2].

Normally, looking at the WebDAVUtil class, there is a special method
createResource(URI) which is used to create a new resource. 

The problem is, the repository interface does not provide such a method,
yet.

Does it make sense to add a method called makeResource to the Repository
interface ??

In order to omit the makeResource method, the saveContent method should
test if the given resource exists, and if so, a different constructor
for the WebDAVResource in saveContent has to be used. Additionally we
could overload saveContent like saveContent(String url, String content,
boolean create) etc.

Makes sense? Or have I missed a way to create a new resource?

-- 
Regards,

    Rolf Kulemann


Re: Problem creating (WebDAV) resources with new repository interface

Posted by Rolf Kulemann <ro...@apache.org>.
On Sun, 2004-04-04 at 17:00, Guido Casper wrote:
> Rolf Kulemann wrote:
> > [...]
> > Normally, looking at the WebDAVUtil class, there is a special method
> > createResource(URI) which is used to create a new resource. 
> > 
> > The problem is, the repository interface does not provide such a method,
> > yet.
> > 
> > Does it make sense to add a method called makeResource to the Repository
> > interface ??
> 
> Just did that :-)

Guido, that was a gift, really, thanks.

-- 
Regards,

    Rolf Kulemann


Re: Problem creating (WebDAV) resources with new repository interface

Posted by Rolf Kulemann <ro...@apache.org>.
On Mon, 2004-04-05 at 08:44, Guido Casper wrote:
> Rolf Kulemann wrote:
> > Wouldn't it be useful also to have
> > 
> > createResource(String url, Source src)
> > createResource(String url, Node src)
> > 
> > ??
> 
> Hm, I don't know. I don't want to bloat the interface too much right 
> from the start. 

Good point.

> If you find yourself needing these why not just do:
> 
> repo.createResource(uri, "");
> repo.saveContent(uri, node);

Good idea, I will do that.

-- 
Regards,

    Rolf Kulemann


Re: Problem creating (WebDAV) resources with new repository interface

Posted by Guido Casper <gc...@s-und-n.de>.
Rolf Kulemann wrote:
> On Sun, 2004-04-04 at 17:00, Guido Casper wrote:
> 
>>Rolf Kulemann wrote:
>>
>>>Hello (Guido),
>>>
>>>I have done a small js file to test the functionalities of the new
>>>WebDAVRepository[1] using the NEW Repository[2] interface.
>>>
>>>I encountered a problem creating new reosurces. 
>>>It does not work when using saveContent(String, String) on the [1]/[2].
>>>
>>>Normally, looking at the WebDAVUtil class, there is a special method
>>>createResource(URI) which is used to create a new resource. 
>>>
>>>The problem is, the repository interface does not provide such a method,
>>>yet.
>>>
>>>Does it make sense to add a method called makeResource to the Repository
>>>interface ??
>>
>>Just did that :-)
> 
> 
> Wouldn't it be useful also to have
> 
> createResource(String url, Source src)
> createResource(String url, Node src)
> 
> ??

Hm, I don't know. I don't want to bloat the interface too much right 
from the start. If you find yourself needing these why not just do:

repo.createResource(uri, "");
repo.saveContent(uri, node);


Guido

-- 
Guido Casper
-------------------------------------------------
S&N AG, Competence Center Open Source
                     Tel.: +49-5251-1581-87
Klingenderstr. 5    mailto:gcasper@s-und-n.de
D-33100 Paderborn   http://www.s-und-n.de
-------------------------------------------------

Re: Problem creating (WebDAV) resources with new repository interface

Posted by Rolf Kulemann <ro...@apache.org>.
On Sun, 2004-04-04 at 17:00, Guido Casper wrote:
> Rolf Kulemann wrote:
> > Hello (Guido),
> > 
> > I have done a small js file to test the functionalities of the new
> > WebDAVRepository[1] using the NEW Repository[2] interface.
> > 
> > I encountered a problem creating new reosurces. 
> > It does not work when using saveContent(String, String) on the [1]/[2].
> > 
> > Normally, looking at the WebDAVUtil class, there is a special method
> > createResource(URI) which is used to create a new resource. 
> > 
> > The problem is, the repository interface does not provide such a method,
> > yet.
> > 
> > Does it make sense to add a method called makeResource to the Repository
> > interface ??
> 
> Just did that :-)

Wouldn't it be useful also to have

createResource(String url, Source src)
createResource(String url, Node src)

??

-- 
Regards,

    Rolf Kulemann


Re: Problem creating (WebDAV) resources with new repository interface

Posted by Guido Casper <gc...@s-und-n.de>.
Rolf Kulemann wrote:
> Hello (Guido),
> 
> I have done a small js file to test the functionalities of the new
> WebDAVRepository[1] using the NEW Repository[2] interface.
> 
> I encountered a problem creating new reosurces. 
> It does not work when using saveContent(String, String) on the [1]/[2].
> 
> Normally, looking at the WebDAVUtil class, there is a special method
> createResource(URI) which is used to create a new resource. 
> 
> The problem is, the repository interface does not provide such a method,
> yet.
> 
> Does it make sense to add a method called makeResource to the Repository
> interface ??

Just did that :-)

Thanks
Guido

> 
> In order to omit the makeResource method, the saveContent method should
> test if the given resource exists, and if so, a different constructor
> for the WebDAVResource in saveContent has to be used. Additionally we
> could overload saveContent like saveContent(String url, String content,
> boolean create) etc.
> 
> Makes sense? Or have I missed a way to create a new resource?
> 


-- 
Guido Casper
-------------------------------------------------
S&N AG, Competence Center Open Source
                     Tel.: +49-5251-1581-87
Klingenderstr. 5    mailto:gcasper@s-und-n.de
D-33100 Paderborn   http://www.s-und-n.de
-------------------------------------------------