throw new IllegalArgumentException("Error initialising local index URL", e);
}
}
private void regenerateIndex() throws Exception {
BundleIndexer indexer = registry.getPlugin(BundleIndexer.class);
if (indexer == null)
throw new IllegalStateException("Cannot index repository: no Bundle Indexer service or plugin found.");
Set<File> allFiles = new HashSet<File>();
gatherFiles(allFiles);
FileOutputStream out = null;
try {
out = new FileOutputStream(localIndex);
if (!allFiles.isEmpty()) {
Map<String, String> config = new HashMap<String, String>();
config.put(BundleIndexer.REPOSITORY_NAME, this.getName());
config.put(BundleIndexer.ROOT_URL, localIndex.getCanonicalFile().toURI().toURL().toString());
indexer.index(allFiles, out, config);
} else {
ByteArrayInputStream emptyRepo = new ByteArrayInputStream("<?xml version='1.0' encoding='UTF-8'?>\n<repository lastmodified='0'/>".getBytes());
IO.copy(emptyRepo, out);
}
} finally {