framework.start();
// Look for indexer and run index generation
ServiceTracker tracker = new ServiceTracker(framework.getBundleContext(), ResourceIndexer.class.getName(), null);
tracker.open();
ResourceIndexer index = (ResourceIndexer) tracker.waitForService(1000);
if (index == null)
throw new IllegalStateException("Timed out waiting for ResourceIndexer service.");
// Process arguments
Set<File> fileList = new LinkedHashSet<File>();
Map<String, String> config = new HashMap<String, String>();
File outputFile = processArgs(args, System.err, config, fileList, framework.getBundleContext());
if (outputFile == null) {
System.exit(1);
}
boolean verbose = Boolean.parseBoolean(config.get(ResourceIndexer.VERBOSE));
if (verbose) {
printCopyright(System.err);
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream(outputFile);
index.index(fileList, fos, config);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fos != null) {
try {