Package biz.aQute.resolve
Class RunResolution
java.lang.Object
biz.aQute.resolve.RunResolution
Provides a simple way to resolve a project or bndrun file with support for
the
BndEditModel. Static methods are used to resolve and then this
class holds the different aspects of the result. Either with an exception or
the required and optional wiring.
The resolution also then provides convenience methods to link it to the projects
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaQute.bnd.result.Result<RunResolution>asResult()Return a result based on the isOk status.voidcache()Cache this resolution for the given project.static voidclearCache(aQute.bnd.build.Workspace ws) List<aQute.bnd.build.Container>Get a list of runbundles as containersTurn the wiring into a a->b map.List<org.osgi.resource.Resource>List<org.osgi.resource.Resource>getOrderedResources(Map<org.osgi.resource.Resource, List<org.osgi.resource.Wire>> resolution, aQute.bnd.help.instructions.ResolutionInstructions.Runorder runorder) List<aQute.bnd.osgi.BundleId>Gets the resolution result as a list of bundle ids that represent the new -runbundlesList<aQute.bnd.build.model.clauses.VersionedClause>Get a list of ordered run bundles.static aQute.bnd.result.Result<String>getRunBundles(aQute.bnd.build.Project project, boolean resolveIfNecessary) Get the run bundles from the cache and resolve if necessary.Return the current -runbundles.booleanisOK()Check if the resolution is ok, that is, there was no exception.report(boolean optionals) static RunResolutionresolve(aQute.bnd.build.Project project, aQute.bnd.osgi.Processor actualProperties, Collection<ResolutionCallback> callbacks) The main workhorse to resolvestatic RunResolutionresolve(aQute.bnd.build.Project project, aQute.bnd.osgi.Processor actualProperties, Collection<ResolutionCallback> callbacks, ResolverLogger resolverLogger) The main workhorse to resolvestatic RunResolutionresolve(aQute.bnd.build.Project project, Collection<ResolutionCallback> callbacks) The secondary workhorse to resolve.List<org.osgi.resource.Resource>sortByDependencies(Map<org.osgi.resource.Resource, List<org.osgi.resource.Wire>> resolution) Sort the resources based on their dependencies.booleanupdateBundles(aQute.bnd.build.model.BndEditModel model) Update theBndEditModelwith the calculated set of runbundles.voidupdateBundles(aQute.bnd.build.Project project)
-
Field Details
-
project
public final aQute.bnd.build.Project project -
properties
public final aQute.bnd.osgi.Processor properties -
required
-
optional
-
exception
-
log
-
runstartlevel
public final aQute.bnd.help.instructions.ResolutionInstructions.RunStartLevel runstartlevel
-
-
Method Details
-
resolve
public static RunResolution resolve(aQute.bnd.build.Project project, aQute.bnd.osgi.Processor actualProperties, Collection<ResolutionCallback> callbacks) The main workhorse to resolve- Parameters:
project- used for reporting errorsactualProperties- the actual properties used for resolving. This can be the project in builders that do not use theBndEditModel, otherwise it is generally theBndEditModel.callbacks- any callbacks- Returns:
- a Resolution
-
resolve
public static RunResolution resolve(aQute.bnd.build.Project project, aQute.bnd.osgi.Processor actualProperties, Collection<ResolutionCallback> callbacks, ResolverLogger resolverLogger) The main workhorse to resolve- Parameters:
project- used for reporting errorsactualProperties- the actual properties used for resolving. This can be the project in builders that do not use theBndEditModel, otherwise it is generally theBndEditModel.callbacks- any callbacksresolverLogger- an optional Logger for the resolve Process. The Logger needs to be closed manually.- Returns:
- a Resolution
-
resolve
public static RunResolution resolve(aQute.bnd.build.Project project, Collection<ResolutionCallback> callbacks) The secondary workhorse to resolve. This can be used if there is no interactive editing. In that case the properties to resolve are in the project and we can use the project both for the domain and the properties.- Parameters:
project- used for reporting errors and the properties for the resolve operationscallbacks- any callbacks- Returns:
- a Resolution
-
isOK
public boolean isOK()Check if the resolution is ok, that is, there was no exception.- Returns:
- true if there was no exception
-
updateBundles
public boolean updateBundles(aQute.bnd.build.model.BndEditModel model) Update theBndEditModelwith the calculated set of runbundles. Use theResolutionInstructions.runstartlevel(RunStartLevel).order to order the bundles. Do not update it if the list has not changed. In that case return false (no changes)If the
ResolutionInstructions.runstartlevel(RunStartLevel).order is then merge the list with the previous one.return true if the list was changed
- Parameters:
model- the edit model to update- Returns:
- true if there were changes
-
updateBundles
public void updateBundles(aQute.bnd.build.Project project) -
sortByDependencies
public List<org.osgi.resource.Resource> sortByDependencies(Map<org.osgi.resource.Resource, List<org.osgi.resource.Wire>> resolution) Sort the resources based on their dependencies. Least dependent bundles are first. This method uses a toplogical sort. If there are cycles then clearly the topological sort is not perfect.- Parameters:
resolution- the required wiring- Returns:
- a topologically sorted list of resources
-
getGraph
public Map<org.osgi.resource.Resource,List<org.osgi.resource.Resource>> getGraph(Map<org.osgi.resource.Resource, List<org.osgi.resource.Wire>> resolution) Turn the wiring into a a->b map.- Parameters:
resolution- the wiring- Returns:
- a map where the vertices are connected to other vertices.
-
getRunBundles
Get a list of ordered run bundles.- Returns:
- a list of ordered bundles
-
getResolvedRunBundles
Gets the resolution result as a list of bundle ids that represent the new -runbundles- Returns:
- the BundleIds of the bundles in the resolution
-
getRunBundlesAsString
Return the current -runbundles.- Returns:
- a non-null string in parameters format
-
getOrderedResources
-
getOrderedResources
-
dot
-
getContainers
Get a list of runbundles as containers- Throws:
Exception
-
reportException
-
report
-
getRequired
-
cache
public void cache()Cache this resolution for the given project. A cache can be retrieved with getCached(Project project). This requires a real resolution -
getRunBundles
public static aQute.bnd.result.Result<String> getRunBundles(aQute.bnd.build.Project project, boolean resolveIfNecessary) Get the run bundles from the cache and resolve if necessary. The run bundles- Parameters:
project- the project to get the run bundles fromresolveIfNecessary- if true, call resolve- Returns:
- a result, where the value can be null
-
asResult
Return a result based on the isOk status. If OK, the result is a resolution, otherwise it is an error string.- Returns:
- a result based on isOk
-
clearCache
public static void clearCache(aQute.bnd.build.Workspace ws)
-