in src/main/java/org/apache/sling/jcr/repoinit/impl/RepositoryInitializer.java [97:127]
public void processRepository(SlingRepository repo) throws RepositoryException {
if (config.references() != null && config.references().length > 0) {
// loginAdministrative is ok here, definitely an admin operation
@SuppressWarnings("deprecation")
final Session s = repo.loginAdministrative(null);
try {
Instant start = Instant.now();
final RepoinitTextProvider p = new RepoinitTextProvider();
for (String reference : config.references()) {
try {
final String repoinitText = p.getRepoinitText(reference);
final List<Operation> ops;
try (StringReader sr = new StringReader(repoinitText)) {
ops = parser.parse(sr);
}
log.info("Executing {} repoinit operations from {}", ops.size(), reference);
processor.apply(s, ops);
if (s.hasPendingChanges()) {
s.save();
}
} catch (IOException | RuntimeException | RepositoryException | RepoInitParsingException e) {
throw new RepoInitException("Error executing repoinit from " + reference, e);
}
}
Duration duration = Duration.between(start, Instant.now());
log.info("Total time for successful repoinit execution: {} miliseconds", duration.toMillis());
} finally {
s.logout();
}
}
}