jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim TerlegÄrd <tim.terleg...@gmail.com>
Subject Sane file hierarchy when persisting file/folder nodes
Date Thu, 01 Apr 2010 08:09:21 GMT
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