public static CertificateRepo createRepository(String type, LdapSearch ldapSearch,
LdapSchemaConfig ldapSchemaConfig, String rootDN,
String storageDir) {
if ("ldap".equals(type)) {
return new LdapCertificateRepo(ldapSearch, ldapSchemaConfig, rootDN);
} else if ("file".equals(type)) {
return new FileCertificateRepo(storageDir);
} else {
throw new RuntimeException("Invalid repo type " + type + ". Valid types are file, ldap");
}