Class DependencyGraph

java.lang.Object
org.apache.felix.dm.diagnostics.DependencyGraph

public class DependencyGraph extends Object
The dependency graph is a view of all components managed by the dependency manager and of their dependencies. Using this API you can get the dependencies of a given component, the components providing a given service, the circular dependencies that might exist.
Author:
Felix Project Team
  • Method Details

    • getGraph

      public static DependencyGraph getGraph(DependencyGraph.ComponentState componentState, DependencyGraph.DependencyState dependencyState)
      Build the dependency graph. It will contain all the components managed by the dependency manager, provided that those components are in the given state, and all dependencies of their dependencies, provided that the dependencies are in the given state.

      This implementation currently only builds a graph of unregistered components and required unavailable dependencies.

      Parameters:
      componentState - Include only the components in this state
      dependencyState - Include only the dependencies in this state
      Returns:
    • getAllComponents

      public List<ComponentDeclaration> getAllComponents()
      Returns the list of components in the graph
      Returns:
      the list of components in the graph
    • getAllDependencies

      public List<ComponentDependencyDeclaration> getAllDependencies()
      Returns a list all dependencies in the graph
      Returns:
      the list of all dependencies in the graph
    • getDependecies

      public List<ComponentDependencyDeclaration> getDependecies(ComponentDeclaration componentDeclaration)
      For a given component declaration, it returns a list of its dependencies in the state specified when the graph was built.
      Parameters:
      componentDeclaration -
      Returns:
      the list of dependencies or null if the component declaration is not in the graph
    • getProviders

      public List<ComponentDeclaration> getProviders(ComponentDependencyDeclaration dependency)
      Returns the list of components that provide the given dependency. This only returns the components managed by the dependency manager that are in the state specified when the graph was built. The dependency can only be a service dependency.
      Parameters:
      dependency -
      Returns:
      the list of components providing this dependency or null if the dependency declaration is not in the graph
    • getCircularDependencies

      public List<CircularDependency> getCircularDependencies()
      Returns the list of circular dependencies in the graph
      Returns:
      the list of circular dependencies
    • getMissingDependencies

      public List<MissingDependency> getMissingDependencies(String type)
      Returns all the missing dependencies of a given type.
      Parameters:
      type - The type of the dependencies to be returned. This can be either one of the types known by the DependencyManager (service, bundle, configuration, resource), a user defined type or null, in which case all missing dependencies must be returned.
      Returns:
      The missing dependencies of the given type or all the missing dependencies.
    • getMissingCustomDependencies

      public List<MissingDependency> getMissingCustomDependencies()
      Returns all custom missing dependencies. Custom dependencies are not 'out of the box' dependencies (service, resource, bundle, configuration).
      Returns:
      The missing dependencies which are not 'out of the box dependencies'.