jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross.Dy...@ipaustralia.gov.au
Subject Re: Sane file hierarchy when persisting file/folder nodes [SEC=UNCLASSIFIED]
Date Tue, 06 Apr 2010 03:44:35 GMT
You can mount the JCR repository using the Webdav interface, and so you 
get a view of the repository as if it were all just files in folders.

I don't believe the files are stored in binary, they are really just plain 
text.

Ross.



Tim TerlegÄrd <tim.terlegard@gmail.com> wrote on 01/04/2010 07:09:21 PM:

> From: Tim TerlegÄrd <tim.terlegard@gmail.com>
> To: users@jackrabbit.apache.org
> Date: 01/04/2010 07:10 PM
> Subject: Sane file hierarchy when persisting file/folder nodes
> 
> I'm investigating whether using Jackrabbit/JCR is a good abstraction
> when dealing with files.
> 
> I created a workspace (myspace) and used BundleFsPersistenceManager.
> When I tried the code below it created the file
> repository/workspaces/myspace/items/54/d6/c2bc4964477ab060d399ea532.n
> I'd rather it create
> repository/workspaces/myspace/items/hi.txt
> 
> Is it possible to get a nice file hierarchy and not these random
> numbers? And is it possible to store the files as plain text instead
> of binary?
> 
> Thanks,
> Tim
> 
> 
> Node root = session.getRootNode();
> Node fileNode = root.addNode("hi.txt", "nt:file");
> Node resNode = fileNode.addNode("jcr:content", "nt:resource");
> resNode.setProperty("jcr:mimeType", "text/plain");
> resNode.setProperty("jcr:encoding", "utf8");
> resNode.setProperty("jcr:data", new FileInputStream(new 
File("hi.txt")));
> session.save();

Mime
View raw message