Class ComponentRegistry

java.lang.Object
org.nuxeo.runtime.model.impl.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 Details

    • 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

      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
    • aliases

      protected Map<ComponentName,ComponentName> aliases
      Map of aliased name to canonical name.
    • 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.
  • Constructor Details

    • ComponentRegistry

      public ComponentRegistry()
    • ComponentRegistry

      public ComponentRegistry(ComponentRegistry reg)
  • Method Details

    • 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
    • removeComponent

      public RegistrationInfo removeComponent(ComponentName name)
    • getResolvedRegistrationInfo

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

      public Collection<ComponentName> getResolvedNames()
      Returns:
      an unmodifiable collection of resolved component names, 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.
    • getPendingComponents

      public Map<ComponentName,Set<ComponentName>> getPendingComponents()
      Returns:
      an unmodifiable map of pending components
    • unaliased

      protected ComponentName unaliased(ComponentName name)
    • 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.
    • resolveComponent

      protected void resolveComponent(RegistrationInfo ri)
    • unresolveComponent

      protected void unresolveComponent(RegistrationInfo ri)