} else {
pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
}
pw.print(Schema.XML_PROCESSING_INSTRUCTION);
Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
String repoName = config.get(REPOSITORY_NAME);
if (repoName == null)
repoName = REPOSITORYNAME_DEFAULT;
repoTag.addAttribute(Schema.ATTR_NAME, repoName);
String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
if (increment == null)
increment = Long.toString(System.currentTimeMillis());
repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
repoTag.printOpen(indent, pw, false);
for (File file : filesToIndex) {
try {
Tag resourceTag = generateResource(file, config);
resourceTag.print(indent.next(), pw);
} catch (Exception e) {
log(LogService.LOG_WARNING, MessageFormat.format("Could not index {0}, skipped ({1}).", file, e.getMessage()), null);
}
}
repoTag.printClose(indent, pw);