use of org.graalvm.component.installer.Feedback in project graal by oracle.
the class GraalChannel method loadStorage.
@Override
protected ComponentStorage loadStorage() throws IOException {
FileDownloader dn = new FileDownloader(fb.l10n("OLDS_ReleaseFile"), getIndexURL(), fb);
dn.download();
Path storagePath = dn.getLocalFile().toPath();
List<ReleaseEntry> releases = loadReleasesIndex(storagePath);
if (releases.isEmpty()) {
return throwEmptyStorage();
}
MergeStorage store = new MergeStorage(localRegistry, fb);
store.setAcceptAllSources(true);
for (ReleaseEntry en : releases) {
URL catURL = en.getCatalogURL();
Version v = Version.fromString(en.getVersion().displayString());
SoftwareChannelSource src = new SoftwareChannelSource(catURL.toString(), en.getLabel());
WebCatalog cata = new WebCatalog(src.getLocationURL(), src) {
@Override
protected RemotePropertiesStorage createPropertiesStorage(Feedback aFeedback, ComponentRegistry aLocal, Properties props, String selector, URL baseURL) {
return new RemotePropertiesStorage(aFeedback, aLocal, props, selector, v, baseURL);
}
};
cata.init(localRegistry, fb);
cata.setMatchVersion(en.getVersion().match(Version.Match.Type.EXACT));
cata.setRemoteProcessor((i) -> configureLicense(i, en));
store.addChannel(src, cata);
}
return store;
}
use of org.graalvm.component.installer.Feedback in project graal by oracle.
the class DirectoryChannelFactory method createChannel.
@Override
public SoftwareChannel createChannel(SoftwareChannelSource source, CommandInput input, Feedback output) {
String u = source.getLocationURL();
if (!u.startsWith("file:")) {
// NOI18N
return null;
}
Feedback out2 = output.withBundle(DirectoryChannelFactory.class);
try {
Path p = new File(new URI(u)).toPath();
if (!Files.isDirectory(p)) {
return null;
}
DirectoryCatalogProvider dp = new DirectoryCatalogProvider(p, out2);
dp.setVerifyJars(input.optValue(Commands.OPTION_NO_VERIFY_JARS) == null);
// do not report errors for directory sources implied by commandline arguments.
if (Boolean.FALSE.toString().equals(source.getParameter("reportErrors"))) {
// NOI18N
dp.setReportErrors(false);
}
return dp;
} catch (URISyntaxException ex) {
out2.error("ERR_DirectoryURLInvalid", ex, u, ex.getMessage());
return null;
}
}
use of org.graalvm.component.installer.Feedback in project graal by oracle.
the class UninstallCommand method checkBrokenDependencies.
void checkBrokenDependencies() {
if (brokenDependencies.isEmpty()) {
return;
}
Set<ComponentInfo> uninstalled = new HashSet<>(toUninstall.values());
// get all broken components, excluding the ones scheduled for uninstall
Stream<ComponentInfo> stm = brokenDependencies.values().stream().flatMap((col) -> col.stream()).filter((c) -> !uninstalled.contains(c));
// if all broken are uninstalled -> OK
if (!stm.findFirst().isPresent()) {
return;
}
List<ComponentInfo> sorted = new ArrayList<>(brokenDependencies.keySet());
P printer;
boolean warning = removeDependent || breakDependent;
if (warning) {
printer = feedback::output;
feedback.output(removeDependent ? "UNINSTALL_BrokenDependenciesRemove" : "UNINSTALL_BrokenDependenciesWarn");
} else {
printer = (a, b) -> feedback.error(a, null, b);
feedback.error("UNINSTALL_BrokenDependencies", null);
}
Comparator<ComponentInfo> c = (a, b) -> a.getId().compareToIgnoreCase(b.getId());
Collections.sort(sorted, c);
for (ComponentInfo i : sorted) {
List<ComponentInfo> deps = new ArrayList<>(brokenDependencies.get(i));
deps.removeAll(uninstalled);
if (deps.isEmpty()) {
continue;
}
Collections.sort(sorted, c);
if (!warning) {
printer.print("UNINSTALL_BreakDepSource", i.getName(), i.getId());
}
for (ComponentInfo d : deps) {
printer.print("UNINSTALL_BreakDepTarget", d.getName(), d.getId());
}
}
if (warning) {
return;
}
throw feedback.failure("UNINSTALL_BreakDependenciesTerminate", null);
}
Aggregations