On 4/26/10 5:27 PM, Alexander Klimetschek wrote: > On Mon, Apr 26, 2010 at 21:38, danisevsky <[email protected]> wrote: >> Hello, is there better way to create some folders (path) ? >> >> My code: >> >> public static final String TMP_PATH = "my:root/tmp/incoming"; >> public static final String GALLERY_PATH = "my:root/data/gallery/"; >> >> >> public static initWorkspace() { >> ... >> JcrNode root = getCurrentSession(workspaceId).getRootNode(); >> root.addNode("my:root").addNode("data").addNode("gallery"); >> root.addNode("my:root/tmp").addNode("incomming"); >> getCurrentSession(workspaceId).save(); >> ... >> } >> >> Is there some Utils class which can do something like this: >> >> JCRUtils.createNodes(TMP_PATH); >> JCRUtils.createNodes(GALLERY_PATH); > > None that is open source and that I know of. We have such a utility > class that creates node paths, automatically creates unique node > names, if desired, does session-based copying of nodes, etc. in our > proprietary code base (cq5). It's fairly easy, though. > > Regards, > Alex >
I think this method from Sling's Post Servlet bundle does what you're looking for: http://bit.ly/cWKabU Justin
