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 Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br> on 2001/12/19 17:24:02 UTC

Hos Structure is related to Content

Hi all.
I've a simple question.
How org.apache.slide.content.Content is related to
org.apache.slide.structure.Structure ?

Do I have to add an ObjectNode using structure and then what ?
how do I add content to a Node created with Structure ?
I think a better question would be. What king of objects are related to
each ObjectNode and what are their responsibilities ?


-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)

http://www.ibnetwork.com.br


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Hos Structure is related to Content

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
On Wed, 2001-12-19 at 16:01, Jean-Philippe Courson wrote:
> 
> ps : if you expect responses, ask questions about slide use in slide 
> users mailling list

Sorry, I'm trying the slide-user list but there is no much support
there.

-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Hos Structure is related to Content

Posted by Jean-Philippe Courson <co...@noos.fr>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>