use of org.apache.felix.fileinstall.plugins.resolver.ResolveResult in project felix by apache.
the class DeploymentInstaller method performResolve.
private InstallableUnitImpl performResolve(File file) {
debug("Starting resolve for file: %s", file);
ResolveRequest request;
try {
request = analyseFile(file);
} catch (Exception e) {
debug("Failed to analyse file %s: %s", file, e.getMessage());
return newFailedUnit(file, file.getName(), file.getName(), "UNKNOWN_VERSION", String.format("Error reading archive file %s: %s", file.getAbsolutePath(), e.getMessage()));
}
ResolveResult result;
try {
result = this.resolver.resolve(request);
} catch (Exception e) {
debug("Failed to resolve file %s: %s", file, e.getMessage());
return newFailedUnit(file, request.getName(), request.getSymbolicName(), request.getVersion(), "Resolution failed: " + e.getMessage());
}
List<Artifact> artifacts = new ArrayList<>(result.getResources().size());
for (Entry<Resource, String> resourceEntry : result.getResources().entrySet()) {
Capability idCap = getIdentityCapability(resourceEntry.getKey());
ArtifactImpl artifact = new ArtifactImpl(getIdentity(idCap), getVersion(idCap), resourceEntry.getValue(), getContentHash(resourceEntry.getKey()));
artifacts.add(artifact);
}
debug("Sucessful resolve for file %s: Deployment-Name=%s, Deployment-SymbolicName=%s, Deployment-Version= %s", file, request.getName(), request.getSymbolicName(), request.getVersion());
return newResolvedUnit(file, request.getName(), request.getSymbolicName(), request.getVersion(), artifacts);
}
Aggregations