Leandro Rodrigo Saad Cruz wrote:
> Hi all.
> I've a simple question.
> How org.apache.slide.content.Content is related to
> org.apache.slide.structure.Structure ?
These 2 helpers have differents roles :
Structure helper is used to deal with namespace structure eg nodes and
nodes's children that forms uris.
Content helper is used to deal with nodes content eg nodes properties
and files content.
> Do I have to add an ObjectNode using structure and then what ?
> how do I add content to a Node created with Structure ?
When you want to add a node, you have 2 things to do :
1) Add the node to the structure with the structure helper
For example a collection or file :
String uri = "/files/folder";
SubjectNode node = new SubjectNode(uri);
structure.create(token, node, uri);
2) Add the node properties and for a file its content with the content
helper
Example for a collection :
NodeRevisionDescriptor revisionDescriptor
= new NodeRevisionDescriptor(0);
NodeProperty property = null;
property = new NodeProperty("resourcetype", "<collection/>", true);
revisionDescriptor.setProperty(property);
Date date = new Date();
revisionDescriptor.setCreationDate(date);
revisionDescriptor.setLastModified(date);
property = new NodeProperty("getcontentlength", "0", true);
revisionDescriptor.setProperty(property);
property = new NodeProperty("source", "", true);
revisionDescriptor.setProperty(property);
String owner = token.getCredentialsToken().getPublicCredentials();
property = new NodeProperty("owner", owner, true);
revisionDescriptor.setProperty(property);
content.create(token, uri, revisionDescriptor, null);
For a file you have to do a setContent(InputStream is) to the revision descriptor.
If you want to see more examples, have a look at the class implementing
webdav methods located into folder
src/webdav/server/org/apache/slide/webdav/method in slide's source
distribution
Hope that helps
JP
ps : if you expect responses, ask questions about slide use in slide
users mailling list
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>