Class DependencyResolver
java.lang.Object
org.pf4j.DependencyResolver
This class builds a dependency graph for a list of plugins (descriptors).
The entry point is the
resolve(List) method, method that returns a DependencyResolver.Result object.
The Result class contains nice information about the result of resolve operation (if it's a cyclic dependency,
they are not found dependencies, they are dependencies with wrong version).
This class is very useful for if-else scenarios.
Only some attributes (pluginId, dependencies and pluginVersion) from PluginDescriptor are used in
the process of resolve operation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classIt will be thrown if a cyclic dependency is detected.static classIndicates that the dependencies required were not found.static classIndicates that some dependencies have wrong version.static classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DirectedGraph<String> private DirectedGraph<String> private static final org.slf4j.Loggerprivate booleanprivate VersionManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddPlugin(PluginDescriptor descriptor) protected booleancheckDependencyVersion(String requiredVersion, String existingVersion) Check if an existing version of dependency is compatible with the required version (from plugin descriptor).private voidgetDependencies(String pluginId) Retrieves the plugins ids that the given plugin id directly depends on.private StringgetDependencyVersionSupport(PluginDescriptor dependent, String dependencyId) getDependents(String pluginId) Retrieves the plugins ids that the given content is a direct dependency of.resolve(List<PluginDescriptor> plugins)
-
Field Details
-
log
private static final org.slf4j.Logger log -
versionManager
-
dependenciesGraph
-
dependentsGraph
-
resolved
private boolean resolved
-
-
Constructor Details
-
DependencyResolver
-
-
Method Details
-
resolve
-
getDependencies
-
getDependents
-
checkDependencyVersion
-
addPlugin
-
checkResolved
private void checkResolved() -
getDependencyVersionSupport
-