Search in sources :

Example 1 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry 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;
}
Also used : Path(java.nio.file.Path) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) WebCatalog(org.graalvm.component.installer.ce.WebCatalog) RemotePropertiesStorage(org.graalvm.component.installer.remote.RemotePropertiesStorage) MergeStorage(org.graalvm.component.installer.remote.MergeStorage) Properties(java.util.Properties) URL(java.net.URL) Version(org.graalvm.component.installer.Version) Feedback(org.graalvm.component.installer.Feedback) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) FileDownloader(org.graalvm.component.installer.remote.FileDownloader)

Example 2 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.

the class GraalEditionList method createComponentCatalog.

@Override
public ComponentCatalog createComponentCatalog(CommandInput in) {
    ComponentRegistry targetGraalVM = in.getLocalRegistry();
    if (targetGraalVM != this.targetGraal) {
        GraalEditionList gl = listGraalEditions(in, targetGraalVM);
        return gl.createComponentCatalog(in);
    }
    if (catalog != null) {
        return catalog;
    }
    String edId = in.optValue(Commands.OPTION_USE_EDITION, "");
    GraalEdition ge = getEdition(edId);
    RemoteCatalogDownloader downloader = createEditionDownloader(ge);
    CatalogContents col = new CatalogContents(feedback, downloader.getStorage(), targetGraalVM);
    return catalog = col;
}
Also used : GraalEdition(org.graalvm.component.installer.model.GraalEdition) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents)

Example 3 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.

the class CatalogInstallTest method testInstallDependencyFromSameDirectory.

/**
 * Checks that dependencies can be loaded from the same directory as the installed Component.
 */
@Test
public void testInstallDependencyFromSameDirectory() throws Exception {
    Path ruby193Source = dataFile("../repo/19.3.0.0/r");
    Path llvm193Source = dataFile("../repo/19.3.0.0/llvm-toolchain");
    // they should be next to eah other
    assertEquals(ruby193Source.getParent(), llvm193Source.getParent());
    files.add(ruby193Source.toFile());
    setupVersion("19.3.0.0");
    // no external catalog
    downloader = new RemoteCatalogDownloader(this, this, (URL) null);
    downloader.addLocalChannelSource(new SoftwareChannelSource(ruby193Source.getParent().toFile().toURI().toString()));
    catalogFactory = new CatalogFactory() {

        @Override
        public ComponentCatalog createComponentCatalog(CommandInput input) {
            return new CatalogContents(CatalogInstallTest.this, downloader.getStorage(), input.getLocalRegistry());
        }

        @Override
        public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
            return Collections.emptyList();
        }
    };
    FileIterable fit = new FileIterable(this, this);
    fit.setCatalogFactory(catalogFactory);
    paramIterable = fit;
    InstallCommand cmd = new InstallCommand();
    cmd.init(this, withBundle(InstallCommand.class));
    cmd.executionInit();
    cmd.executeStep(cmd::prepareInstallation, false);
    assertFalse(cmd.getDependencies().isEmpty());
}
Also used : Path(java.nio.file.Path) ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) URL(java.net.URL) CommandInput(org.graalvm.component.installer.CommandInput) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) List(java.util.List) FileIterable(org.graalvm.component.installer.FileIterable) Test(org.junit.Test)

Example 4 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.

the class InstallLicensedCatalogTest method initCatalogIterable.

private void initCatalogIterable(URL u) {
    GraalChannel channel = new GraalChannel(this, this, getLocalRegistry());
    channel.setIndexURL(u);
    cfactory = new CatalogFactory() {

        @Override
        public ComponentCatalog createComponentCatalog(CommandInput input) {
            try {
                return new CatalogContents(InstallLicensedCatalogTest.this, channel.getStorage(), localRegistry);
            } catch (IOException ex) {
                fail("Unexpected exception");
                return null;
            }
        }

        @Override
        public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
            return Collections.emptyList();
        }
    };
    paramIterable = new CatalogIterable(this, this);
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) GraalChannel(org.graalvm.component.installer.gds.GraalChannel) CommandInput(org.graalvm.component.installer.CommandInput) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents) List(java.util.List) IOException(java.io.IOException) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 5 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.

the class InstallerTest method setUp.

@Before
public void setUp() throws IOException {
    targetPath = folder.newFolder("inst").toPath();
    storage = new MockStorage();
    registry = new ComponentRegistry(this, storage);
    fileOps = SystemUtils.isWindows() ? new WindowsFileOperations() : new DefaultFileOperations();
    fileOps.init(this);
    fileOps.setRootPath(targetPath);
}
Also used : DefaultFileOperations(org.graalvm.component.installer.os.DefaultFileOperations) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) WindowsFileOperations(org.graalvm.component.installer.os.WindowsFileOperations) Before(org.junit.Before)

Aggregations

ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)16 Test (org.junit.Test)8 CatalogContents (org.graalvm.component.installer.model.CatalogContents)5 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)5 Path (java.nio.file.Path)4 List (java.util.List)4 CommandInput (org.graalvm.component.installer.CommandInput)4 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)4 URL (java.net.URL)3 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)3 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)2 Version (org.graalvm.component.installer.Version)2 DirectoryStorage (org.graalvm.component.installer.persist.DirectoryStorage)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 ComponentInstaller (org.graalvm.component.installer.ComponentInstaller)1 ComponentParam (org.graalvm.component.installer.ComponentParam)1 FailedOperationException (org.graalvm.component.installer.FailedOperationException)1 Feedback (org.graalvm.component.installer.Feedback)1