class NodeSchemaManager {

  public String complete(String path) {
    if (!enforcePrefix) {
      return null;
    }
    String normalizedPath = NetUtils.normalize(path);
    String[] subPath = normalizedPath.split(NetConstants.PATH_SEPARATOR_STR);
    if ((subPath.length) == maxLevel) {
      return path;
    }
    StringBuffer newPath = new StringBuffer(NetConstants.ROOT);
    // skip the ROOT and LEAF layer
    int i, j;
    for (i = 1, j = 1; i < subPath.length && j < (allSchema.size() - 1);) {
      if (allSchema.get(j).matchPrefix(subPath[i])) {
        newPath.append(NetConstants.PATH_SEPARATOR_STR + subPath[i]);
        i++;
        j++;
      } else {
        newPath.append(allSchema.get(j).getDefaultName());
        j++;
      }
    }
    if (i == (subPath.length - 1)) {
      newPath.append(NetConstants.PATH_SEPARATOR_STR + subPath[i]);
      return newPath.toString();
    }
    return null;
  }

  private  NodeSchemaManager();

}