@node WebDAV Resources @section Resources @deftp {GOOPS class} Base type for all WebDAV resources. The base class shouldn't be directly instanciated. @defun resource? x Is the given object a , or decendant? @end defun @end deftp @deftp {GOOPS method} name resource The name of a resource is the local part of a href. @end deftp @deftp {GOOPS method} children resource All direct children of a resource, as a list. @end deftp @defun add-child! parent child [#:overwrite?] [#:collection?=(is-collection? child)] Adds a resource as a child of another resource. Before adding the resource to the parents child set, @code{(setup-new-resource! child parent)} is called. If @var{collection?} is true, then @code{(setup-new-collection! child parent)} is also called. If @var{overwrite?} is present, then the parent will be checked for a child which already has that name, and take action accordingly. It will return one of: @code{'replaced} if a resource already existed with that name, but it has been replaced, @code{'collision}, if the old one was kept, and @code{'created} if the new resource was added without collisions. If @var{overwrite?} is absent then the method always returns @var{'created}. @end defun @defun add-resource! resource name content Creates a new resource with the given name, and make it a child of @var{self}. Setting its initial content to @var{content}. Calls @code{add-resource!}, so the same book-keeping procedures are called. @c TODO Document throw @c TODO Document return @end defun @defun add-collection! resource name Similar to @code{add-resource!} but the created resource is instead a collection. @end defun @deftp {GOOPS method} setup-new-resource! (self ) (parent ) Book-keeping procedure called by @code{add-resource!} on @emph{all} added resources. Base implementation in a no-op. @end deftp @deftp {GOOPS method} setup-new-collection! (self ) (parent ) Book-keeping procedure called by @code{add-resource!} if @var{collection?} is true. Base implementation is a no-op. @end deftp @deftp {GOOPS method} is-collection? resource Is the given resource a collection. The base implementation simply checks if the resource has any children. @end deftp @deftp {GOOPS method} content resource @deftpx {GOOPS method} set-content! resource content Get and set the content of a given resource. @var{content}s type can be anything that the given resource type accepts. Overrides of this procedure should preferably save its contents properly. @end deftp @c @defun get-property resource xml-tag @defunx get-live-property resource xml-tag @defunx get-dead-property resource xml-tag @end defun @defun set-property resource xml-el @defunx set-property! resource xml-el @defunx set-dead-property resource xml-el @defunx set-dead-property! resource xml-el @defunx set-live-property resource xml-el @defunx set-live-property! resource xml-el @end defun @defun remove-property resource xml-tag @defunx remove-property! resource xml-tag @defunx remove-dead-property resource xml-tag @defunx remove-dead-property! resource xml-tag @defunx remove-live-property resource xml-tag @defunx remove-live-property! resource xml-tag @end defun @c @deftp {GOOPS method} copy-resource (resource ) include-children? [name] Create a new resource which looks as similar as possible to the given resource. The new resource will have the same (GOOPS) class as the source, displayname, contentlanguage and all dead properties are transfered, other live properties are currently not explicitly transfered (but probably still transfered implicitly). The new resources name is @var{name} if given, and the name of the original resource otherwise. If @var{include-children?} is true then a deep copy is performed, otherwise no children are copied, and the resulting resource will be a leaf node. Content is copied verbatim. @b{NOTE} currently no helper method is called, which means that extra resources held by the resource object can't be copied. For example, FILE can't create a copy (but it also shouldn't do that here, but rathen when the element is ``mounted'' into the tree). @end deftp @c @defun lookup-resource root-resource path @end defun @defun all-resources-under resource [prefix='()] Returns the given resource, and all its children in a flat list. Currently depth first, but that might change. The root resource is however guaranteed to be first. @end defun @c @c TODO make-live-property live-property? property-getter property-setter-generator property-remover-generator prepare-update-properties live-properties dead-properties webdav-properties