private javax.jcr.Node addDirectory(String path) throws RepositoryException {
		if ("/".equals(path)) {
			return m_session.getRootNode();
		}

		if (m_session.nodeExists(path)) {
			javax.jcr.Node dir = m_session.getNode(path);
			if (!dir.isNodeType(CATEGORY_TYPE)) {
				throw new RuntimeException("Not a directory: " + path);
			}
			return dir;
		}

		javax.jcr.Node root = m_session.getRootNode();
		String[] token = path.split("/");

		javax.jcr.Node node = root;
		for (String tok : token) {
			tok = tok.trim();
			if (tok.length() > 0) {
				if (node.hasNode(tok)) {
					node = node.getNode(tok);
					if (node.isNodeType(CATEGORY_TYPE)) {
						continue;
					} else if (!node.isSame(root)) {
						throw new RuntimeException("Not a directory: " + node.getPath());
					}
				} else {
					node = node.addNode(tok, CATEGORY_TYPE);
				}
			}
		}
		m_session.save();
		return node;
	}