// Check if there is an already existing installer
// This is certainly the case when a bundle has been stopped and is restarted.
installer = installers.get(bundle);
if (installer == null) {
URL url = bundle.getResource(DescriptorFactory.DESCRIPTOR_FILE);
Descriptor descriptor = DescriptorFactory.buildDescriptor(url);
DescriptorFactory.checkDescriptor(descriptor);
if (descriptor.getSharedLibrary() != null) {
LOGGER.info("Deploying bundle '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "' as a JBI shared library");
installer = new SharedLibraryInstaller(this, descriptor, null, true);
} else if (descriptor.getComponent() != null) {
LOGGER.info("Deploying bundle '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "' as a JBI component");
installer = new ComponentInstaller(this, descriptor, null, true);
} else if (descriptor.getServiceAssembly() != null) {
LOGGER.info("Deploying bundle '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "' as a JBI service assembly");
installer = new ServiceAssemblyInstaller(this, descriptor, (File) null, true);
} else {
throw new IllegalStateException("Unrecognized JBI descriptor: " + url);
}