String[] parentPath = ContentUtils.getParentPath(mountPath);
Content parent = systemSession.get(parentPath[0]);
Content mount = parent.add(parentPath[1]);
- mount.put(CrName.MOUNT.get(), "true");
+ mount.put(CrName.mount.qName(), "true");
}
}
synchronized ContentProvider findContentProvider(String path) {
+// if (ContentUtils.EMPTY.equals(path))
+// return partitions.firstEntry().getValue();
Map.Entry<String, ContentProvider> entry = partitions.floorEntry(path);
if (entry == null)
- throw new IllegalArgumentException("No entry provider found for " + path);
+ throw new IllegalArgumentException("No entry provider found for path '" + path + "'");
String mountPath = entry.getKey();
+ if (!path.startsWith(mountPath)) {
+ // FIXME make it more robust and find when there is no content provider
+ String[] parent = ContentUtils.getParentPath(path);
+ return findContentProvider(parent[0]);
+ // throw new IllegalArgumentException("Path " + path + " doesn't have a content
+ // provider");
+ }
ContentProvider contentProvider = entry.getValue();
assert mountPath.equals(contentProvider.getMountPath());
return contentProvider;