- userAdminUri = businessRolesFile.toURI().toString();
- }
- String[] uris = userAdminUri.split(" ");
- for (String uri : uris) {
- URI u;
- try {
- u = new URI(uri);
- if (u.getPath() == null)
- throw new CmsException("URI " + uri
- + " must have a path in order to determine base DN");
- if (u.getScheme() == null) {
- if (uri.startsWith("/") || uri.startsWith("./")
- || uri.startsWith("../"))
- u = new File(uri).getCanonicalFile().toURI();
- else if (!uri.contains("/"))
- u = new File(nodeBaseDir, uri).getCanonicalFile()
- .toURI();
- else
- throw new CmsException("Cannot interpret " + uri
- + " as an uri");
- } else if (u.getScheme().equals("file")) {
- u = new File(u).getCanonicalFile().toURI();
- }
- } catch (Exception e) {
- throw new CmsException(
- "Cannot interpret " + uri + " as an uri", e);
- }
- Dictionary<String, ?> properties = UserAdminConf.uriAsProperties(u
- .toString());
- UserDirectory businessRoles;
- if (u.getScheme().startsWith("ldap")) {
- businessRoles = new LdapUserAdmin(properties);
- } else {
- businessRoles = new LdifUserAdmin(properties);
- }
- businessRoles.init();
- String baseDn = businessRoles.getBaseDn();
- if (userAdmins.containsKey(baseDn))
- throw new UserDirectoryException(
- "There is already a user admin for " + baseDn);
- try {
- userAdmins.put(new LdapName(baseDn), (UserAdmin) businessRoles);
- } catch (InvalidNameException e) {
- throw new UserDirectoryException("Badly formatted base DN "
- + baseDn, e);