Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.Trash


  public FsShell(Configuration configuration, FileSystem fs) {
    this.configuration = configuration;
    try {
      this.fs = (fs != null ? fs : FileSystem.get(configuration));
      this.internalFs = (fs == null);
      this.trash = new Trash(configuration);
    } catch (IOException ex) {
      throw new HadoopException("Cannot create shell " + ex.getMessage(), ex);
    }
  }
View Full Code Here


            throw new IllegalStateException("Cannot remove directory \"" + src
                + "\", if recursive deletion was not specified");
          }
          if (!skipTrash) {
            try {
              Trash trashTmp = new Trash(srcFs, configuration);
              trashTmp.moveToTrash(p);
            } catch (IOException ex) {
              throw new HadoopException("Cannot move to Trash resource " + p, ex);
            }
          }
          srcFs.delete(p, recursive);
View Full Code Here

    }
  }

    public static void moveToTrash(Configuration conf, Path path)
      throws IOException {
  Trash t = new Trash(conf);
  boolean isMoved = t.moveToTrash(path);
  t.expunge();
  if (!isMoved) {
      logger.error("Trash is not enabled or file is already in the trash.");
  }
    }
View Full Code Here

        conf, DFSConfigKeys.DFS_NAMENODE_PLUGINS_KEY, NamenodePlugin.class);
    pluginDispatcher.dispatchStart(this);
  }

  private void startTrashEmptier(Configuration conf) throws IOException {
    this.emptier = new Thread(new Trash(conf).getEmptier(), "Trash Emptier");
    this.emptier.setDaemon(true);
    this.emptier.start();
  }
View Full Code Here

    }

    @Override
    protected void processArguments(LinkedList<PathData> args)
    throws IOException {
      Trash trash = new Trash(getConf());
      trash.expunge();
      trash.checkpoint();   
    }
View Full Code Here

    try {
      this.namesystem = new FSNamesystem(this.nameNodeAddress.getHostName(), this.nameNodeAddress.getPort(), this, conf);
      this.server.start()//start RPC server  
 
      this.emptier = new Thread(new Trash(conf).getEmptier(), "Trash Emptier");
      this.emptier.setDaemon(true);
      this.emptier.start();
    } catch (IOException e) {
      this.server.stop();
      throw e;
View Full Code Here

       
    try {
      this.namesystem = new FSNamesystem(this.nameNodeAddress.getHostName(), this.nameNodeAddress.getPort(), this, conf);
      this.server.start()//start RPC server  
 
      this.emptier = new Thread(new Trash(conf).getEmptier(), "Trash Emptier");
      this.emptier.setDaemon(true);
      this.emptier.start();
    } catch (IOException e) {
      this.server.stop();
      throw e;
View Full Code Here

    LOG.info("deleting  " + f);
    try {
      if(!fs.exists(f)) {
        return false;
      }
      Trash trashTmp = new Trash(fs.getConf());
      if (trashTmp.moveToTrash(f)) {
        LOG.info("Moved to trash: " + f);
        return true;
      }
      if (fs.delete(f, true)) {
        LOG.info("Deleted the diretory " + f);
View Full Code Here

          @Override
          public FileSystem run() throws IOException {
            return FileSystem.get(conf);
          }
        });
    this.emptier = new Thread(new Trash(fs, conf).getEmptier(), "Trash Emptier");
    this.emptier.setDaemon(true);
    this.emptier.start();
  }
View Full Code Here

       
    try {
      this.namesystem = new FSNamesystem(this.nameNodeAddress.getHostName(), this.nameNodeAddress.getPort(), this, conf);
      this.server.start()//start RPC server  
 
      this.emptier = new Thread(new Trash(conf).getEmptier(), "Trash Emptier");
      this.emptier.setDaemon(true);
      this.emptier.start();
    } catch (IOException e) {
      this.server.stop();
      throw e;
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.Trash

Copyright © 2018 www.massapicom. 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.