in repository/service/src/main/java/org/apache/karaf/cave/repository/service/RepositoryServiceImpl.java [171:209]
public Repository create(String name, String location, String url, String proxy, boolean mirror, String realm, String downloadRole, String uploadRole, String scheduling, String schedulingAction, int poolSize) throws Exception {
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("Repository name is mandatory");
}
if (repositories.get(name) != null) {
throw new IllegalArgumentException("Repository " + name + " already exists");
}
if (url == null || url.isEmpty()) {
url = httpContext + "/" + name;
}
if (location == null || location.isEmpty()) {
location = new File(baseStorage, name).getAbsolutePath();
}
// create the repository storage
if (location != null && !location.isEmpty() && !Files.exists(Paths.get(location))) {
Files.createDirectories(Paths.get(location));
}
// create the repository model
Repository repository = new Repository();
repository.setName(name);
repository.setLocation(location);
repository.setUrl(url);
repository.setProxy(proxy);
repository.setMirror(mirror);
repository.setRealm(realm);
repository.setDownloadRole(downloadRole);
repository.setUploadRole(uploadRole);
repository.setPoolSize(poolSize);
repository.setScheduling(scheduling);
repository.setSchedulingAction(schedulingAction);
repositories.put(name, repository);
// register the repository servlet
registerMavenServlet(repository);
// optionally register the repository scheduling job
scheduleRepository(repository);
// update repositories DB
save();
return repository;
}