Search in sources :

Example 1 with Archive

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

the class InstallVersionsTest method overrideCreateInstaller.

@SuppressWarnings("unused")
protected Installer overrideCreateInstaller(ComponentParam p, MetadataLoader ldr) throws IOException {
    ComponentInfo partialInfo;
    partialInfo = ldr.getComponentInfo();
    ldr.loadPaths();
    Archive a = null;
    Installer inst = new Installer(this, getFileOperations(), partialInfo, getLocalRegistry(), getRegistry(), a);
    inst.setPermissions(ldr.loadPermissions());
    inst.setSymlinks(ldr.loadSymlinks());
    return inst;
}
Also used : Archive(org.graalvm.component.installer.Archive) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo)

Example 2 with Archive

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

the class InstallCommand method createInstaller.

Installer createInstaller(ComponentParam p, MetadataLoader ldr) throws IOException {
    ComponentInfo partialInfo;
    partialInfo = ldr.getComponentInfo();
    parameterInfos.putIfAbsent(p, partialInfo);
    feedback.verboseOutput("INSTALL_PrepareToInstall", p.getDisplayName(), partialInfo.getId(), partialInfo.getVersionString(), partialInfo.getName());
    ldr.loadPaths();
    Archive a = null;
    if (p.isComplete()) {
        a = ldr.getArchive();
        a.verifyIntegrity(input);
    }
    Installer inst = new Installer(feedback, input.getFileOperations(), partialInfo, input.getLocalRegistry(), input.getRegistry(), a);
    inst.setPermissions(ldr.loadPermissions());
    inst.setSymlinks(ldr.loadSymlinks());
    configureInstaller(inst);
    return inst;
}
Also used : Archive(org.graalvm.component.installer.Archive) ComponentInstaller(org.graalvm.component.installer.ComponentInstaller) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo)

Example 3 with Archive

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

the class UpgradeProcess method createGraalVMInstaller.

/**
 * Completes the component info, loads symlinks, permissions. Same as
 * {@link InstallCommand#createInstaller}.
 */
GraalVMInstaller createGraalVMInstaller(ComponentInfo info) throws IOException {
    ComponentParam p = createGraalComponentParam(info);
    MetadataLoader ldr = p.createFileLoader();
    ldr.loadPaths();
    if (p.isComplete()) {
        Archive a;
        a = ldr.getArchive();
        a.verifyIntegrity(input);
    }
    ComponentInfo completeInfo = ldr.getComponentInfo();
    targetInfo = completeInfo;
    metaLoader = ldr;
    GraalVMInstaller gvmInstaller = new GraalVMInstaller(feedback, input.getFileOperations(), input.getLocalRegistry(), completeInfo, catalog, metaLoader.getArchive());
    // do not create symlinks if disabled, or target directory is given.
    boolean disableSymlink = input.hasOption(Commands.OPTION_NO_SYMLINK) || input.hasOption(Commands.OPTION_TARGET_DIRECTORY);
    gvmInstaller.setDisableSymlinks(disableSymlink);
    // will make registrations for bundled components, too.
    gvmInstaller.setAllowFilesInComponentDir(true);
    gvmInstaller.setCurrentInstallPath(input.getGraalHomePath());
    gvmInstaller.setInstallPath(newInstallPath);
    gvmInstaller.setPermissions(ldr.loadPermissions());
    gvmInstaller.setSymlinks(ldr.loadSymlinks());
    newGraalHomePath = gvmInstaller.getInstalledPath();
    return gvmInstaller;
}
Also used : Archive(org.graalvm.component.installer.Archive) ComponentParam(org.graalvm.component.installer.ComponentParam) MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo)

Example 4 with Archive

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

the class LicensePresenter method loadFileLicenseText.

String loadFileLicenseText(MetadataLoader ldr) throws IOException {
    // may require a download of the archive
    try (Archive a = ldr.getArchive()) {
        String licensePath = ldr.getLicensePath();
        Archive.FileEntry licenseEntry = null;
        for (Archive.FileEntry e : a) {
            String n = e.getName();
            if (n.startsWith("/")) {
                n = n.substring(1);
            } else if (n.startsWith("./")) {
                n = n.substring(2);
            }
            if (n.equals(licensePath)) {
                licenseEntry = e;
                break;
            }
        }
        if (licenseEntry == null) {
            throw new IOException(feedback.l10n("INSTALL_LicenseNotFound", licensePath));
        }
        try (InputStream es = a.getInputStream(licenseEntry);
            InputStreamReader esr = new InputStreamReader(es, "UTF-8");
            BufferedReader buf = new BufferedReader(esr)) {
            // NOI18N
            return buf.lines().collect(Collectors.joining("\n"));
        }
    }
}
Also used : Archive(org.graalvm.component.installer.Archive) InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException)

Aggregations

Archive (org.graalvm.component.installer.Archive)4 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)3 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 ComponentInstaller (org.graalvm.component.installer.ComponentInstaller)1 ComponentParam (org.graalvm.component.installer.ComponentParam)1 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)1