CalvalusShFileSystem extends LocalFileSystem { @Override public FileStatus[] listStatus(Path path) throws FileNotFoundException, IOException { setAccessTime(); if (isLoginUser) { return unixFileSystem.listStatus(path); } String p = path.toUri().getPath(); Process proc = callUnixCommand("ls", p); List<FileStatus> files = collectPathsOutput(proc); handleReturnCode(proc, files, path); LOG.info("dir " + path + " externally listed, " + files.size() + " entries"); return files.toArray(new FileStatus[files.size()]); } CalvalusShFileSystem();  CalvalusShFileSystem(String username, FileSystem fs);  CalvalusShFileSystem(String username, JobClientsMap.CacheEntry cacheEntry); @Override void initialize(URI name, Configuration conf); static synchronized void createOrRegister(String username,
                                                     JobClientsMap.CacheEntry cacheEntry,
                                                     Map<String,FileSystem> fileSystemMap); static synchronized FileSystem getCreate(URI uri, Configuration conf); JobClientsMap.CacheEntry getCacheEntry(); @Override FileStatus[] listStatus(Path path); @Override FileStatus[] listStatus(Path path, PathFilter filter); @Override RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f); @Override FileStatus getFileStatus(Path path); @Override FileStatus[] globStatus(Path path); @Override FileStatus[] globStatus(Path path, PathFilter filter); @Override FSDataInputStream open(Path path); @Override FSDataInputStream open(Path path, int bufferSize); @Override FSDataOutputStream create(Path path, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress); @Override FSDataOutputStream append(Path path, int bufferSize, Progressable progress); @Override boolean mkdirs(Path path, FsPermission permission); @Override void setPermission(Path path, FsPermission permission); @Override boolean rename(Path src, Path dst); @Override boolean delete(Path path, boolean recursive); @Override void setWorkingDirectory(Path new_dir); @Override Path getWorkingDirectory(); @Override URI getUri(); @Override Path makeQualified(Path path); @Override Configuration getConf(); static final String CALVALUS_SH_COMMAND; }
@Test @Ignore public void testListStatus() throws Exception { System.setProperty("calvalus.accesscontrol.external", "true"); String user = "vboxadd"; JobClientsMap jobClientsMap = new JobClientsMap(new JobConf()); JobClient jobClient = jobClientsMap.getJobClient(user); FileSystem fileSystem = jobClientsMap.getFileSystem(user); for (FileStatus fileStatus : fileSystem.listStatus(new Path("/calvalus/testdir"))) { System.out.println(fileStatus.getPath() + " " + fileStatus.isDirectory()); } }