private void buildDigestedUserFile(String args[]) {
    // Parse command-line arguments.
    String domain = null;
    String fileName = null;
    for (int i = 0; i < args.length; i++) {
      if (args[i].equals("-d")) {
        if (++i == args.length) {
          usage();
        }
        domain = args[i];
      } else if (args[i].equals("-f")) {
        if (++i == args.length) {
          usage();
        }
        fileName = args[i];
      }
    }
    if (fileName == null) {
      fileName = "UserFile-" + domain + ".xml";
    }

    // The UID is not important. Make a fake one.
    UID uid = UID.toUID("AgentA/1094690973044");
    UserEntries userCache = new UserEntries(uid);
    userCache.setDomain(domain);
    init(userCache);

    UserFileParser ufp = new UserFileParser(userCache);
    System.out.println("Reading user XML file...");
    ufp.readUsers("UserFile.xml");
    OutputStream os = null;
    try {
      os = new FileOutputStream(fileName);
    } catch (FileNotFoundException e) {
      usage();
    }
    System.out.println("Generating user XML file: " + fileName + " for domain: " + domain);
    ufp.saveUsersAndRoles(os);
    try {
      os.close();
    } catch (IOException e) {
      System.out.println("Unable to close file");
    }
  }
 public UserFileParser(UserEntries userCache) {
   init(userCache);
 }