Examples of FsPermission


Examples of org.apache.hadoop.fs.permission.FsPermission

  private void doAnEdit(FSNamesystem fsn, int id) throws IOException {
    // Make an edit
    fsn.mkdirs(
      "/test" + id,
      new PermissionStatus("test", "Test",
          new FsPermission((short)0777)));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

                                    String.valueOf(jobTrackerStartTime) + "_";
      jobtrackerHostname = hostname;
      Path logDir = new Path(LOG_DIR);
      LOGDIR_FS = logDir.getFileSystem(conf);
      if (!LOGDIR_FS.exists(logDir)){
        if (!LOGDIR_FS.mkdirs(logDir, new FsPermission(HISTORY_DIR_PERMISSION))) {
          throw new IOException("Mkdirs failed to create " + logDir.toString());
        }
      }
      conf.set("hadoop.job.history.location", LOG_DIR);
      disableHistory = false;
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

      //If not already present create the done folder with appropriate
      //permission
      if (!DONEDIR_FS.exists(DONE)) {
        LOG.info("Creating DONE folder at "+ DONE);
        if (! DONEDIR_FS.mkdirs(DONE,
            new FsPermission(HISTORY_DIR_PERMISSION))) {
          throw new IOException("Mkdirs failed to create " + DONE.toString());
        }
      }

      fileManager.start();
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

              if (LOGDIR_FS.exists(path)) {
                LOG.info("Moving " + path.toString() + " to " +
                    DONE.toString());
                DONEDIR_FS.moveFromLocalFile(path, DONE);
                DONEDIR_FS.setPermission(new Path(DONE, path.getName()),
                    new FsPermission(HISTORY_FILE_PERMISSION));
              }
            }
          } catch (Throwable e) {
            LOG.error("Unable to move history file to DONE folder.", e);
          }
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

   * @throws IOException
   */
  private static boolean checkPermissionOfOther(FileSystem fs, Path path,
      FsAction action) throws IOException {
    FileStatus status = fs.getFileStatus(path);
    FsPermission perms = status.getPermission();
    FsAction otherAction = perms.getOtherAction();
    if (otherAction.implies(action)) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

    assertTrue("History file does not exist", fileSys.exists(logFile));

    // check history file permission
    assertTrue("History file permissions does not match",
    fileSys.getFileStatus(logFile).getPermission().equals(
       new FsPermission(JobHistory.HISTORY_FILE_PERMISSION)));
   
    // check if the history file is parsable
    String[] jobDetails = JobHistory.JobInfo.decodeJobHistoryFileName(
                                           logFileName).split("_");
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

    FileSystem fs = inDir.getFileSystem(conf);
    if (!fs.mkdirs(inDir)) {
      throw new IOException("Failed to create the input directory:"
            + inDir.toString());
    }
    fs.setPermission(inDir, new FsPermission(FsAction.ALL,
            FsAction.ALL, FsAction.ALL));
    DataOutputStream file = fs.create(new Path(inDir, "data.txt"));
    int i = 0;
    while(i < 1000 * 3000) {
      file.writeBytes(input);
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

      UserResolver userResolver) throws IOException, InterruptedException {
    InputStream trace = null;
    try {
      Path scratchDir = new Path(ioPath, conf.get(GRIDMIX_OUT_DIR, "gridmix"));
      final FileSystem scratchFs = scratchDir.getFileSystem(conf);
      scratchFs.mkdirs(scratchDir, new FsPermission((short) 0777));
      scratchFs.setPermission(scratchDir, new FsPermission((short) 0777));
      // add shutdown hook for SIGINT, etc.
      Runtime.getRuntime().addShutdownHook(sdh);
      CountDownLatch startFlag = new CountDownLatch(1);
      try {
        // Create, start job submission threads
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

      conf = new Configuration();
      conf.setEnum(GridmixJobSubmissionPolicy.JOB_SUBMISSION_POLICY, policy);
      conf = GridmixTestUtils.mrCluster.createJobConf(new JobConf(conf));
//    GridmixTestUtils.createHomeAndStagingDirectory((JobConf)conf);
      // allow synthetic users to create home directories
      GridmixTestUtils.dfs.mkdirs(root, new FsPermission((short) 0777));
      GridmixTestUtils.dfs.setPermission(root, new FsPermission((short) 0777));
      int res = ToolRunner.run(conf, client, argv);
      assertEquals("Client exited with nonzero status", 0, res);
      client.checkMonitor();
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.apache.hadoop.fs.permission.FsPermission

          if (FileNotPresentForThisDirectoryPath)
            continue;

          Path pathMapredLocalDirUserName =
              fileStatusMapredLocalDirUserName.getPath();
          FsPermission fsPermMapredLocalDirUserName =
              fileStatusMapredLocalDirUserName.getPermission();
          Assert.assertTrue("Directory Permission is not 700",
            fsPermMapredLocalDirUserName.equals(new FsPermission("700")));

          //Get file status of all the directories
          //and files under that path.
          FileStatus[] fileStatuses = tClient.listStatus(localDir,
              true, true);
          for (FileStatus  fileStatus : fileStatuses) {
            Path path = fileStatus.getPath();
            LOG.info("path is :" + path.toString());
            //Checking if the received path ends with
            //the distributed filename
            distCacheFileIsFound = (path.toString()).
                endsWith(distributedFileName);
            //If file is found, check for its permission.
            //Since the file is found break out of loop
            if (distCacheFileIsFound){
              LOG.info("PATH found is :" + path.toString());
              distributedFileCount++;
              String filename = path.getName();
              FsPermission fsPerm = fileStatus.getPermission();
              Assert.assertTrue("File Permission is not 777",
                fsPerm.equals(new FsPermission("777")));
            }
          }
        }

        LOG.info("Distributed File count is :" + distributedFileCount);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.