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 void readUsers(String fileName) {
   try {
     InputStream userIs = ConfigFinder.getInstance().open(fileName);
     if (userIs != null) {
       if (_log.isInfoEnabled()) {
         _log.info("Reading users file...");
       }
       readUsers(userIs);
     } else {
       if (_log.isInfoEnabled()) {
         _log.info("UserFile.xml does not exist -- no users or role");
       }
     }
   } catch (Exception e) {
     if (_log.isWarnEnabled()) {
       _log.warn("Couldn't load users from file: ", e);
     }
   }
 }
 public void readUsers() {
   String fileName = "UserFile-" + _domain + ".xml";
   readUsers(fileName);
 }