Class AbstractComponentManager<S>

    • Constructor Detail

      • AbstractComponentManager

        protected AbstractComponentManager​(ComponentContainer<S> container,
                                           ComponentMethods<S> componentMethods)
        The constructor receives both the container and the methods.
        Parameters:
        container - The component container
        componentMethods - The component methods
      • AbstractComponentManager

        protected AbstractComponentManager​(ComponentContainer<S> container,
                                           ComponentMethods<S> componentMethods,
                                           boolean factoryInstance)
        The constructor receives both the container and the methods.
        Parameters:
        container - The component container
        componentMethods - The component methods
        factoryInstance - Flag whether this is a factory instance
    • Method Detail

      • enable

        public final org.osgi.util.promise.Promise<Void> enable​(boolean async)
      • disable

        public final org.osgi.util.promise.Promise<Void> disable​(boolean async)
      • dispose

        public void dispose​(int reason)
        Disposes off this component deactivating and disabling it first as required. After disposing off the component, it may not be used anymore.

        This method unlike the other state change methods immediately takes action and disposes the component. The reason for this is, that this method has to actually complete before other actions like bundle stopping may continue.

      • getBundle

        public org.osgi.framework.Bundle getBundle()
        Returns the Bundle providing this component. If the component as already been disposed off, this method returns null.
      • isImmediate

        protected boolean isImmediate()
      • isFactory

        public boolean isFactory()
      • deleteComponent

        protected abstract void deleteComponent​(int reason)
      • getProvidedServices

        protected String[] getProvidedServices()
      • registerService

        protected boolean registerService()
        Registers the service on behalf of the component.
      • unregisterService

        protected boolean unregisterService()
      • getServiceRegistration

        protected org.osgi.framework.ServiceRegistration<S> getServiceRegistration()
      • collectDependencies

        protected boolean collectDependencies​(ComponentContextImpl<S> componentContext)
        Collect and store in m_dependencies_map all the services for dependencies, outside of any locks.
        Parameters:
        componentContext - possible instance key for prototype scope references
        Returns:
        true if all references can be collected, false if some dependency is no longer available.
      • verifyDependencyManagers

        protected boolean verifyDependencyManagers()
      • setServiceProperties

        public abstract void setServiceProperties​(Dictionary<String,​?> serviceProperties)
      • getServiceProperties

        public Dictionary<String,​Object> getServiceProperties()
        Returns the subset of component properties to be used as service properties. These properties are all component properties where property name does not start with dot (.), properties which are considered private.
      • copyTo

        protected static Dictionary<String,​Object> copyTo​(Dictionary<String,​Object> target,
                                                                Map<String,​?> source,
                                                                boolean allProps)
        Copies the properties from the source Dictionary into the target Dictionary except for private properties (whose name has a leading dot) which are only copied if the allProps parameter is true.
        Parameters:
        target - The Dictionary into which to copy the properties. If null a new Hashtable is created.
        source - The Dictionary providing the properties to copy. If null or empty, nothing is copied.
        allProps - Whether all properties (true) or only the public properties (false) are to be copied.
        Returns:
        The target is returned, which may be empty if source is null or empty and target was null or all properties are private and had not to be copied
      • copyToMap

        protected static Map<String,​Object> copyToMap​(Dictionary<String,​?> source,
                                                            boolean allProps)
        Copies the properties from the source Dictionary into the target Dictionary except for private properties (whose name has a leading dot) which are only copied if the allProps parameter is true.
        Parameters:
        source - The Dictionary providing the properties to copy. If null or empty, nothing is copied.
        allProps - Whether all properties (true) or only the public properties (false) are to be copied.
        Returns:
        The target is returned, which may be empty if source is null or empty and target was null or all properties are private and had not to be copied
      • setFailureReason

        public void setFailureReason​(Throwable e)
        Set the activation failure reason
        Parameters:
        e - The exception which caused the activation to fail
      • setServiceProperties

        public void setServiceProperties​(MethodResult methodResult,
                                         Integer trackingCount)
      • reconfigure

        public abstract void reconfigure​(Map<String,​Object> configuration,
                                         boolean configurationDeleted,
                                         TargetedPID factoryPid)