private static void setupUsers(DaoFactory factory, String gridId, File baseDir) throws Exception { baseDir = new File(new File(new File(baseDir, "grids"), gridId), "users"); UserDao dao = factory.createUserDao(); for (File f : baseDir.listFiles(new RegexFileNameFilter(".*\\.json$"))) { User u = new LangridJSON(baseDir, FilenameUtil.getIdFromFileName(f)) .parse(new FileInputStream(f), User.class); u.setPassword(MessageDigestUtil.digestBySHA512(u.getPassword())); dao.addUser(u); } }
private static void clearAll(DaoFactory factory) throws Exception { factory.createServiceDao().clear(); factory.createResourceDao().clear(); factory.createUserDao().clear(); factory.createGridDao().clear(); }