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 "Harding, Christopher (Student Assistant)" <Ch...@softwareag.com> on 2000/11/28 13:23:29 UTC

Displaying files

Hello,
  I'm have created my own repository driver in Slide that represents
information from a Database, either as a collection or resource. The
resources are just to represent the information in the Database and can have
a file size of 0, and the current date as the Last modified, created etc.
and don't need to be a physical file. Using MS WebFolders to display the
collections (folders) and resource(s) (files).

  I have created a copy of the MemoryDescriptorsStore and have modified it
to do this, it works perfectly to display collections but not resource(s).

  I can display the collections without any problems by using
	SubjectNode collection = new SubjectNode(path.toString());
	uri.getDescriptorsStore().createObject(path,collection);
	children.add((String)path.toString());
		//This adds the URL to the children vector
	........ re-create the parent using the new children vector and
links vector, removing the original before storing the ObjectNode

  But I can't work out what's needed to display a resource. What I have at
the moment is
	SubjectNode collection = new SubjectNode(path.toString());
	NodeRevisionDescriptor r = createProperties();
		//This creates a NodeRevisionDescriptor in the same was as
MkcolMethod.java does.
	uri.getDescriptorsStore().createRevisionDescriptor(path,r);
	uri.getContentStore().createRevisionContent(path,r,null);
	links.add((String)path.toString());
		//This adds the URL to the links vector
		//If I have children.add(....) here I get a "WARNING -
Internal server error".
	........ re-create the parent using the new children vector and
links vector, removing the original before storing the ObjectNode

  But this doesn't display anything at all, and there are no exceptions
thrown or error messages displayed to help me.

  Please can you tell me what is needed to be created / stored so that I can
display a resource as a file in MS WebFolders

  Thank you for any help
  Chris Harding

Re: Displaying files

Posted by Remy Maucherat <re...@apache.org>.
> Hello,
>   I'm have created my own repository driver in Slide that represents
> information from a Database, either as a collection or resource. The
> resources are just to represent the information in the Database and can
have
> a file size of 0, and the current date as the Last modified, created etc.
> and don't need to be a physical file. Using MS WebFolders to display the
> collections (folders) and resource(s) (files).

It's all decided by the "resourcetype" property.
If it's equal to "<collection/>", then it's a collection, otherwise it's a
file.

On of the differences between PUT and MKCOL is that put also set the
resourcetype property :
                property = new NodeProperty("resourcetype", "", true);
                revisionDescriptor.setProperty(property);

By default, when you do a new NodeResvisionDescriptor, the following
properties are set :
        setCreationDate(new Date());
        setName("");
        // By default, a resource is a collection
        setProperty(TYPE, "<collection/>", true);
        setProperty(SOURCE, "", true);
        setContentLength(0);
        setLastModified(new Date());
So by default it's a collection.

PROPFIND then determines if a resource is a collection using the
WebdavMethod.isCollection(RevisionDescriptor), which checks the
"resourcetype" value. If no revision exist on the object (which is valid),
the resource is considered to be a collection.

Does this help ?

Remy