List<ServiceRegistration> configServices = new ArrayList<ServiceRegistration>();
List<Xfd> xfds = setup.getXfd();
Iterator<Xfd> iter = xfds.iterator();
while(iter.hasNext()){
try {
ExtremeFeedbackDeviceSetup efds = new ExtremeFeedbackDeviceSetup(iter.next());
// register each configuration
Hashtable<String,String> dict = new Hashtable<String,String>();
// right now, we only have cron triggered updates, but this might change
safePut(dict, Triggerable.UPDATE_TRIGGER_TYPE, "cron");
if(bundle == null) {
// manage the services exposed through none bundle related resources (no lifecycle)
ServiceRegistration sr = registerConfigurationAsService(efds, url, dict,
new String[]{IProjectSetup.class.getName(),Triggerable.class.getName()}, null);
configServices.add(sr);
} else {
// register with another bundle (as soon as that one disappears, the service goes as well)
ServiceRegistration sr = registerConfigurationAsService(efds, url, dict,
new String[]{IProjectSetup.class.getName(),Triggerable.class.getName()}, bundle.getBundleContext());
}
// trigger the configuration for the first time
try {
efds.updateIndicator();
} catch (Throwable t){
// anything could happen, so do not fail the rest of the execution
}
} catch (ProjectSetupException ex) {
LOG.warn("Problems setting up configuration file.",ex);