@Test public void setLocalDirStickyBit() throws IOException { File tempFolder = mTestFolder.newFolder("dirToModify"); if (tempFolder.getAbsolutePath().startsWith(AlluxioURI.SEPARATOR)) { FileUtils.setLocalDirStickyBit(tempFolder.getAbsolutePath()); List<String> commands = new ArrayList<>(); commands.add("/bin/ls"); commands.add("-ld"); commands.add(tempFolder.getAbsolutePath()); try { ProcessBuilder builder = new ProcessBuilder(commands); Process process = builder.start(); process.waitFor(); BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = stdInput.readLine(); assertTrue(line.matches("^d[rwx-]{8}t.*$")); } catch (InterruptedException e) { e.printStackTrace(); } } }
public static void setLocalDirStickyBit(String dir) { try { if (dir.startsWith(AlluxioURI.SEPARATOR)) { Runtime.getRuntime().exec("chmod +t " + dir); } } catch (IOException e) { LOG.info("Can not set the sticky bit of the directory: {}", dir, e); } }
FileUtils { public static void setLocalDirStickyBit(String dir) { try { if (dir.startsWith(AlluxioURI.SEPARATOR)) { Runtime.getRuntime().exec("chmod +t " + dir); } } catch (IOException e) { LOG.info("Can not set the sticky bit of the directory: {}", dir, e); } } }
FileUtils { public static void setLocalDirStickyBit(String dir) { try { if (dir.startsWith(AlluxioURI.SEPARATOR)) { Runtime.getRuntime().exec("chmod +t " + dir); } } catch (IOException e) { LOG.info("Can not set the sticky bit of the directory: {}", dir, e); } } private  FileUtils(); }
FileUtils { public static void setLocalDirStickyBit(String dir) { try { if (dir.startsWith(AlluxioURI.SEPARATOR)) { Runtime.getRuntime().exec("chmod +t " + dir); } } catch (IOException e) { LOG.info("Can not set the sticky bit of the directory: {}", dir, e); } } private  FileUtils(); static void changeLocalFileGroup(String path, String group); static void changeLocalFilePermission(String filePath, String perms); static void changeLocalFileToFullPermission(String filePath); static String getLocalFileOwner(String filePath); static String getLocalFileGroup(String filePath); static short getLocalFileMode(String filePath); static short translatePosixPermissionToMode(Set<PosixFilePermission> permission); static void changeLocalFileUser(String path, String user); static void setLocalDirStickyBit(String dir); static void createBlockPath(String path, String workerDataFolderPermissions); static void move(String srcPath, String dstPath); static void delete(String path); static void deletePathRecursively(String path); static boolean createStorageDirPath(String path, String workerDataFolderPermissions); static void createFile(String filePath); static void createDir(String path); static boolean exists(String path); static boolean isStorageDirAccessible(String path); }
FileUtils { public static void setLocalDirStickyBit(String dir) { try { if (dir.startsWith(AlluxioURI.SEPARATOR)) { Runtime.getRuntime().exec("chmod +t " + dir); } } catch (IOException e) { LOG.info("Can not set the sticky bit of the directory: {}", dir, e); } } private  FileUtils(); static void changeLocalFileGroup(String path, String group); static void changeLocalFilePermission(String filePath, String perms); static void changeLocalFileToFullPermission(String filePath); static String getLocalFileOwner(String filePath); static String getLocalFileGroup(String filePath); static short getLocalFileMode(String filePath); static short translatePosixPermissionToMode(Set<PosixFilePermission> permission); static void changeLocalFileUser(String path, String user); static void setLocalDirStickyBit(String dir); static void createBlockPath(String path, String workerDataFolderPermissions); static void move(String srcPath, String dstPath); static void delete(String path); static void deletePathRecursively(String path); static boolean createStorageDirPath(String path, String workerDataFolderPermissions); static void createFile(String filePath); static void createDir(String path); static boolean exists(String path); static boolean isStorageDirAccessible(String path);  }