RepositoryDefinition repoDef = new RepositoryDefinition(repositoryName, RepositoryLifecycleState.CREATE_REQUESTED);
byte[] repoBytes = RepositoryDefinitionJsonSerDeser.INSTANCE.toJsonBytes(repoDef);
try {
zk.create(REPOSITORY_COLLECTION_PATH + "/" + repositoryName, repoBytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
} catch (KeeperException.NodeExistsException e) {
throw new RepositoryExistsException("Can't create repository, a repository with this name already exists: "
+ repositoryName);
} catch (KeeperException e) {
throw new RepositoryModelException(e);
}
}