Examples of Trash


Examples of jease.cms.domain.Trash

   * directly. If the given content is a Trash-Object, the Trash-Object is
   * deleted only when it is empty, otherwise the Trash will be emptied.
   */
  public static void delete(Content content) {
    if (content instanceof Trash) {
      Trash trash = (Trash) content;
      if (trash.isEmpty()) {
        Nodes.delete(trash);
      } else {
        for (Content child : trash.getChildren(Content.class)) {
          if (child.getParent() != null
              && Contents.isDeletable(child)) {
            delete(child);
          }
        }
        Nodes.save(trash);
      }
    } else {
      Trash trash = content.getParent() != null ? ((Content) content
          .getParent()).getGuard(Trash.class) : null;
      if (trash == null || content.isDescendant(trash)) {
        if (isDeletable(content)) {
          deleteReferences(content);
          Nodes.delete(content);
        }
      } else {
        trash.appendChild(content);
        Nodes.save(trash);
      }
    }
  }
View Full Code Here

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

Examples of org.apache.hadoop.fs.Trash

            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

Examples of org.apache.hadoop.fs.Trash

    }
  }

    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

Examples of org.apache.hadoop.fs.Trash

        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

Examples of org.apache.hadoop.fs.Trash

    }

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

Examples of org.apache.hadoop.fs.Trash

    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

Examples of org.apache.hadoop.fs.Trash

       
    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

Examples of org.apache.hadoop.fs.Trash

    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

Examples of org.apache.hadoop.fs.Trash

          @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
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.