public void createRepositoryPath()

in src/main/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListener.java [230:253]


    public void createRepositoryPath(final Session writerSession, final String repositoryPath)
            throws RepositoryException {
        if (!writerSession.itemExists(repositoryPath)) {
            Node node = writerSession.getRootNode();
            String path = repositoryPath.substring(1);
            int pos = path.lastIndexOf('/');
            if (pos != -1) {
                final StringTokenizer st = new StringTokenizer(path.substring(0, pos), "/");
                while (st.hasMoreTokens()) {
                    final String token = st.nextToken();
                    if (!node.hasNode(token)) {
                        node.addNode(token, "sling:Folder");
                        writerSession.save();
                    }
                    node = node.getNode(token);
                }
                path = path.substring(pos + 1);
            }
            if (!node.hasNode(path)) {
                node.addNode(path, "sling:Folder");
                writerSession.save();
            }
        }
    }