use of org.graalvm.component.installer.SoftwareChannel in project graal by oracle.
the class MergeStorage method loadComponentMetadata.
@Override
public Set<ComponentInfo> loadComponentMetadata(String id) throws IOException {
Set<ComponentInfo> cis = new HashSet<>();
for (SoftwareChannel swch : channels) {
Set<ComponentInfo> newInfos = swch.getStorage().loadComponentMetadata(id);
if (newInfos == null || newInfos.isEmpty()) {
continue;
}
if (!acceptAllSources) {
newInfos.removeAll(cis);
}
for (ComponentInfo ci : newInfos) {
ci.setPriority(getChannelPriority(swch));
channelMap.put(ci, swch);
}
cis.addAll(newInfos);
if (!acceptAllSources) {
break;
}
}
return cis;
}
use of org.graalvm.component.installer.SoftwareChannel in project graal by oracle.
the class RemoteCatalogDownloader method mergeChannels.
private MergeStorage mergeChannels() {
if (mergedStorage != null) {
return mergedStorage;
}
mergedStorage = new MergeStorage(input.getLocalRegistry(), feedback);
mergedStorage.setIgnoreCatalogErrors(input.hasOption(Commands.OPTION_IGNORE_CATALOG_ERRORS));
for (SoftwareChannelSource spec : getChannelSources()) {
SoftwareChannel ch = null;
for (SoftwareChannel.Factory f : factories) {
ch = f.createChannel(spec, input, feedback);
if (ch != null) {
break;
}
}
if (ch != null) {
mergedStorage.addChannel(spec, ch);
}
}
return mergedStorage;
}
use of org.graalvm.component.installer.SoftwareChannel in project graal by oracle.
the class MergeStorage method listComponentIDs.
@Override
public Set<String> listComponentIDs() throws IOException {
Set<String> ids = new HashSet<>();
List<Exception> savedEx = new ArrayList<>();
List<SoftwareChannel> errChannels = new ArrayList<>();
boolean oneSucceeded = false;
Exception toThrow = null;
for (SoftwareChannel del : new ArrayList<>(channels)) {
try {
ids.addAll(del.getStorage().listComponentIDs());
oneSucceeded = true;
} catch (IncompatibleException ex) {
savedEx.add(ex);
errChannels.add(del);
channels.remove(del);
} catch (IOException | FailedOperationException ex) {
if (!isIgnoreCatalogErrors()) {
throw ex;
}
if (!idsLoaded) {
reportError(ex, del);
}
toThrow = ex;
channels.remove(del);
}
}
if (!oneSucceeded || ids.isEmpty()) {
for (int i = 0; i < savedEx.size(); i++) {
reportError(toThrow = savedEx.get(i), errChannels.get(i));
}
if (toThrow instanceof IOException) {
throw (IOException) toThrow;
} else if (toThrow != null) {
throw (InstallerStopException) toThrow;
}
}
idsLoaded = true;
return ids;
}
Aggregations