List of usage examples for org.apache.hadoop.fs.permission FsPermission equals
@Override
public boolean equals(Object obj)
From source file:org.apache.falcon.entity.parser.ClusterEntityParser.java
License:Apache License
private void createWorkingDirUnderStaging(FileSystem fs, Cluster cluster, Location stagingLocation) throws ValidationException { Path workingDirPath = new Path(stagingLocation.getPath(), ClusterHelper.WORKINGDIR); try {/*w w w . j a v a 2s .co m*/ if (!fs.exists(workingDirPath)) { //Checking if the staging dir has the working dir to be created HadoopClientFactory.mkdirs(fs, workingDirPath, HadoopClientFactory.READ_EXECUTE_PERMISSION); } else { if (fs.isDirectory(workingDirPath)) { FsPermission workingPerms = fs.getFileStatus(workingDirPath).getPermission(); if (!workingPerms.equals(HadoopClientFactory.READ_EXECUTE_PERMISSION)) { //perms check throw new ValidationException( "Falcon needs subdir " + ClusterHelper.WORKINGDIR + " inside staging dir:" + stagingLocation.getPath() + " when staging location not specified with " + HadoopClientFactory.READ_EXECUTE_PERMISSION.toString() + " got " + workingPerms.toString()); } } else { throw new ValidationException("Falcon needs subdir " + ClusterHelper.WORKINGDIR + " inside staging dir:" + stagingLocation.getPath() + " when staging location not specified. Got a file at " + workingDirPath.toString()); } } } catch (IOException e) { throw new ValidationException("Unable to create path for " + workingDirPath.toString() + " with path: " + workingDirPath.toString() + " for cluster " + cluster.getName(), e); } }
From source file:oz.hadoop.yarn.test.cluster.InJvmContainerExecutor.java
License:Apache License
/** * Copied from super class//from w w w . j a va2 s . c o m */ private void createDir(Path dirPath, FsPermission perms, boolean createParent) throws IOException { fc.mkdir(dirPath, perms, createParent); if (!perms.equals(perms.applyUMask(fc.getUMask()))) { fc.setPermission(dirPath, perms); } }