public String[] getPaths( ContextualisedStorage root, CSPRequestCredentials creds, CSPRequestCache cache, String rootPath, JSONObject restriction) throws ExistException, UnimplementedException, UnderlyingStorageException { String parts[] = split(rootPath, true); if ("".equals(parts[0])) { return children.keySet().toArray(new String[0]); } else { List<String> out = new ArrayList<String>(); for (Map.Entry<String, ContextualisedStorage> e : children.entrySet()) { if (e.getKey().equals(parts[0])) { ContextualisedStorage storage = e.getValue(); String[] paths = storage.getPaths(root, creds, cache, parts[1], restriction); if (paths == null) continue; for (String s : paths) { out.add(s); } } } return out.toArray(new String[0]); } }