use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.
the class LicensePresenter method acceptLicense.
protected void acceptLicense(String licenseId) {
String licText;
try {
licText = loadLicenseText(licenseId);
} catch (IOException ex) {
throw feedback.failure("INSTALL_ErrorHandlingLicenses", ex, ex.getLocalizedMessage());
}
for (MetadataLoader ldr : licensesToAccept.get(licenseId)) {
Boolean result = null;
try {
// first ask the metadata loader delegate.
result = ldr.recordLicenseAccepted(ldr.getComponentInfo(), licenseId, licText, null);
} catch (IOException ex) {
feedback.error("WARN_LicenseNotRecorded", ex, licenseId, ex.getLocalizedMessage());
}
if (result == null) {
localRegistry.acceptLicense(ldr.getComponentInfo(), licenseId, licText);
}
}
licensesToAccept.remove(licenseId);
}
use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.
the class LicensePresenter method formatComponentList.
String formatComponentList(String licId) {
List<MetadataLoader> loaders = licensesToAccept.get(licId);
String list = null;
for (MetadataLoader l : loaders) {
ComponentInfo ci = l.getComponentInfo();
if (list == null) {
list = feedback.l10n("INSTALL_LicenseComponentStart", ci.getName());
} else {
list = feedback.l10n("INSTALL_LicenseComponentCont", list, ci.getName());
}
}
return list;
}
use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.
the class LicensePresenter method filterAcceptedLicenses.
public void filterAcceptedLicenses() {
for (String licId : new ArrayList<>(licensesToAccept.keySet())) {
Collection<MetadataLoader> loaders = licensesToAccept.get(licId);
for (MetadataLoader ldr : new ArrayList<>(loaders)) {
ComponentInfo ci = ldr.getComponentInfo();
// query the metadata loader (possibly delegates to original software channel
// provider).
Date accepted = ldr.isLicenseAccepted(ci, licId);
if (accepted == null) {
accepted = localRegistry.isLicenseAccepted(ci, licId);
}
if (accepted != null) {
feedback.verboseOutput("INSTALL_LicenseAcceptedAt", ldr.getLicenseType(), accepted, ci.getId(), ci.getName());
loaders.remove(ldr);
}
}
if (loaders.isEmpty()) {
licensesToAccept.remove(licId);
}
}
multiLicenses = licensesToAccept.size() > 1;
}
use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.
the class InstallCommand method completeInstallers0.
void completeInstallers0(List<ComponentParam> in) throws IOException {
// now fileName real installers for parameters which were omitted
for (ComponentParam p : in) {
Installer i = realInstallers.get(p);
if (i == null) {
MetadataLoader floader = p.createFileLoader();
ComponentInfo initialInfo = parameterInfos.get(p);
ComponentInfo finfo = floader.getComponentInfo();
if (initialInfo != null && (!initialInfo.getId().equals(finfo.getId()) || !initialInfo.getVersion().equals(finfo.getVersion()))) {
String msg = String.format(feedback.l10n("@INSTALL_Error_ComponentDiffers_Report"), initialInfo.getId(), finfo.getId(), initialInfo.getVersionString(), finfo.getVersionString());
feedback.verbatimPart(msg, true, false);
throw feedback.failure("INSTALL_Error_ComponentDiffers", null);
}
i = createInstaller(p, floader);
if (!verifyInstaller(i)) {
continue;
}
addLicenseToAccept(i, floader);
registerComponent(i, p);
if (validateBeforeInstall) {
current = i.getComponentInfo().getName();
i.validateAll();
} else {
if (!force) {
i.validateRequirements();
}
}
realInstallers.put(p, i);
}
}
}
use of org.graalvm.component.installer.persist.MetadataLoader 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;
}
Aggregations