Esempio n. 1
0
  /** Create directory entries for every item */
  boolean mkdirs(String src) {
    src = normalizePath(new UTF8(src));

    // Use this to collect all the dirs we need to construct
    Vector v = new Vector();

    // The dir itself
    v.add(src);

    // All its parents
    String parent = DFSFile.getDFSParent(src);
    while (parent != null) {
      v.add(parent);
      parent = DFSFile.getDFSParent(parent);
    }

    // Now go backwards through list of dirs, creating along
    // the way
    boolean lastSuccess = false;
    int numElts = v.size();
    for (int i = numElts - 1; i >= 0; i--) {
      String cur = (String) v.elementAt(i);
      INode inserted = unprotectedMkdir(cur);
      if (inserted != null) {
        logEdit(OP_MKDIR, new UTF8(inserted.computeName()), null);
        lastSuccess = true;
      } else {
        lastSuccess = false;
      }
    }
    return lastSuccess;
  }
Esempio n. 2
0
 String computeName() {
   if (parent != null) {
     return parent.computeName() + "/" + name;
   } else {
     return name;
   }
 }