X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.jcr%2Fsrc%2Forg%2Fargeo%2Fjcr%2Ffs%2FJcrFileSystem.java;h=885eaf19f4b0962b850de47122b36601ad0f0603;hb=5330a39edafd14df2e6cdc57aae4e9393ebca75c;hp=40328e8a093c2fce05b3a84ac7032686052554fc;hpb=e66b9893b0e511f8ab295e3cee42b7dc966f1597;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.jcr/src/org/argeo/jcr/fs/JcrFileSystem.java b/org.argeo.jcr/src/org/argeo/jcr/fs/JcrFileSystem.java index 40328e8a0..885eaf19f 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/fs/JcrFileSystem.java +++ b/org.argeo.jcr/src/org/argeo/jcr/fs/JcrFileSystem.java @@ -8,8 +8,10 @@ import java.nio.file.PathMatcher; import java.nio.file.WatchService; import java.nio.file.attribute.UserPrincipalLookupService; import java.nio.file.spi.FileSystemProvider; +import java.util.HashSet; import java.util.Set; +import javax.jcr.RepositoryException; import javax.jcr.Session; import org.argeo.jcr.JcrUtils; @@ -51,43 +53,56 @@ public class JcrFileSystem extends FileSystem { @Override public Iterable getRootDirectories() { - return null; + try { + Set single = new HashSet<>(); + single.add(new JcrPath(this, session.getRootNode())); + return single; + } catch (RepositoryException e) { + throw new JcrFsException("Cannot get root path", e); + } } @Override public Iterable getFileStores() { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException(); } @Override public Set supportedFileAttributeViews() { - // TODO Auto-generated method stub - return null; + try { + String[] prefixes = session.getNamespacePrefixes(); + Set res = new HashSet<>(); + for (String prefix : prefixes) + res.add(prefix); + res.add("basic"); + return res; + } catch (RepositoryException e) { + throw new JcrFsException("Cannot get supported file attributes views", e); + } } @Override public Path getPath(String first, String... more) { - // TODO Auto-generated method stub - return null; + StringBuilder sb = new StringBuilder(first); + // TODO Make it more robust + for (String part : more) + sb.append('/').append(part); + return new JcrPath(this, sb.toString()); } @Override public PathMatcher getPathMatcher(String syntaxAndPattern) { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException(); } @Override public UserPrincipalLookupService getUserPrincipalLookupService() { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException(); } @Override public WatchService newWatchService() throws IOException { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException(); } public Session getSession() {