if (installInitialModuleCapability(configcap))
iterator.remove();
}
final Set<ServiceName> resolvableServices = new LinkedHashSet<ServiceName>();
AutoInstallComplete installComplete = new AutoInstallComplete() {
@Override
protected boolean allServicesAdded(Set<ServiceName> trackedServices) {
return configcaps.size() == trackedServices.size();
}
@Override
public void start(StartContext context) throws StartException {
// Resolve all bundles up until and including the Framework beginning start level
Set<Bundle> resolvableBundles = new LinkedHashSet<Bundle>();
ServiceContainer serviceContainer = context.getController().getServiceContainer();
for (ServiceName serviceName : resolvableServices) {
ServiceController<?> requiredService = serviceContainer.getRequiredService(serviceName);
resolvableBundles.add((Bundle) requiredService.getValue());
}
Bundle[] bundleArr = resolvableBundles.toArray(new Bundle[resolvableBundles.size()]);
PackageAdmin packageAdmin = injectedPackageAdmin.getValue();
packageAdmin.resolveBundles(bundleArr);
super.start(context);
}
};
installComplete.install(context.getChildTarget());
ServiceListener<Bundle> listener = installComplete.getListener();
for (OSGiCapability configcap : configcaps) {
ServiceName serviceName = installInitialCapability(configcap, listener);
int startLevel = configcap.getStartLevel() != null ? configcap.getStartLevel() : 1;
if (serviceName != null && startLevel <= beginningStartLevel) {