Package com.hdfsTools.action

Source Code of com.hdfsTools.action.deleteAction

package com.hdfsTools.action;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;

import com.hdfsTools.dao.deleteDao;
import com.hdfsTools.impl.deleteImpl;

public class deleteAction extends BaseAction {

  public deleteAction() {
  }

  /**
   * Configuration
   *
   * @param fsUr
   *            url,example: hdfs://localhost:8889
   */
  /*
   * public deleteAction(String fsUrl){ super(fsUrl); }
   */

  public deleteAction(Configuration conf) {
    super(conf);
  }

  /**
   *
   * @param fileUrl
   *            url example: /user/test.txt
   * @return
   * @throws IOException
   */
  public boolean deleteFile(String fileUrl) throws IOException {

    deleteDao delete = new deleteImpl();
    return delete.deleteFile(getConf(), fileUrl);

  }

  /**
   *
   * @param directorUrl
   *            url ,example: /user
   * @return
   */
  public boolean deleteDirector(String directorUrl) {
    deleteDao delete = new deleteImpl();
    try {
      return delete.deleteDirector(getConf(), directorUrl);
    } catch (IOException e) {
      System.out.println("throw the IOEception...");
      return false;
    }
  }

  public static void main(String ars[]) throws IOException {

    deleteAction delete = new deleteAction();
    String dir = "/user/ll";
    delete.deleteFile(dir);

  }

}
TOP

Related Classes of com.hdfsTools.action.deleteAction

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.