Class ComponentFactoryImpl<S>

  • All Implemented Interfaces:
    SimpleLogger, ComponentContainer<S>, ComponentManager<S>, org.osgi.service.component.ComponentFactory

    public class ComponentFactoryImpl<S>
    extends AbstractComponentManager<S>
    implements org.osgi.service.component.ComponentFactory, ComponentContainer<S>
    The ComponentFactoryImpl extends the AbstractComponentManager class to implement the component factory functionality. As such the OSGi Declarative Services ComponentFactory interface is implemented.

    In addition the ComponentHolder interface is implemented to use this class directly as the holder for component instances created by the newInstance(Dictionary) method.

    This class implements spec-compliant component factories and the felix "persistent" component factory, where the factory is always registered whether or not all dependencies are present and the created components also persist whether or not the dependencies are present to allow the component instance to exist.

    • Field Detail

      • m_changeCount

        protected volatile long m_changeCount
        Configuration change count (R5) or imitation (R4)
    • Method Detail

      • newInstance

        public org.osgi.service.component.ComponentInstance newInstance​(Dictionary<String,​?> dictionary)
        Specified by:
        newInstance in interface org.osgi.service.component.ComponentFactory
      • equals

        public boolean equals​(Object object)
        Compares this ComponentFactoryImpl object to another object.

        A component factory impl is considered to be equal to another component factory impl if the component names are equal(using String.equals).

        Overrides:
        equals in class Object
        Parameters:
        object - The ComponentFactoryImpl object to be compared.
        Returns:
        true if object is a ComponentFactoryImpl and is equal to this object; false otherwise.
      • hashCode

        public int hashCode()
        Returns a hash code value for the object.
        Overrides:
        hashCode in class Object
        Returns:
        An integer which is a hash code value for this object.
      • deleteComponent

        protected void deleteComponent​(int reason)
        The component factory does not have a component to delete.

        But in the backwards compatible case any instances created for factory configuration instances are to disabled as a consequence of deactivating the component factory.

        Specified by:
        deleteComponent in class AbstractComponentManager<S>
      • hasConfiguration

        public boolean hasConfiguration()
      • collectDependencies

        protected boolean collectDependencies​(ComponentContextImpl<S> componentContext)
        Description copied from class: AbstractComponentManager
        Collect and store in m_dependencies_map all the services for dependencies, outside of any locks.
        Overrides:
        collectDependencies in class AbstractComponentManager<S>
        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.
      • getComponentInstance

        public org.osgi.service.component.ComponentInstance getComponentInstance()
      • dispose

        public void dispose​(int reason)
        Disposes off all components ever created by this component holder. This method is called if either the Declarative Services runtime is stopping or if the owning bundle is stopped. In both cases all components created by this holder must be disposed off.
        Overrides:
        dispose in class AbstractComponentManager<S>