jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Harris" <michael.e.har...@gmail.com>
Subject saving files
Date Tue, 22 Jul 2008 17:22:59 GMT
hey all,

more newb questions here.
Want to save a file in the repository.  found this on the wiki

Node folderNode = session.getRootNode();
        Node fileNode = folderNode.addNode(file.getName(), "nt:file");

        // create the mandatory child node - jcr:content
        Node resNode = fileNode.addNode("jcr:content", "nt:resource");
        resNode.setProperty("jcr:mimeType", "");
        resNode.setProperty("jcr:encoding", "");
        resNode.setProperty("jcr:data", new FileInputStream(file));
        Calendar lastModified = Calendar.getInstance();
        resNode.setProperty("jcr:lastModified", lastModified);

Is the file itself being put in the repository (jcr.data) or just the

Do I even need the resNode?  Can I just save the file into the fileNode?

Finally, we are going to need to lock the file (which is why we are using
jcr).  Is it possible to attach info (like who owns the lock) to the locked

Thanx.  This community has been quite helpful.

Michael Harris

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message