public static void createResource(Resource resource,
      FileSystem dfs, Path pathHadoop) throws IOException {

    boolean isCreate = (resource.getSource() == null) ? true : false;

    if (isCreate && resource.getType().equals("directory")) {
      dfs.mkdirs(pathHadoop); // empty dir(s)
    } else if (isCreate && resource.getType().equals("file")) {
      dfs.createNewFile(pathHadoop); // empty file
    } else {
      if(dfs.exists(pathHadoop) && dfs.getFileStatus(pathHadoop).isDir()) {
        System.out.println("Skipping copy from local, as target " + pathHadoop + " is an existing directory."); // Copy from local to existing directory is not supported by dfs.
      } else {
        dfs.copyFromLocalFile(new Path(resource.getSource()), pathHadoop);
      }
    }
  }
Used to:
  1) copy files/directories from localFS to hadoopFs
  2) create empty
  3) download files/directories from hadoopFs to localFS
files/directories in hadoopFs
contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Resource.java