(JackrabbitWorkspace) session.getWorkspace();
NamespaceRegistry registry = workspace.getNamespaceRegistry();
registry.registerNamespace("test", "http://www.example.org/");
PrivilegeManager privilegeManager = workspace.getPrivilegeManager();
privilegeManager.registerPrivilege("test:privilege", false, null);
privilegeManager.registerPrivilege(
"test:aggregate", false, new String[] { "jcr:read", "test:privilege" });
NodeTypeManager nodeTypeManager = workspace.getNodeTypeManager();
NodeTypeTemplate template = nodeTypeManager.createNodeTypeTemplate();
template.setName("test:unstructured");