// Create a background thread to process tasks added to the queue.
asynchronousDispatcher = new AsynchronousDispatcher();
// Create a container to the admin reference.
DelayedReferenceContainer delayedReferenceContainer =
new DelayedReferenceContainer();
PluginManager pluginManager =
new PluginManagerImpl(log);
Dispatcher dispatcher =
new DispatcherImpl(bundleContext, log, asynchronousDispatcher,
delayedReferenceContainer, pluginManager);
File rootDir = bundleContext.getDataFile("");
if (rootDir == null) {
throw new IOException(
"Cannot persist configuration as cannot access file" +
" system");
}
FileManager fileManager = new FileManagerImpl(
rootDir, MAX_FILES_PER_DIR, MAX_DIRS_PER_DIR);
ConfigurationStore store = new ConfigurationStoreImpl(fileManager);
ConfigurationManager manager =
new ConfigurationAdminManager(bundleContext,
log, dispatcher, store);
tracker = new ConfigurationServiceTracker(
bundleContext, manager,
pluginManager);
ServiceRegistration registration = bundleContext
.registerService(ConfigurationAdmin.class.getName(),
manager, null);
ServiceReference adminServiceReference = registration.getReference();
delayedReferenceContainer.setReference(adminServiceReference);
tracker.start();
}