Search in sources :

Example 16 with Reference

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);
}
Also used : X509ExtendedTrustManager(javax.net.ssl.X509ExtendedTrustManager) Reference(org.osgi.service.component.annotations.Reference)

Example 17 with Reference

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);
                    }
                }
            }
        }
    }
}
Also used : ThingActionsScope(org.eclipse.smarthome.core.thing.binding.ThingActionsScope) ModuleType(org.eclipse.smarthome.automation.type.ModuleType) ModuleInformation(org.eclipse.smarthome.automation.module.core.provider.ModuleInformation) Reference(org.osgi.service.component.annotations.Reference)

Example 18 with Reference

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);
                }
            }
        }
    }
}
Also used : ModuleType(org.eclipse.smarthome.automation.type.ModuleType) ModuleInformation(org.eclipse.smarthome.automation.module.core.provider.ModuleInformation) Reference(org.osgi.service.component.annotations.Reference)

Aggregations

Reference (org.osgi.service.component.annotations.Reference)18 ArrayList (java.util.ArrayList)4 BundleContext (org.osgi.framework.BundleContext)4 IOException (java.io.IOException)2 Hashtable (java.util.Hashtable)2 List (java.util.List)2 ModuleInformation (org.eclipse.smarthome.automation.module.core.provider.ModuleInformation)2 ModuleType (org.eclipse.smarthome.automation.type.ModuleType)2 ServiceReference (org.osgi.framework.ServiceReference)2 DeclarativeServicesAnnotationError (aQute.bnd.component.error.DeclarativeServicesAnnotationError)1 Annotation (aQute.bnd.osgi.Annotation)1 Clazz (aQute.bnd.osgi.Clazz)1 TypeRef (aQute.bnd.osgi.Descriptors.TypeRef)1 LocalizationUtils (com.adobe.cq.wcm.core.components.internal.LocalizationUtils)1 LinkHandler (com.adobe.cq.wcm.core.components.internal.link.LinkHandler)1 PageListItemImpl (com.adobe.cq.wcm.core.components.internal.models.v1.PageListItemImpl)1 SearchImpl (com.adobe.cq.wcm.core.components.internal.models.v1.SearchImpl)1 PN_FRAGMENT_VARIATION_PATH (com.adobe.cq.wcm.core.components.models.ExperienceFragment.PN_FRAGMENT_VARIATION_PATH)1 ListItem (com.adobe.cq.wcm.core.components.models.ListItem)1 Search (com.adobe.cq.wcm.core.components.models.Search)1