class FileStatusTreeTraverser extends TreeTraverser<FileStatus> {

  @Override
  public Iterable<FileStatus> children(FileStatus root) {
    if (root.isFile()) {
      return ImmutableList.of();
    }
    try {
      FileStatus[] listStatus = fileSystem.listStatus(root.getPath());
      if (listStatus == null || listStatus.length == 0) {
        return ImmutableList.of();
      }
      return ImmutableList.copyOf(listStatus);
    } catch (IOException e) {
      throw new CircusTrainException("Unable to list children for path: " + root.getPath());
    }
  }

    FileStatusTreeTraverser(FileSystem fileSystem);

}