X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Facr%2Fdirectory%2FDirectoryContentProvider.java;h=08171435cbb8ade0442f534f9206c0dcbd11edc2;hb=54df376a9c2dd458a82eaa09bfbb718fe699dd0d;hp=bd4117ead42d759914e82622b3ad6f8fc10dcbee;hpb=3b4d58678c32d2ca70c79e128e3bde0f6c9cd291;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/acr/directory/DirectoryContentProvider.java b/org.argeo.cms/src/org/argeo/cms/acr/directory/DirectoryContentProvider.java index bd4117ead..08171435c 100644 --- a/org.argeo.cms/src/org/argeo/cms/acr/directory/DirectoryContentProvider.java +++ b/org.argeo.cms/src/org/argeo/cms/acr/directory/DirectoryContentProvider.java @@ -7,18 +7,18 @@ import java.util.List; import javax.xml.namespace.QName; +import org.argeo.api.acr.ArgeoNamespace; import org.argeo.api.acr.Content; import org.argeo.api.acr.ContentName; import org.argeo.api.acr.ContentNotFoundException; -import org.argeo.api.acr.CrName; import org.argeo.api.acr.spi.ContentProvider; import org.argeo.api.acr.spi.ProvidedContent; import org.argeo.api.acr.spi.ProvidedSession; +import org.argeo.api.cms.directory.HierarchyUnit; import org.argeo.cms.CmsUserManager; import org.argeo.cms.acr.AbstractContent; import org.argeo.cms.acr.ContentUtils; -import org.argeo.osgi.useradmin.HierarchyUnit; -import org.argeo.osgi.useradmin.UserDirectory; +import org.argeo.cms.osgi.useradmin.UserDirectory; import org.osgi.service.useradmin.User; public class DirectoryContentProvider implements ContentProvider { @@ -48,7 +48,8 @@ public class DirectoryContentProvider implements ContentProvider { } } if (userDirectory == null) - throw new ContentNotFoundException("Cannot find user directory " + userDirectoryName); + throw new ContentNotFoundException(session, mountPath + "/" + relativePath, + "Cannot find user directory " + userDirectoryName); if (segments.size() == 1) { return new DirectoryContent(session, this, userDirectory); } else { @@ -71,7 +72,8 @@ public class DirectoryContentProvider implements ContentProvider { } HierarchyUnit hierarchyUnit = userDirectory.getHierarchyUnit(pathWithinUserDirectory); if (hierarchyUnit == null) - throw new ContentNotFoundException( + throw new ContentNotFoundException(session, + mountPath + "/" + relativePath + "/" + pathWithinUserDirectory, "Cannot find " + pathWithinUserDirectory + " within " + userDirectoryName); return new HierarchyUnitContent(session, this, hierarchyUnit); } @@ -90,16 +92,16 @@ public class DirectoryContentProvider implements ContentProvider { @Override public String getNamespaceURI(String prefix) { - if (CrName.LDAP_DEFAULT_PREFIX.equals(prefix)) - return CrName.LDAP_NAMESPACE_URI; - throw new IllegalArgumentException("Only prefix " + CrName.LDAP_DEFAULT_PREFIX + " is supported"); + if (ArgeoNamespace.LDAP_DEFAULT_PREFIX.equals(prefix)) + return ArgeoNamespace.LDAP_NAMESPACE_URI; + throw new IllegalArgumentException("Only prefix " + ArgeoNamespace.LDAP_DEFAULT_PREFIX + " is supported"); } @Override public Iterator getPrefixes(String namespaceURI) { - if (CrName.LDAP_NAMESPACE_URI.equals(namespaceURI)) - return Collections.singletonList(CrName.LDAP_DEFAULT_PREFIX).iterator(); - throw new IllegalArgumentException("Only namespace URI " + CrName.LDAP_NAMESPACE_URI + " is supported"); + if (ArgeoNamespace.LDAP_NAMESPACE_URI.equals(namespaceURI)) + return Collections.singletonList(ArgeoNamespace.LDAP_DEFAULT_PREFIX).iterator(); + throw new IllegalArgumentException("Only namespace URI " + ArgeoNamespace.LDAP_NAMESPACE_URI + " is supported"); } public void setUserManager(CmsUserManager userManager) { @@ -110,6 +112,9 @@ public class DirectoryContentProvider implements ContentProvider { return new UserManagerContent(session); } + /* + * COMMON UTILITIES + */ class UserManagerContent extends AbstractContent { public UserManagerContent(ProvidedSession session) {