use of org.eclipse.smarthome.automation.module.core.provider.ModuleInformation in project smarthome by eclipse.
the class AnnotatedActionModuleTypeProvider method addActionProvider.
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addActionProvider(AnnotatedActions actionProvider, Map<String, Object> properties) {
Collection<ModuleInformation> moduleInformations = helper.parseAnnotations(actionProvider);
String configName = getConfigNameFromService(properties);
for (ModuleInformation mi : moduleInformations) {
mi.setConfigName(configName);
ModuleType oldType = null;
if (this.moduleInformation.containsKey(mi.getUID())) {
oldType = helper.buildModuleType(mi.getUID(), this.moduleInformation);
Set<ModuleInformation> availableModuleConfigs = this.moduleInformation.get(mi.getUID());
availableModuleConfigs.add(mi);
} else {
Set<ModuleInformation> configs = ConcurrentHashMap.newKeySet();
configs.add(mi);
this.moduleInformation.put(mi.getUID(), configs);
}
ModuleType mt = helper.buildModuleType(mi.getUID(), this.moduleInformation);
if (mt != null) {
for (ProviderChangeListener<ModuleType> l : changeListeners) {
if (oldType != null) {
l.updated(this, oldType, mt);
} else {
l.added(this, mt);
}
}
}
}
}
Aggregations