Search in sources :

Example 1 with SoftwareChannel

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;
}
Also used : SoftwareChannel(org.graalvm.component.installer.SoftwareChannel) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) HashSet(java.util.HashSet)

Example 2 with SoftwareChannel

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;
}
Also used : SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) SoftwareChannel(org.graalvm.component.installer.SoftwareChannel)

Example 3 with SoftwareChannel

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;
}
Also used : SoftwareChannel(org.graalvm.component.installer.SoftwareChannel) ArrayList(java.util.ArrayList) IOException(java.io.IOException) InstallerStopException(org.graalvm.component.installer.InstallerStopException) IOException(java.io.IOException) IncompatibleException(org.graalvm.component.installer.IncompatibleException) FailedOperationException(org.graalvm.component.installer.FailedOperationException) FailedOperationException(org.graalvm.component.installer.FailedOperationException) IncompatibleException(org.graalvm.component.installer.IncompatibleException) HashSet(java.util.HashSet)

Aggregations

SoftwareChannel (org.graalvm.component.installer.SoftwareChannel)3 HashSet (java.util.HashSet)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 FailedOperationException (org.graalvm.component.installer.FailedOperationException)1 IncompatibleException (org.graalvm.component.installer.IncompatibleException)1 InstallerStopException (org.graalvm.component.installer.InstallerStopException)1 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)1 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)1