ProvisionResult result = provisioner.findResources(reqs); for (Resource res : result.getResources()) { provisioner.installResource(res, result.getMapping()); }
The Provisioner gets a set of Resource candidates from the Repository and uses a Resolver to find a consistent wiring solution for the current state of the Environment. After this no-impact analysis, the Provisioner can be used to install the required set of Resources to the Environment.
ProvisionResult result = provisioner.findResources(reqs); for (Resource res : result.getResources()) { provisioner.installResource(res, result.getMapping()); }
Given Requirements can be abstract like this
<resource> <capability namespace="gravia.identity"> <attribute name="gravia.identity" value="camel.jmx.feature" /> <attribute name="type" value="abstract" /> </capability> <requirement namespace="gravia.identity"> <attribute name="gravia.identity" value="org.apache.camel.camel.jmx" /> <attribute name="version" value="[2.11,3.0)" /> </requirement> </resource>
The ProvisionResult aggregates
The list of resources that need to be added to the Environment to provide the required Capabilities
The individual wire mapping for each Requirements
If not empty, the set of unsatisfied Requirements
The Resources returned by the ProvisionResult should not be installed if there are unsatisfied Requirements
Installing a Resource may mean something very different depending on the target environment. Gravia provides the abstraction of a ResourceHandle that is returned from
ResourceHandle handle = provisioner.installResource(res, result.getMapping());
It allows the adaption to environment specific types and the subsequent uninstall of the Resource.
handle.uninstall();
which would also be specific to the target environment.