Class ComponentRegistry


  • public class ComponentRegistry
    extends Object
    This class is synchronized to safely update and access the different maps managed by the registry
    Author:
    Bogdan Stefanescu
    • Field Detail

      • components

        protected Map<ComponentName,​RegistrationInfo> components
        All registered components including unresolved ones. You can check the state of a component for getting the unresolved ones.
      • resolved

        protected LinkedHashMap<ComponentName,​RegistrationInfo> resolved
        The list of resolved components. We need to use a linked hash map preserve the resolve order. We don't use a simple list to optimize removal by name (used by unregister operations).
        Since:
        9.2
      • requirements

        protected ComponentRegistry.MappedSet requirements
        Maps a component name to a set of component names that are depending on that component. Values are always unaliased.
      • pendings

        protected ComponentRegistry.MappedSet pendings
        Map pending components to the set of unresolved components they are waiting for. Key is always unaliased.
      • deployedFiles

        protected Map<String,​ComponentName> deployedFiles
        Map deployment source ids to component names This was previously managed by DefaultRuntimeContext - but is no more usable in the original form. This map is only useful for unregister by location - which is used by some tests. Remove this if the unregister API will be removed.
        Since:
        9.2
    • Constructor Detail

      • ComponentRegistry

        public ComponentRegistry()
    • Method Detail

      • destroy

        public void destroy()
      • isResolved

        public final boolean isResolved​(ComponentName name)
      • addComponent

        public boolean addComponent​(RegistrationInfo ri)
        Returns:
        true if the component was resolved, false if the component is pending
      • getResolvedRegistrationInfo

        public Collection<RegistrationInfo> getResolvedRegistrationInfo()
        Returns:
        an unmodifiable collection of resolved registration infos, sorted by LinkedHashMap
        Since:
        9.2
      • getMissingDependencies

        public Set<ComponentName> getMissingDependencies​(ComponentName name)
        Returns:
        an unmodifiable collection of missing dependencies
        Since:
        9.2
      • getComponent

        public RegistrationInfo getComponent​(ComponentName name)
        Get the registration info for the given component name or null if none was registered.
        Since:
        9.2
      • contains

        public boolean contains​(ComponentName name)
        Check if the component is already registered against this registry
      • size

        public int size()
        Get the registered components count
      • getComponents

        public Collection<RegistrationInfo> getComponents()
        Returns:
        an unmodifiable collection of registered components
      • getComponentsArray

        public RegistrationInfo[] getComponentsArray()
        Get a copy of the registered components as an array.
      • computePendings

        protected final boolean computePendings​(RegistrationInfo ri)
        Fill the pending map with all unresolved dependencies of the given component. Returns false if no unresolved dependencies are found, otherwise returns true.
      • unresolveComponent

        protected void unresolveComponent​(RegistrationInfo ri)