use of org.osgi.service.component.annotations.Reference in project smarthome by eclipse.
the class ExtensibleTrustManagerImpl method addTlsCertificateProvider.
@Override
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addTlsCertificateProvider(TlsCertificateProvider tlsCertificateProvider) {
X509ExtendedTrustManager trustManager = new TlsCertificateTrustManagerAdapter(tlsCertificateProvider).getTrustManager();
mappingFromTlsCertificateProvider.put(tlsCertificateProvider, trustManager);
addLinkedTrustManager(tlsCertificateProvider.getHostName(), trustManager);
}
use of org.osgi.service.component.annotations.Reference in project smarthome by eclipse.
the class AnnotatedThingActionModuleTypeProvider method addAnnotatedThingActions.
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
public void addAnnotatedThingActions(ThingActions annotatedThingActions) {
if (annotatedThingActions.getClass().isAnnotationPresent(ThingActionsScope.class)) {
ThingActionsScope scope = annotatedThingActions.getClass().getAnnotation(ThingActionsScope.class);
Collection<ModuleInformation> moduleInformations = helper.parseAnnotations(scope.name(), annotatedThingActions);
String thingUID = annotatedThingActions.getThingHandler().getThing().getUID().getAsString();
for (ModuleInformation mi : moduleInformations) {
mi.setThingUID(thingUID);
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);
}
}
}
}
}
}
use of org.osgi.service.component.annotations.Reference 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